]> khamidou — GitHub mirrors - arcanist.git/commitdiff
modify arc diff workflow to only do amend optimization if git repository
authorBob Trahan <bob.trahan@gmail.com>
Thu, 1 Nov 2012 23:47:08 +0000 (16:47 -0700)
committerBob Trahan <bob.trahan@gmail.com>
Thu, 1 Nov 2012 23:47:08 +0000 (16:47 -0700)
Summary: fix for T2011, first option in list of possible fixes

Test Plan: ...do I really have to setup mercurial with mq? :D

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2011

Differential Revision: https://secure.phabricator.com/D3869

src/workflow/ArcanistDiffWorkflow.php

index bfa161ac6c92fe6b7020b26c467d1611cd36df98..eef46422304d0833f2492d6edc86afe1643630b4 100644 (file)
@@ -1616,8 +1616,13 @@ EOTEXT
       $template = ArcanistCommentRemover::removeComments($new_template);
 
       $repository_api = $this->getRepositoryAPI();
-      $should_amend = (count($included_commits) == 1 && $this->shouldAmend());
-      if ($should_amend && $repository_api->supportsAmend()) {
+      // special check for whether to amend here. optimizes a common git
+      // workflow. we can't do this for mercurial because the mq extension
+      // is popular and incompatible with hg commit --amend ; see T2011.
+      $should_amend = (count($included_commits) == 1 &&
+                       $repository_api instanceof ArcanistGitAPI &&
+                       $this->shouldAmend());
+      if ($should_amend) {
         $repository_api->amendCommit($template);
         $wrote = true;
         $where = 'commit message';