Skip to content

Fix for untracked_files no longer detected #138 #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions git/db/cmd/base.py
Original file line number Diff line number Diff line change
@@ -662,26 +662,25 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False):
return True
# END untracked files
return False

@property
def untracked_files(self):
# make sure we get all files, no only untracked directores
proc = self.git.status(untracked_files=True, as_process=True)
stream = iter(proc.stdout)
proc = self.git.status(porcelain=True,
untracked_files=True,
as_process=True)
# Untracked files preffix in porcelain mode
prefix = "?? "

untracked_files = list()
for line in stream:
if not line.startswith("# Untracked files:"):
for line in proc.stdout:
if not line.startswith(prefix):
continue
# skip two lines
stream.next()
stream.next()

for untracked_info in stream:
if not untracked_info.startswith("#\t"):
break
untracked_files.append(untracked_info.replace("#\t", "").rstrip())
# END for each utracked info line
# END for each line
filename = line[len(prefix):].rstrip('\n')
# Special characters are escaped
if filename[0] == filename[-1] == '"':
filename = filename[1:-1].decode('string_escape')
untracked_files.append(filename)
return untracked_files

def blame(self, rev, file):