Skip to content

Commit

Permalink
Merge branch 'am/cherry-pick-rerere'
Browse files Browse the repository at this point in the history
* am/cherry-pick-rerere:
  Make cherry-pick use rerere for conflict resolution.
  • Loading branch information
Junio C Hamano committed Aug 27, 2008
2 parents b46f7e5 + aa1a011 commit 88ab18d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "cache-tree.h"
#include "diff.h"
#include "revision.h"
#include "rerere.h"

/*
* This implements the builtins revert and cherry-pick.
Expand Down Expand Up @@ -395,6 +396,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
die ("Error wrapping up %s", defmsg);
fprintf(stderr, "Automatic %s failed.%s\n",
me, help_msg(commit->object.sha1));
rerere();
exit(1);
}
if (commit_lock_file(&msg_file) < 0)
Expand Down
45 changes: 45 additions & 0 deletions t/t3504-cherry-pick-rerere.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

test_description='cherry-pick should rerere for conflicts'

. ./test-lib.sh

test_expect_success setup '
echo foo >foo &&
git add foo && test_tick && git commit -q -m 1 &&
echo foo-master >foo &&
git add foo && test_tick && git commit -q -m 2 &&
git checkout -b dev HEAD^ &&
echo foo-dev >foo &&
git add foo && test_tick && git commit -q -m 3 &&
git config rerere.enabled true
'

test_expect_success 'conflicting merge' '
test_must_fail git merge master
'

test_expect_success 'fixup' '
echo foo-dev >foo &&
git add foo && test_tick && git commit -q -m 4 &&
git reset --hard HEAD^
echo foo-dev >expect
'

test_expect_success 'cherry-pick conflict' '
test_must_fail git cherry-pick master &&
test_cmp expect foo
'

test_expect_success 'reconfigure' '
git config rerere.enabled false
git reset --hard
'

test_expect_success 'cherry-pick conflict without rerere' '
test_must_fail git cherry-pick master &&
test_must_fail test_cmp expect foo
'

test_done

0 comments on commit 88ab18d

Please sign in to comment.