aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/prompt/git.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/prompt/git.go b/pkg/prompt/git.go
index 20f9445..054df36 100644
--- a/pkg/prompt/git.go
+++ b/pkg/prompt/git.go
@@ -63,8 +63,12 @@ func getRepoStatusField(repoRootPath string) string {
bytes, err = ioutil.ReadFile(filepath.Join(repoRootPath, ".git", refSpec))
commitID := strings.TrimSpace(string(bytes))
if err != nil {
- handleError(err)
- commitID = withColor("1;41", "unknown")
+ if os.IsNotExist(err) {
+ commitID = withColor("37", "blank")
+ } else {
+ handleError(err)
+ commitID = withColor("1;41", "unknown")
+ }
}
return formatRepoStatusField(refSpecDisplay, commitID)