From 3f05751724c938a08fc434f46f45221956ba8e01 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 20 Dec 2012 12:11:57 -0800 Subject: [PATCH] Don't amend commit with the same message in `arc diff` 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 8278311d..bea10bd2 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -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')."'";