summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac39efb)
raw | patch | inline | side by side (parent: ac39efb)
author | Abhijit Menon-Sen <ams@toroid.org> | |
Sun, 10 Aug 2008 11:48:55 +0000 (17:18 +0530) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 11 Aug 2008 23:42:49 +0000 (16:42 -0700) |
Cherry-picking can be helped by reusing previous confliction
resolution by invoking rerere automatically.
Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
resolution by invoking rerere automatically.
Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-revert.c | patch | blob | history | |
t/t3504-cherry-pick-rerere.sh | [new file with mode: 0755] | patch | blob |
diff --git a/builtin-revert.c b/builtin-revert.c
index 27881e94937dd79b9a0524eb2d9770427ec4f4fb..36677053f87b107f658f1472369755c4fe957a46 100644 (file)
--- a/builtin-revert.c
+++ b/builtin-revert.c
#include "cache-tree.h"
#include "diff.h"
#include "revision.h"
+#include "rerere.h"
/*
* This implements the builtins revert and cherry-pick.
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
--- /dev/null
@@ -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