MCPcopy Index your code
hub / github.com/angular/dev-infra / commit

Method commit

ng-dev/utils/testing/sandbox-testing.ts:47–59  ·  view source on GitHub ↗

* Creates a commit with the given message. Optionally, an id can be specified to * associate the created commit with a shortcut in order to reference it conveniently * when writing tests (e.g. when cherry-picking later).

(message: string, id?: number)

Source from the content-addressed store, hash-verified

45 * when writing tests (e.g. when cherry-picking later).
46 */
47 commit(message: string, id?: number): this {
48 // Capture existing files in the temporary directory. e.g. if a changelog
49 // file has been written before we want to preserve that in the fake repo.
50 runGitInTmpDir(['add', '-A']);
51 runGitInTmpDir(['commit', '--allow-empty', '-m', message]);
52
53 if (id !== undefined) {
54 const commitSha = runGitInTmpDir(['rev-parse', 'HEAD']);
55 this._commitShaById.set(id, commitSha);
56 }
57
58 return this;
59 }
60
61 /** Branches off the current repository `HEAD`. */
62 branchOff(newBranchName: string): this {

Calls 2

runGitInTmpDirFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected