Skip to content

Commit

Permalink
fix(#10): use previous logic to determine lack of results
Browse files Browse the repository at this point in the history
  • Loading branch information
usrme committed Jul 27, 2023
1 parent e125dbd commit 6bcf60c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ func filesInStaging() ([]string, error) {
if err != nil {
return []string{}, fmt.Errorf(string(output))
}

files := strings.Split(strings.TrimSpace(string(output)), "\n")
if len(files) == 0 {
lines := strings.TrimSpace(string(output))
if lines == "" {
return []string{}, fmt.Errorf("no files added to staging area")
}
return files, nil
return strings.Split(lines, "\n"), nil
}

func checkGitInPath() error {
Expand Down

0 comments on commit 6bcf60c

Please sign in to comment.