]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't interpret `arc browse .` as a commit
authorepriestley <git@epriestley.com>
Fri, 8 Aug 2014 18:21:43 +0000 (11:21 -0700)
committerepriestley <git@epriestley.com>
Fri, 8 Aug 2014 18:21:43 +0000 (11:21 -0700)
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

src/repository/api/ArcanistGitAPI.php
src/workflow/ArcanistBrowseWorkflow.php

index 91dc101fdea281c5ad1160a0b10e2cc4593db8b8..dca9fbfd3834572f56748368db68b695ef02ce7a 100644 (file)
@@ -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);
     }
index 3de2cb52295ef9e7f4cc5334005173fca164e0c5..d80430f36c79fad76a69d46dec4620abe824c7d4 100644 (file)
@@ -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.
         }
       }