Skip to content

Commit

Permalink
Merge pull request #370 from jessehouwing/fix/use-no-locks
Browse files Browse the repository at this point in the history
Background tasks should use --no-optional-locks to prevent issues with other tools running at the same time.
  • Loading branch information
justjanne authored Jan 16, 2023
2 parents a7e4485 + b46d8a5 commit fe0a2a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions segment-git.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ func parseGitBranchInfo(status []string) map[string]string {
}

func getGitDetachedBranch(p *powerline) string {
out, err := runGitCommand("git", "rev-parse", "--short", "HEAD")
out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--short", "HEAD")
if err != nil {
out, err := runGitCommand("git", "symbolic-ref", "--short", "HEAD")
out, err := runGitCommand("git", "--no-optional-locks", "symbolic-ref", "--short", "HEAD")
if err != nil {
return "Error"
}
Expand Down Expand Up @@ -160,7 +160,7 @@ func parseGitStats(status []string) repoStats {
}

func repoRoot(path string) (string, error) {
out, err := runGitCommand("git", "rev-parse", "--show-toplevel")
out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--show-toplevel")
if err != nil {
return "", err
}
Expand All @@ -187,7 +187,7 @@ func segmentGit(p *powerline) []pwl.Segment {
}

args := []string{
"status", "--porcelain", "-b", "--ignore-submodules",
"--no-optional-locks", "status", "--porcelain", "-b", "--ignore-submodules",
}

if p.cfg.GitAssumeUnchangedSize > 0 {
Expand Down Expand Up @@ -262,7 +262,7 @@ func segmentGit(p *powerline) []pwl.Segment {
}

if stashEnabled {
out, err = runGitCommand("git", "rev-list", "-g", "refs/stash")
out, err = runGitCommand("git", "--no-optional-locks", "rev-list", "-g", "refs/stash")
if err == nil {
stats.stashed = strings.Count(out, "\n")
}
Expand Down
4 changes: 2 additions & 2 deletions segment-gitlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func segmentGitLite(p *powerline) []pwl.Segment {
if len(p.ignoreRepos) > 0 {
out, err := runGitCommand("git", "rev-parse", "--show-toplevel")
out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--show-toplevel")
if err != nil {
return []pwl.Segment{}
}
Expand All @@ -18,7 +18,7 @@ func segmentGitLite(p *powerline) []pwl.Segment {
}
}

out, err := runGitCommand("git", "rev-parse", "--abbrev-ref", "HEAD")
out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--abbrev-ref", "HEAD")
if err != nil {
return []pwl.Segment{}
}
Expand Down

0 comments on commit fe0a2a4

Please sign in to comment.