Skip to content

Commit

Permalink
Significantly improve git performance
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Dec 12, 2019
1 parent b8e6cf2 commit 36d6d34
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions segment-git.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func segmentGit(p *powerline) {
if len(p.ignoreRepos) > 0 {
out, err := runGitCommand("git", "rev-parse", "--show-toplevel")
if err != nil {
panic(err)
return
}
out = strings.TrimSpace(out)
Expand All @@ -138,6 +139,7 @@ func segmentGit(p *powerline) {

out, err := runGitCommand("git", "status", "--porcelain", "-b", "--ignore-submodules")
if err != nil {
panic(err)
return
}

Expand Down Expand Up @@ -167,11 +169,8 @@ func segmentGit(p *powerline) {
background = p.theme.RepoCleanBg
}

out, err = runGitCommand("git", "stash", "list")
if err != nil {
return
}
if len(out) > 0 {
out, err = runGitCommand("git", "rev-list", "-g", "refs/stash")
if err == nil && len(out) > 0 {
stats.stashed = len(strings.Split(out, "\n")) - 1
}

Expand Down

0 comments on commit 36d6d34

Please sign in to comment.