From: epriestley Date: Wed, 6 Apr 2011 02:27:05 +0000 (-0700) Subject: Correctly detect uncommitted files in Git X-Git-Tag: conduit-4~360 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=1139eb1a733ae7e5631da83ff6d63483d8271d78;p=arcanist.git 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 --- 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(