Skip to content

Commit

Permalink
Fix up fetching from repo contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
inverse committed May 21, 2023
1 parent e434d6b commit cb6c2f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,19 @@ func GetRepoContributors() ([]string, error) {
return nil, err
}

contributors := strings.Split(string(out), "\r\n")
toRemove := []int{}
contributors := strings.Split(string(out), "\n")
for index, contributor := range contributors {
contributors[index] = strings.TrimSpace(contributor[strings.IndexByte(contributor, '\t'):])
tabIndex := strings.IndexByte(contributor, '\t')
if tabIndex == -1 {
toRemove = append(toRemove, index)
continue
}
contributors[index] = strings.TrimSpace(contributor[tabIndex:])
}

for _, index := range toRemove {
contributors = append(contributors[:index], contributors[index+1:]...)
}

return contributors, nil
Expand Down

0 comments on commit cb6c2f3

Please sign in to comment.