From 1139eb1a733ae7e5631da83ff6d63483d8271d78 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 5 Apr 2011 19:27:05 -0700 Subject: [PATCH] Correctly detect uncommitted files in Git Summary: I simplified this code at some point and broke it horribly in the process. Mask in the right flag here and combine the maps correctly. This solves the great mystery of increased developer clowniness. Test Plan: Ran 'arc diff' in a working copy with staged but uncommitted files, got an error message (previously, I didn't). Reviewed By: aran Reviewers: mroch, aran CC: aran Differential Revision: 104 --- src/repository/api/git/ArcanistGitAPI.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/repository/api/git/ArcanistGitAPI.php b/src/repository/api/git/ArcanistGitAPI.php index cc961d35..7ac4af56 100644 --- a/src/repository/api/git/ArcanistGitAPI.php +++ b/src/repository/api/git/ArcanistGitAPI.php @@ -168,7 +168,14 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI { list($stdout) = execx( '(cd %s; git diff --no-ext-diff --raw HEAD --)', $this->getPath()); - $files += $this->parseGitStatus($stdout); + $uncommitted_files = $this->parseGitStatus($stdout); + foreach ($uncommitted_files as $path => $mask) { + $mask |= self::FLAG_UNCOMMITTED; + if (!isset($files[$path])) { + $files[$path] = 0; + } + $files[$path] |= $mask; + } // Find untracked files. list($stdout) = execx( -- 2.43.0