浏览代码

Cleanup the rest of gitstatus.py

Marc Cornellà 9 年之前
父节点
当前提交
1d133ff11f
共有 1 个文件被更改,包括 3 次插入6 次删除
  1. 3 6
      plugins/git-prompt/gitstatus.py

+ 3 - 6
plugins/git-prompt/gitstatus.py

@@ -4,16 +4,13 @@ from __future__ import print_function
 # change this symbol to whatever you prefer
 prehash = ':'
 
+import sys
 import subprocess
 from subprocess import Popen, PIPE
 
-import sys
-gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
-branch, error = gitsym.communicate()
-
-error_string = error.decode('utf-8')
+branch, error = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE).communicate()
 
-if 'fatal: Not a git repository' in error_string:
+if 'fatal: Not a git repository' in error.decode('utf-8'):
     sys.exit(0)
 
 branch = branch.decode("utf-8").strip()[11:]