File tree 2 files changed +25
-11
lines changed
2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -447,7 +447,7 @@ function createPrivateIndex {
447
447
__GIT_INDEX_FILE=" $GIT_INDEX_FILE "
448
448
fi
449
449
__GIT_INDEX_PRIVATE=" /tmp/git-index-private$$ "
450
- cp " $__GIT_INDEX_FILE " " $__GIT_INDEX_PRIVATE " 2> /dev/null
450
+ command cp " $__GIT_INDEX_FILE " " $__GIT_INDEX_PRIVATE " 2> /dev/null
451
451
echo " $__GIT_INDEX_PRIVATE "
452
452
}
453
453
@@ -547,7 +547,7 @@ function updatePrompt() {
547
547
fi
548
548
549
549
PS1=" ${NEW_PROMPT// _LAST_COMMAND_INDICATOR_/ ${LAST_COMMAND_INDICATOR}${ResetColor} } "
550
- rm " $GIT_INDEX_PRIVATE " 2> /dev/null
550
+ command rm " $GIT_INDEX_PRIVATE " 2> /dev/null
551
551
}
552
552
553
553
# Helper function that returns virtual env information to be set in prompt
Original file line number Diff line number Diff line change 21
21
22
22
try :
23
23
Print = eval ("print" ) # python 3.0 case
24
- except SyntaxError :
24
+ python_version = 3
25
+ to_str = str
26
+ except SyntaxError as e :
27
+ python_version = 2
28
+ to_str = unicode
25
29
D = dict ()
26
30
try :
27
31
exec ("from __future__ import print_function\n p=print" , D )
@@ -126,14 +130,24 @@ def get_stash():
126
130
if remote == "" :
127
131
remote = '.'
128
132
133
+ if python_version == 2 :
134
+ remote = remote .decode ('utf-8' )
135
+
129
136
out = '\n ' .join ([
130
137
branch ,
131
- remote .decode ('utf-8' ),
132
- str (len (staged )),
133
- str (len (conflicts )),
134
- str (len (changed )),
135
- str (len (untracked )),
136
- str (stashed ),
137
- str (clean )
138
+ remote ,
139
+ to_str (len (staged )),
140
+ to_str (len (conflicts )),
141
+ to_str (len (changed )),
142
+ to_str (len (untracked )),
143
+ to_str (stashed ),
144
+ to_str (clean ),
145
+ to_str (python_version ),
138
146
])
139
- Print (out )
147
+
148
+
149
+ if python_version == 2 :
150
+ Print (out .encode ('utf-8' ))
151
+ else :
152
+ Print (out )
153
+
You can’t perform that action at this time.
0 commit comments