implement git blacklist
This commit is contained in:
parent
83c5127414
commit
e6930e3642
1 changed files with 39 additions and 33 deletions
|
@ -325,11 +325,16 @@ class GitPart(Part):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Part.__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()
|
branch_name = command("git name-rev --name-only --no-undefined --always HEAD").strip()
|
||||||
|
|
||||||
if branch_name:
|
if branch_name:
|
||||||
self.fragments.append("↱ ")
|
self.fragments.append("↱ ")
|
||||||
|
|
||||||
|
if deep_parse:
|
||||||
count_to_pull = command("git log --oneline ..@{u}").count("\n")
|
count_to_pull = command("git log --oneline ..@{u}").count("\n")
|
||||||
count_to_push = 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()
|
git_dir = command("git rev-parse --git-dir").strip()
|
||||||
|
@ -356,6 +361,7 @@ class GitPart(Part):
|
||||||
self.fragments.append(branch_name)
|
self.fragments.append(branch_name)
|
||||||
self.fragments.append(style_reset())
|
self.fragments.append(style_reset())
|
||||||
|
|
||||||
|
if deep_parse:
|
||||||
if untracked:
|
if untracked:
|
||||||
self.fragments.append(style_color(COLOR_GIT_UNTRACKED))
|
self.fragments.append(style_color(COLOR_GIT_UNTRACKED))
|
||||||
self.fragments.append(" ?%d" %(untracked))
|
self.fragments.append(" ?%d" %(untracked))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue