Permalink
Browse files

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
  • Loading branch information...
vrana
vrana committed Dec 20, 2012
1 parent 2d63d08 commit 3f05751724c938a08fc434f46f45221956ba8e01
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/workflow/ArcanistDiffWorkflow.php
@@ -1605,6 +1605,7 @@ private function getCommitMessageFromUser() {
));
}
}
+ $old_message = $template;
$included = array();
if ($included_commits) {
@@ -1673,9 +1674,11 @@ private function getCommitMessageFromUser() {
$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')."'";

0 comments on commit 3f05751

Please sign in to comment.