|
@@ -23,9 +23,10 @@ def get_tagname_or_hash():
|
|
return hash_
|
|
return hash_
|
|
return None
|
|
return None
|
|
|
|
|
|
-# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count
|
|
|
|
|
|
+# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stash count
|
|
|
|
+# Use `--git-common-dir` to avoid problems with git worktrees, which don't have individual stashes
|
|
def get_stash():
|
|
def get_stash():
|
|
- cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
|
|
|
|
|
|
+ cmd = Popen(['git', 'rev-parse', '--git-common-dir'], stdout=PIPE, stderr=PIPE)
|
|
so, se = cmd.communicate()
|
|
so, se = cmd.communicate()
|
|
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
|
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
|
|
|
|
|
@@ -35,7 +36,6 @@ def get_stash():
|
|
except IOError:
|
|
except IOError:
|
|
return 0
|
|
return 0
|
|
|
|
|
|
-
|
|
|
|
# `git status --porcelain --branch` can collect all information
|
|
# `git status --porcelain --branch` can collect all information
|
|
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
|
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
|
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
|
|
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
|