Skip to content

Commit

Permalink
Merge pull request #133 from jbedard/fix-update-refs
Browse files Browse the repository at this point in the history
fix: fetch grammars from non-reference commits
  • Loading branch information
smacker authored Dec 15, 2023
2 parents 4c62eac + ab54e6e commit e703811
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 e703811

Please sign in to comment.