From ab54e6ea352b9cbbcbd417ba6d91140883dcf011 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Wed, 29 Nov 2023 16:30:40 -0800 Subject: [PATCH] fix: fetch grammars from non-reference commits --- _automation/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_automation/main.go b/_automation/main.go index cb4a8133..51d97cc3 100644 --- a/_automation/main.go +++ b/_automation/main.go @@ -421,7 +421,7 @@ func logAndExit(logger *Logger, msg string, args ...interface{}) { // Git func fetchLastTag(repository string) (string, string) { - cmd := exec.Command("git", "ls-remote", "--tags", "--refs", "--sort", "-v:refname", repository, "v*") + cmd := exec.Command("git", "ls-remote", "--tags", "--sort", "-v:refname", repository, "v*") b, err := cmd.Output() if err != nil { logAndExit(defaultLogger, err.Error()) @@ -429,7 +429,10 @@ func fetchLastTag(repository string) (string, string) { line := strings.SplitN(string(b), "\n", 2)[0] parts := strings.Split(line, "\t") - return strings.Split(parts[1], "/")[2], parts[0] + tag := strings.TrimRight(strings.Split(parts[1], "/")[2], "^{}") + rev := strings.Split(parts[0], "^")[0] + + return tag, rev } func fetchLastCommit(repository, branch string) string {