]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't amend commit with the same message in `arc diff`
authorvrana <jakubv@fb.com>
Thu, 20 Dec 2012 20:11:57 +0000 (12:11 -0800)
committervrana <jakubv@fb.com>
Thu, 20 Dec 2012 20:18:05 +0000 (12:18 -0800)
Summary: It makes reflog ugly

Test Plan:
# `arc diff`, made error, saw "Message saved to".
# `arc diff`, didn't edit, didn't see "Message saved to".
# `arc diff`, edited, saw "Message saved to".

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4243

src/workflow/ArcanistDiffWorkflow.php

index 8278311d728b60707356b01d94b56733eb1bb06d..bea10bd28428c5a809182c6e9c2238f2318a7392 100644 (file)
@@ -1605,6 +1605,7 @@ EOTEXT
           ));
       }
     }
+    $old_message = $template;
 
     $included = array();
     if ($included_commits) {
@@ -1673,9 +1674,11 @@ EOTEXT
                        $repository_api instanceof ArcanistGitAPI &&
                        $this->shouldAmend());
       if ($should_amend) {
-        $repository_api->amendCommit($template);
-        $wrote = true;
-        $where = 'commit message';
+        $wrote = (rtrim($old_message) != rtrim($template));
+        if ($wrote) {
+          $repository_api->amendCommit($template);
+          $where = 'commit message';
+        }
       } else {
         $wrote = $this->writeScratchFile('create-message', $template);
         $where = "'".$this->getReadableScratchFilePath('create-message')."'";