Skip to content

Commit b3eddb3

Browse files
authored
Make linting compatible with Git < v2.22.0 (#26)
Some of our CI nodes are still using Ubuntu 18 where Git is old enough to not support `git branch --show-current`.
1 parent 43506fa commit b3eddb3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dev-tools/mage/linter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ func (l Linter) All() error {
146146
func (l Linter) LastChange() error {
147147
mg.Deps(l.Install, l.CheckConfig)
148148

149-
branch, err := sh.Output("git", "branch", "--show-current")
149+
// get current branch name
150+
branch, err := sh.Output("git", "rev-parse", "--abbrev-ref", "HEAD")
150151
if err != nil {
151152
return fmt.Errorf("failed to get the current branch: %w", err)
152153
}

0 commit comments

Comments
 (0)