Skip to content

Commit

Permalink
Fix double character in non-git dir (#5)
Browse files Browse the repository at this point in the history
This commit fixes an issue where a the first character would be repeated
in the following scenario:

1. cd to directory that's not part of a git repo
2. Type 'a'
3. Hit tab
4. Cancel with ctrl-c
5. Double aa shows up

The fix is to print nothing at all if there is no output.
  • Loading branch information
akupila authored Mar 26, 2019
1 parent 2664dd3 commit 98a065a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/gitprompt/gitprompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func main() {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if s == nil {
return
}
out, num := gitprompt.Print(s, format.String())
_, _ = fmt.Fprint(os.Stdout, out)
if *zsh {
Expand Down

0 comments on commit 98a065a

Please sign in to comment.