diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index bb60f71e..c7149bd1 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -660,14 +660,18 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { $parts = explode("\0", $stdout); while (count($parts) > 1) { $entry = array_shift($parts); - $entry_parts = explode(' ', $entry); + $entry_parts = explode(' ', $entry, 2); if ($entry_parts[0] == '1') { + $entry_parts = explode(' ', $entry, 9); $path = $entry_parts[8]; } else if ($entry_parts[0] == '2') { + $entry_parts = explode(' ', $entry, 10); $path = $entry_parts[9]; } else if ($entry_parts[0] == 'u') { + $entry_parts = explode(' ', $entry, 11); $path = $entry_parts[10]; } else if ($entry_parts[0] == '?') { + $entry_parts = explode(' ', $entry, 2); $result[$entry_parts[1]] = self::FLAG_UNTRACKED; continue; } diff --git a/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php b/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php index b6b4c596..ddf703e8 100644 --- a/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php +++ b/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php @@ -7,6 +7,7 @@ final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase { $this->parseState('git_basic.git.tgz'); $this->parseState('git_submodules_dirty.git.tgz'); $this->parseState('git_submodules_staged.git.tgz'); + $this->parseState('git_spaces.git.tgz'); } else { $this->assertSkipped(pht('Git is not installed')); } @@ -156,6 +157,17 @@ final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase { ); $this->assertEqual($expect_uncommitted, $api->getUncommittedStatus()); break; + case 'git_spaces.git.tgz': + $expect_working = array( + 'SPACES ADDED' => $f_add, + 'SPACES DELETED' => $f_del, + 'SPACES MODIFIED' => $f_mod, + 'SPACES UNCOMMITTED' => $f_add | $f_unc, + 'SPACES UNSTAGED' => $f_add | $f_mod | $f_uns | $f_unc, + 'SPACES UNTRACKED' => $f_unt, + ); + $this->assertEqual($expect_working, $api->getWorkingCopyStatus()); + break; case 'hg_basic.hg.tgz': $expect_uncommitted = array( 'UNCOMMITTED' => $f_mod | $f_unc, diff --git a/src/repository/api/__tests__/state/git_spaces.git.tgz b/src/repository/api/__tests__/state/git_spaces.git.tgz new file mode 100644 index 00000000..056fe0d5 Binary files /dev/null and b/src/repository/api/__tests__/state/git_spaces.git.tgz differ