From: epriestley Date: Fri, 8 Aug 2014 18:21:43 +0000 (-0700) Subject: Don't interpret `arc browse .` as a commit X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=377eb5d1e0a23ec96b567101d63aa36bd8e615a8;p=arcanist.git Don't interpret `arc browse .` as a commit Summary: Ref T5781. `git show .` works like HEAD, but that isn't what `arc browse .` means. Test Plan: Ran `arc browse .` with a repository at a published commit. Reviewers: chad, btrahan, avive, avivey Reviewed By: avivey Subscribers: epriestley, avivey Maniphest Tasks: T5781 Differential Revision: https://secure.phabricator.com/D10197 --- diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 91dc101f..dca9fbfd 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -535,7 +535,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { $stdout = $this->getHashFromFromSVNRevisionNumber($match[1]); } else { list($stdout) = $this->execxLocal( - 'show -s --format=%C %s', + 'show -s --format=%s %s --', '%H', $string); } diff --git a/src/workflow/ArcanistBrowseWorkflow.php b/src/workflow/ArcanistBrowseWorkflow.php index 3de2cb52..d80430f3 100644 --- a/src/workflow/ArcanistBrowseWorkflow.php +++ b/src/workflow/ArcanistBrowseWorkflow.php @@ -104,9 +104,19 @@ EOTEXT $commits = array(); foreach ($things as $key => $thing) { - $commit = $repository_api->getCanonicalRevisionName($thing); - if ($commit) { - $commits[$commit] = $key; + if ($thing == '.') { + // Git resolves '.' like HEAD, but it should be interpreted to mean + // "the current directory". Just skip resolution and fall through. + continue; + } + + try { + $commit = $repository_api->getCanonicalRevisionName($thing); + if ($commit) { + $commits[$commit] = $key; + } + } catch (Exception $ex) { + // Ignore. } }