]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't check working copy status for "arc commit --show"
authorepriestley <git@epriestley.com>
Tue, 1 May 2012 17:35:14 +0000 (10:35 -0700)
committerepriestley <git@epriestley.com>
Tue, 1 May 2012 17:35:14 +0000 (10:35 -0700)
Summary:
We do unnecessary working copy checks under "--show", even though the working copy isn't relevant.

Also, 'sourcePath' may not be set (e.g., "arc commit --show --revision X" where X is some "--only" revision).

Test Plan: Ran "arc commit --show --revision 1" against some test data, got clean output.

Reviewers: vrana, btrahan, jungejason

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D2353

src/workflow/commit/ArcanistCommitWorkflow.php

index d6eeec8398aedef9ea9f5bcb764e7ba2b9f219dc..cfdc45c560b75bd67f94930f4430aba43e71a4af 100644 (file)
@@ -122,7 +122,11 @@ EOTEXT
     $this->revisionID = $revision['id'];
     $revision_id = $revision['id'];
 
-    $this->runSanityChecks($revision);
+    $is_show = $this->getArgument('show');
+
+    if (!$is_show) {
+      $this->runSanityChecks($revision);
+    }
 
     $message = $this->getConduit()->callMethodSynchronous(
       'differential.getcommitmessage',
@@ -142,8 +146,8 @@ EOTEXT
 
     $message = $event->getValue('message');
 
-    if ($this->getArgument('show')) {
-      echo $message;
+    if ($is_show) {
+      echo $message."\n";
       return 0;
     }
 
@@ -328,7 +332,7 @@ EOTEXT
         "Commit this revision anyway?";
     }
 
-    $revision_source = $revision['sourcePath'];
+    $revision_source = idx($revision, 'sourcePath');
     $current_source = $repository_api->getPath();
     if ($revision_source != $current_source) {
       $confirm[] =