@@ -66,6 +66,11 @@ def repo_information(pwd):
6666
6767 for i in range (2 , len (pwd_list )+ 1 ):
6868 current_dir = pwd_list [:i ]
69+
70+ # Bail out if pwd is IN the VCS data dir
71+ if current_dir [- 1 ] in vcs_subdirs :
72+ return [], [], ""
73+
6974 vcs_subdir = get_vcs_subdir (current_dir )
7075 if vcs_subdir :
7176 last_repo = current_dir
@@ -127,7 +132,11 @@ def git_branch_info(repo_path, vcs_subdir):
127132 if dirty :
128133 local += "*"
129134
130- return local , remote , divergence
135+ stash_output = subprocess .check_output (["git" , "stash" , "list" ])
136+ stash_lines = stash_output .decode (encoding = "utf-8" ).splitlines ()
137+ stashes = len (stash_lines )
138+
139+ return local , remote , divergence , stashes
131140
132141
133142def virtual_env (pwd ):
@@ -171,6 +180,8 @@ def format_name(fmt, name, color):
171180 else :
172181 return ""
173182
183+ def format_stashes (stashes ):
184+ return "" .join ("." * stashes )
174185
175186###############################################################################
176187# Main #
@@ -187,7 +198,10 @@ def main():
187198 hostname = gethostname ()
188199 username = os .getenv ('USER' )
189200 repo , repo_path , vcs_subdir = repo_information (pwd )
190- branch , remote , div = branch_info (repo_path , vcs_subdir ) if repo else ("" , "" , "" )
201+ if repo :
202+ branch , remote , div , stashes = branch_info (repo_path , vcs_subdir )
203+ else :
204+ branch , remote , div , stashes = "" , "" , "" , ""
191205 virtualenv = virtual_env (pwd )
192206
193207 # Format pieces for display
@@ -196,6 +210,7 @@ def main():
196210 repo = format_name ("[{}]" , repo , FCYN )
197211 branch = format_name ("({})" , branch , FMAG )
198212 remote = format_name ("↑{{{}}}" , remote , FBLE )
213+ stash = format_stashes (stashes )
199214
200215 # Combine into display
201216 prompt = '' .join ([
@@ -209,6 +224,7 @@ def main():
209224 branch ,
210225 div ,
211226 virtualenv ,
227+ stash ,
212228 os .linesep ,
213229 FYEL ,
214230 CURSOR ,
0 commit comments