summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6209036)
raw | patch | inline | side by side (parent: 6209036)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Mon, 16 Aug 2010 01:11:06 +0000 (20:11 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 16 Aug 2010 03:09:48 +0000 (20:09 -0700) |
As v1.6.1-rc1~294^2 (2008-08-23) explains, custom merge strategies
do not even kick in when the merge is truly trivial. But they
should, since otherwise a custom “--strategy=theirs” is not useful.
Perhaps custom strategies should not allow fast-forward either. This
patch does not make that change, since it is less important (because
it is always possible to explicitly use --no-ff).
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
do not even kick in when the merge is truly trivial. But they
should, since otherwise a custom “--strategy=theirs” is not useful.
Perhaps custom strategies should not allow fast-forward either. This
patch does not make that change, since it is less important (because
it is always possible to explicitly use --no-ff).
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c | patch | blob | history | |
t/t7606-merge-custom.sh | patch | blob | history |
diff --git a/builtin/merge.c b/builtin/merge.c
index 37ce4f589f6582abf0d1ef5bd263f590a16853d5..e48e90bb696e0aed31707f43199bfc8d8d070894 100644 (file)
--- a/builtin/merge.c
+++ b/builtin/merge.c
ret = xcalloc(1, sizeof(struct strategy));
ret->name = xstrdup(name);
+ ret->attr = NO_TRIVIAL;
return ret;
}
index 82045cd543e7e62cd1dc0fa3c38d7d5212f32090..13c219367d86b1e2a52dd1129390c874b2fa61d1 100755 (executable)
--- a/t/t7606-merge-custom.sh
+++ b/t/t7606-merge-custom.sh
Testing a custom strategy.
-* (HEAD, master) Merge commit 'c2'
+* (HEAD, master) Merge commit 'c3'
|\
-| * (tag: c2) c2
+| * (tag: c3) c3
* | (tag: c1) c1
|/
+| * tag: c2) c2
+|/
* (tag: c0) c0
"
git reset --keep c0 &&
echo c1c1 >c1.c &&
git add c1.c &&
- test_commit c2 c2.c
+ test_commit c2 c2.c &&
+ git reset --keep c0 &&
+ test_commit c3 c3.c
'
test_expect_success 'merge c2 with a custom strategy' '
test -f c2.c
'
+test_expect_success 'trivial merge with custom strategy' '
+ git reset --hard c1 &&
+
+ git rev-parse c1 >head.old &&
+ git rev-parse c3 >second-parent.expected &&
+ git rev-parse c3^{tree} >tree.expected &&
+ git merge -s theirs c3 &&
+
+ git rev-parse HEAD >head &&
+ git rev-parse HEAD^1 >first-parent &&
+ git rev-parse HEAD^2 >second-parent &&
+ git rev-parse HEAD^{tree} >tree &&
+ git update-index --refresh &&
+ git diff --exit-code &&
+ git diff --exit-code c3 HEAD &&
+ git diff --exit-code c3 &&
+
+ ! test_cmp head.old head &&
+ test_cmp head.old first-parent &&
+ test_cmp second-parent.expected second-parent &&
+ test_cmp tree.expected tree &&
+ test -f c0.c &&
+ ! test -e c1.c &&
+ test -f c3.c
+'
+
test_done