Skip to content

Commit ad715a0

Browse files
committed
Merge pull request gitpython-developers#159 from maxyz/master
Fix for untracked_files no longer detected gitpython-developers#138
2 parents 2976561 + 5d4a9c2 commit ad715a0

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

git/db/cmd/base.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -662,26 +662,25 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False):
662662
return True
663663
# END untracked files
664664
return False
665-
665+
666666
@property
667667
def untracked_files(self):
668668
# make sure we get all files, no only untracked directores
669-
proc = self.git.status(untracked_files=True, as_process=True)
670-
stream = iter(proc.stdout)
669+
proc = self.git.status(porcelain=True,
670+
untracked_files=True,
671+
as_process=True)
672+
# Untracked files preffix in porcelain mode
673+
prefix = "?? "
674+
671675
untracked_files = list()
672-
for line in stream:
673-
if not line.startswith("# Untracked files:"):
676+
for line in proc.stdout:
677+
if not line.startswith(prefix):
674678
continue
675-
# skip two lines
676-
stream.next()
677-
stream.next()
678-
679-
for untracked_info in stream:
680-
if not untracked_info.startswith("#\t"):
681-
break
682-
untracked_files.append(untracked_info.replace("#\t", "").rstrip())
683-
# END for each utracked info line
684-
# END for each line
679+
filename = line[len(prefix):].rstrip('\n')
680+
# Special characters are escaped
681+
if filename[0] == filename[-1] == '"':
682+
filename = filename[1:-1].decode('string_escape')
683+
untracked_files.append(filename)
685684
return untracked_files
686685

687686
def blame(self, rev, file):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy