MCPcopy Create free account
hub / github.com/angular/dev-infra / getShaForCommitId

Method getShaForCommitId

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

Retrieve the sha for the commit.

(commitId: number, type: 'long' | 'short' = 'long')

Source from the content-addressed store, hash-verified

84
85 /** Retrieve the sha for the commit. */
86 getShaForCommitId(commitId: number, type: 'long' | 'short' = 'long'): string {
87 const commitSha = this._commitShaById.get(commitId);
88
89 if (commitSha === undefined) {
90 throw Error('Unable to retrieve SHA due to an unknown commit id.');
91 }
92
93 if (type === 'short') {
94 return runGitInTmpDir(['rev-parse', '--short', commitSha]);
95 }
96
97 return commitSha;
98 }
99}

Callers 2

cherryPickMethod · 0.95
generation.spec.tsFile · 0.80

Calls 2

runGitInTmpDirFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected