mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
Update git.py - added a check to see if branch exists
Forgot to check if a branch existed! Fixed that. Now the script works in both .git repos and other directories.
This commit is contained in:
parent
8edea0455d
commit
e68c998799
|
|
@ -67,15 +67,17 @@ class Segment(ThreadedSegment):
|
|||
def run(self):
|
||||
self.stats, self.branch = build_stats()
|
||||
|
||||
# Abbreviates master branch to M
|
||||
if self.powerline.segment_conf("git", "master_is_M"):
|
||||
if self.branch == "master":
|
||||
self.branch = "M"
|
||||
if self.branch:
|
||||
# Abbreviates master branch to M
|
||||
if self.powerline.segment_conf("git", "master_is_M"):
|
||||
if self.branch == "master":
|
||||
self.branch = "M"
|
||||
|
||||
# Truncates branch length
|
||||
branch_max_length = self.powerline.segment_conf("git", "branch_max_length", -1)
|
||||
if len(self.branch) > branch_max_length :
|
||||
self.branch = self.branch[:branch_max_length] + u'\u2026'
|
||||
# Truncates branch length
|
||||
branch_max_length = self.powerline.segment_conf("git", "branch_max_length", -1)
|
||||
if len(self.branch) > branch_max_length :
|
||||
self.branch = self.branch[:branch_max_length] + u'\u2026'
|
||||
|
||||
|
||||
def add_to_powerline(self):
|
||||
self.join()
|
||||
|
|
|
|||
Loading…
Reference in a new issue