Skip to content

Commit

Permalink
fix: fetch grammars from non-reference commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Nov 30, 2023
1 parent 0d0a9f7 commit ab54e6e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions _automation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,18 @@ 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())
}
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 {
Expand Down

0 comments on commit ab54e6e

Please sign in to comment.