From 553f4ae1c0f2c566dd98a5cb9cae4f2e0bd91e1f Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:13:03 -0500 Subject: [PATCH] Use more robust way to get the most recent tag --- src/git.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/git.ts b/src/git.ts index d7b04e1..a42ec7f 100644 --- a/src/git.ts +++ b/src/git.ts @@ -21,7 +21,8 @@ export function listTagNames(): string[] { * The latest reachable tag starting from HEAD */ export function lastTag(): string { - return execa.sync("git", ["describe", "--abbrev=0", "--tags"]).stdout; + const ref = execa.sync("git", ["rev-list", "--tags", "--max-count=1"]).stdout; + return execa.sync("git", ["describe", "--tags", ref]).stdout; } export interface CommitListItem {