]> khamidou — GitHub mirrors - arcanist.git/commitdiff
arc amend: fix failure when amending merge commit
authorAndrew Gallagher <agallagher@fb.com>
Tue, 7 Jun 2011 03:57:04 +0000 (20:57 -0700)
committerAndrew Gallagher <agallagher@fb.com>
Wed, 8 Jun 2011 23:24:16 +0000 (16:24 -0700)
Summary:
The amend process used "git log HEAD^..HEAD" to get log for the
commit being amended.  When run on a merge commit this can return
any number of commits from the non-first parents.  Since only a
single commit was expected, arc fails here.

This diff changes the amend process to use the '--first-parent' flag
to be consistent with using '^', which references the first parent.
This should guarantee a single commit log every time.

Test Plan:
arc amend on a merge commit

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley, andrewjcg
Differential Revision: 415

src/repository/api/git/ArcanistGitAPI.php

index 1df0244480ca52d5175b014ecbc04ab987d606ba..baedd1e68ad24238b97259e511c87f90874e38a3 100644 (file)
@@ -137,7 +137,7 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI {
         $this->getPath());
     } else {
       list($stdout) = execx(
-        '(cd %s; git log --format=medium %s..HEAD)',
+        '(cd %s; git log --first-parent --format=medium %s..HEAD)',
         $this->getPath(),
         $this->getRelativeCommit());
     }