diff options
| author | Luke Tomlinson <luketomlinson@github.com> | 2023-05-30 19:07:40 +0000 |
|---|---|---|
| committer | Luke Tomlinson <luketomlinson@github.com> | 2023-05-30 19:07:40 +0000 |
| commit | 9e7181f04ac8e162cb17ec779d7c80b999c0e673 (patch) | |
| tree | 47f2ca3293ce9cddaaa36324544a9feab68d09e0 /dist | |
| parent | b5131a22acef3cd19082a3e66b8389587b836391 (diff) | |
Use rev-list for tagsluketomlinson/tags
Diffstat (limited to 'dist')
| -rw-r--r-- | dist/index.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dist/index.js b/dist/index.js index e6f5df8..429b1cc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -722,6 +722,18 @@ class GitCommandManager { return output.stdout.trim(); }); } + /** + * Lists SHAs pointed to by a revision. + * @param {string} ref For example: 'refs/heads/main' or '/refs/tags/v1' + * @param {number} numberOfRefs + * @param value + */ + revList(ref, numberOfRefs) { + return __awaiter(this, void 0, void 0, function* () { + const output = yield this.execGit(['rev-list', ref, `-${numberOfRefs}`]); + return output.stdout.trim(); + }); + } setEnvironmentVariable(name, value) { this.gitEnv[name] = value; } @@ -1982,7 +1994,7 @@ function testRef(git, ref, commit) { // refs/tags/ else if (upperRef.startsWith('REFS/TAGS/')) { const tagName = ref.substring('refs/tags/'.length); - return ((yield git.tagExists(tagName)) && commit === (yield git.revParse(ref))); + return ((yield git.tagExists(tagName)) && commit === (yield git.revList(ref, 1))); } // Unexpected else { |
