{"thread":{"id":"19259","subject":"[PATCH] fix for incorrect index update","startedAt":"2009-05-09T21:49:59Z","lastAt":"2009-05-10T04:46:15Z","messageCount":3,"participants":["Dave O","Junio C Hamano","Dave Olszewski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"113426","messageId":"alpine.DEB.2.00.0905091356070.21000@narbuckle.genericorp.net","threadId":"19259","inReplyTo":null,"subject":"[PATCH] fix for incorrect index update","fromName":"Dave O","fromEmail":"cxreg@pobox.com","sentAt":"2009-05-09T21:49:59Z","receivedAt":"2009-05-09T21:49:59Z","isPatch":true,"sender":{"key":"cxreg@pobox.com","avatar":"https://avatars.githubusercontent.com/u/55474?v=4"},"body":"call_depth > 0 requires trees to be constructed from the files with\nconflicts, therefore the stages thusly must not be updated\n\nSigned-off-by: Dave Olszewski <cxreg@pobox.com>\n---\n  merge-recursive.c          |   11 +++--\n  t/t3031-merge-criscross.sh |   95 ++++++++++++++++++++++++++++++++++++++++++++\n  2 files changed, 101 insertions(+), 5 deletions(-)\n  create mode 100644 t/t3031-merge-criscross.sh\n\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex a3721ef..f5df9b9 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -933,11 +933,12 @@ static int process_renames(struct merge_options *o,\n  \t\t\t\t       ren1_src, ren1_dst, branch1,\n  \t\t\t\t       branch2);\n  \t\t\t\tupdate_file(o, 0, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);\n-\t\t\t\tupdate_stages(ren1_dst, NULL,\n-\t\t\t\t\t\tbranch1 == o->branch1 ?\n-\t\t\t\t\t\tren1->pair->two : NULL,\n-\t\t\t\t\t\tbranch1 == o->branch1 ?\n-\t\t\t\t\t\tNULL : ren1->pair->two, 1);\n+\t\t\t\tif (!o->call_depth)\n+\t\t\t\t\tupdate_stages(ren1_dst, NULL,\n+\t\t\t\t\t\t\tbranch1 == o->branch1 ?\n+\t\t\t\t\t\t\tren1->pair->two : NULL,\n+\t\t\t\t\t\t\tbranch1 == o->branch1 ?\n+\t\t\t\t\t\t\tNULL : ren1->pair->two, 1);\n  \t\t\t} else if (!sha_eq(dst_other.sha1, null_sha1)) {\n  \t\t\t\tconst char *new_path;\n  \t\t\t\tclean_merge = 0;\ndiff --git a/t/t3031-merge-criscross.sh b/t/t3031-merge-criscross.sh\nnew file mode 100644\nindex 0000000..cbfd95b\n--- /dev/null\n+++ b/t/t3031-merge-criscross.sh\n@@ -0,0 +1,95 @@\n+#!/bin/sh\n+\n+test_description='merge-recursive backend test'\n+\n+. ./test-lib.sh\n+\n+#         A      <- create some files\n+#        / \\\n+#       B   C    <- cause rename/delete conflicts between B and C\n+#      /     \\\n+#     |\\     /|\n+#     | D   E |\n+#     |  \\ /  |\n+#     |   X   |\n+#     |  / \\  |\n+#     | /   \\ |\n+#     |/     \\|\n+#     F       G  <- merge E into B, D into C\n+#      \\     /\n+#       \\   /\n+#        \\ /\n+#         H      <- recursive merge crashes\n+#\n+\n+# initialize\n+test_expect_success 'setup repo with criss-cross history' '\n+\tmkdir data &&\n+\n+\ttest_debug create a bunch of files &&\n+\tn=1 &&\n+\twhile test $n -le 10\n+\tdo\n+\t\techo $n > data/$n &&\n+\t\tn=$(($n+1)) ||\n+\t\tbreak\n+\tdone &&\n+\n+\ttest_debug check them in &&\n+\tgit add data &&\n+\tgit commit -m A &&\n+\tgit branch A &&\n+\n+\ttest_debug a file in one branch &&\n+\tgit checkout -b B A &&\n+\tgit rm data/9 &&\n+\tgit add data &&\n+\tgit commit -m B &&\n+\n+\ttest_debug with a branch off of it &&\n+\tgit branch D &&\n+\n+\ttest_debug put some commits on D &&\n+\tgit checkout D &&\n+\techo testD > data/testD &&\n+\tgit add data &&\n+\tgit commit -m D &&\n+\n+\ttest_debug back up to the top, create another branch and cause a rename  &&\n+\ttest_debug conflict with the file we deleted earlier &&\n+\tgit checkout -b C A &&\n+\tgit mv data/9 data/new-9 &&\n+\tgit add data &&\n+\tgit commit -m C &&\n+\n+\ttest_debug with a branch off of it &&\n+\tgit branch E &&\n+\n+\ttest_debug put a commit on E &&\n+\tgit checkout E &&\n+\techo testE > data/testE &&\n+\tgit add data &&\n+\tgit commit -m E &&\n+\n+\ttest_debug now, merge E into B &&\n+\tgit checkout B &&\n+\ttest_must_fail git merge E &&\n+\ttest_debug force-resolve &&\n+\tgit add data &&\n+\tgit commit -m F &&\n+\tgit branch F &&\n+\n+\ttest_debug and merge D into C &&\n+\tgit checkout C &&\n+\ttest_must_fail git merge D &&\n+\ttest_debug force-resolve &&\n+\tgit add data &&\n+\tgit commit -m G &&\n+\tgit branch G\n+'\n+\n+test_expect_failure 'recursive merge between F and G, causes segfault' '\n+\tgit merge F\n+'\n+\n+test_done\n-- \n1.6.2.4\n"},{"id":"113442","messageId":"7vskjd4mfh.fsf@alter.siamese.dyndns.org","threadId":"19259","inReplyTo":"alpine.DEB.2.00.0905091356070.21000@narbuckle.genericorp.net","subject":"Re: [PATCH] fix for incorrect index update","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-10T04:22:10Z","receivedAt":"2009-05-10T04:22:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dave O <cxreg@pobox.com> writes:\n\n> call_depth > 0 requires trees to be constructed from the files with\n> conflicts, therefore the stages thusly must not be updated\n>\n> Signed-off-by: Dave Olszewski <cxreg@pobox.com>\n> ---\n\nThanks.  I'd add:\n\n\tFrom: Dave Olszewski <cxreg@pobox.com>\n\nat the beginning, so you would not be shown as \"Dave O\" in \"git shortlog\"\nand friends.\n\n>  merge-recursive.c          |   11 +++--\n>  t/t3031-merge-criscross.sh |   95 ++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 101 insertions(+), 5 deletions(-)\n>  create mode 100644 t/t3031-merge-criscross.sh\n\n> diff --git a/t/t3031-merge-criscross.sh b/t/t3031-merge-criscross.sh\n> new file mode 100644\n\nThat should have been 100755 (I'll fix-up myself; no need to resend).\n\n> index 0000000..cbfd95b\n> --- /dev/null\n> +++ b/t/t3031-merge-criscross.sh\n> @@ -0,0 +1,95 @@\n> +#!/bin/sh\n> +\n> +test_description='merge-recursive backend test'\n> +\n> +. ./test-lib.sh\n> +\n> +#         A      <- create some files\n> +#        / \\\n> +#       B   C    <- cause rename/delete conflicts between B and C\n> +#      /     \\\n> +#     |\\     /|\n> +#     | D   E |\n> +#     |  \\ /  |\n> +#     |   X   |\n> +#     |  / \\  |\n> +#     | /   \\ |\n> +#     |/     \\|\n> +#     F       G  <- merge E into B, D into C\n> +#      \\     /\n> +#       \\   /\n> +#        \\ /\n> +#         H      <- recursive merge crashes\n> +#\n\nMuch nicer than Dscho's ;-)\n\n> +# initialize\n> +test_expect_success 'setup repo with criss-cross history' '\n> +\tmkdir data &&\n> +\n> +\ttest_debug create a bunch of files &&\n\nYou inherited a bug from Dscho's patch, it seems.  Have you tried running\nthe test with debug option?\n\nThis could have been\n\n\ttest_debug \"echo create a bunch of files\" &&\n\nbut I'd say we just make them into comments.\n"},{"id":"113444","messageId":"alpine.DEB.2.00.0905092139050.21000@narbuckle.genericorp.net","threadId":"19259","inReplyTo":"7vskjd4mfh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] fix for incorrect index update","fromName":"Dave Olszewski","fromEmail":"cxreg@pobox.com","sentAt":"2009-05-10T04:46:15Z","receivedAt":"2009-05-10T04:46:15Z","isPatch":true,"sender":{"key":"cxreg@pobox.com","avatar":"https://avatars.githubusercontent.com/u/55474?v=4"},"body":"On Sat, 9 May 2009, Junio C Hamano wrote:\n\n> Thanks.  I'd add:\n>\n> \tFrom: Dave Olszewski <cxreg@pobox.com>\n>\n> at the beginning, so you would not be shown as \"Dave O\" in \"git shortlog\"\n> and friends.\n\nOk, sounds good.  Thanks for the explanation of the issue.  Much of the\ngit internals are still mysterious but that's slowly changing :-)\n\n> Much nicer than Dscho's ;-)\n\nWell, it was mine first, can't fault him for that!\n\n> You inherited a bug from Dscho's patch, it seems.  Have you tried running\n> the test with debug option?\n>\n> This could have been\n>\n> \ttest_debug \"echo create a bunch of files\" &&\n>\n> but I'd say we just make them into comments.\n\nI didn't, sorry for that.  Making them comments seems ok to me.\n\nThanks once again.\n\n     Dave Olszewski\n"}]}