implement git blacklist

This commit is contained in:
Martinez 2015-12-26 16:29:08 +01:00
parent 83c5127414
commit e6930e3642

View file

@ -325,11 +325,16 @@ class GitPart(Part):
def __init__(self):
Part.__init__(self)
# avoid expensive parsing if blacklisted
cwd = os.getcwd()
deep_parse = not any([cwd.startswith(d) for d in GIT_BLACKLIST])
branch_name = command("git name-rev --name-only --no-undefined --always HEAD").strip()
if branch_name:
self.fragments.append("")
if deep_parse:
count_to_pull = command("git log --oneline ..@{u}").count("\n")
count_to_push = command("git log --oneline @{u}..").count("\n")
git_dir = command("git rev-parse --git-dir").strip()
@ -356,6 +361,7 @@ class GitPart(Part):
self.fragments.append(branch_name)
self.fragments.append(style_reset())
if deep_parse:
if untracked:
self.fragments.append(style_color(COLOR_GIT_UNTRACKED))
self.fragments.append(" ?%d" %(untracked))