diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-28 03:40:09 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-28 03:40:09 +0400 |
commit | 88ab18dfef55a41df2e1f69a8ab3e3ed9f915c31 (patch) | |
tree | b4550d79e5f34a8817ea787b299cabf8174c81c6 | |
parent | b46f7e54fcb2d01757d834d14dfd040b6892d695 (diff) | |
parent | aa1a0111cc0e2a12c21ed05c88d8e9872fc166b2 (diff) |
Merge branch 'am/cherry-pick-rerere'
* am/cherry-pick-rerere:
Make cherry-pick use rerere for conflict resolution.
-rw-r--r-- | builtin-revert.c | 2 | ||||
-rwxr-xr-x | t/t3504-cherry-pick-rerere.sh | 45 |
2 files changed, 47 insertions, 0 deletions
diff --git a/builtin-revert.c b/builtin-revert.c index 27881e9493..36677053f8 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -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. @@ -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) diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh new file mode 100755 index 0000000000..f7b3518a32 --- /dev/null +++ b/t/t3504-cherry-pick-rerere.sh @@ -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 |