Skip to content

Commit

Permalink
Merge pull request #2236 from rsteube/git-alias-outofrange
Browse files Browse the repository at this point in the history
git: alias - fix out of range error
  • Loading branch information
rsteube authored Feb 9, 2024
2 parents d2cd58e + a6427ff commit 0e5ddb7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/actions/tools/git/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func Aliases(dir, gitDir string) (map[string]string, error) {
} else {
scanner := bufio.NewScanner(bytes.NewReader(output))
for scanner.Scan() {
split := strings.SplitN(scanner.Text(), " ", 2)
name := strings.TrimPrefix(split[0], "alias.")
if splitted := strings.SplitN(scanner.Text(), " ", 2); len(splitted) == 2 && strings.HasPrefix(splitted[0], "alias.") {
name := strings.TrimPrefix(splitted[0], "alias.")

// in the case of duplicates, last alias wins
aliases[name] = split[1]
// in the case of duplicates, last alias wins
aliases[name] = splitted[1]
}
}
}

Expand Down

0 comments on commit 0e5ddb7

Please sign in to comment.