Retrieve the sha for the commit.
(commitId: number, type: 'long' | 'short' = 'long')
| 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 | } |
no test coverage detected