{"thread":{"id":"33630","subject":"[PATCH] merge-tree: fix typo in \"both changed identically\"","startedAt":"2013-04-27T13:03:43Z","lastAt":"2013-04-28T18:54:11Z","messageCount":5,"participants":["John Keeping","René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"215699","messageId":"51cbc79a9b250544a8365980d078601dfcd2b782.1367067799.git.john@keeping.me.uk","threadId":"33630","inReplyTo":null,"subject":"[PATCH] merge-tree: fix typo in \"both changed identically\"","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-27T13:03:43Z","receivedAt":"2013-04-27T13:03:43Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"Commit aacecc3 (merge-tree: don't print entries that match \"local\" -\n2013-04-07) had a typo causing the \"same in both\" check to be incorrect\nand check if both the base and \"their\" versions are empty instead of\nchecking that both the \"our\" and \"their\" versions are empty.  Fix this.\n\nReported-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\n builtin/merge-tree.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex ed25d81..ec49917 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -302,7 +302,7 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])\n static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)\n {\n \t/* Same in both? */\n-\tif (same_entry(entry+1, entry+2) || both_empty(entry+0, entry+2)) {\n+\tif (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {\n \t\t/* Modified, added or removed identically */\n \t\tresolve(info, NULL, entry+1);\n \t\treturn mask;\n-- \n1.8.2.1.715.gb260f47\n"},{"id":"215702","messageId":"517BD146.1040401@lsrfire.ath.cx","threadId":"33630","inReplyTo":"51cbc79a9b250544a8365980d078601dfcd2b782.1367067799.git.john@keeping.me.uk","subject":"Re: [PATCH] merge-tree: fix typo in \"both changed identically\"","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2013-04-27T13:23:18Z","receivedAt":"2013-04-27T13:23:18Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"How about squashing in this test?\n\nRené\n\n---\n t/t4300-merge-tree.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh\nindex bd43b3d..2defb42 100755\n--- a/t/t4300-merge-tree.sh\n+++ b/t/t4300-merge-tree.sh\n@@ -205,6 +205,19 @@ EXPECTED\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'file remove A, B (same)' '\n+\tcat >expected <<\\EXPECTED &&\n+EXPECTED\n+\n+\tgit reset --hard initial &&\n+\ttest_commit \"rm-a-b-base\" \"ONE\" \"AAA\" &&\n+\tgit rm ONE &&\n+\tgit commit -m \"rm-a-b\" &&\n+\tgit tag \"rm-a-b\" &&\n+\tgit merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'file change A, remove B' '\n \tcat >expected <<\\EXPECTED &&\n removed in remote\n-- \n1.8.2.1\n"},{"id":"215704","messageId":"20130427133812.GE472@serenity.lan","threadId":"33630","inReplyTo":"517BD146.1040401@lsrfire.ath.cx","subject":"Re: [PATCH] merge-tree: fix typo in \"both changed identically\"","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-27T13:38:12Z","receivedAt":"2013-04-27T13:38:12Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Sat, Apr 27, 2013 at 03:23:18PM +0200, René Scharfe wrote:\n> How about squashing in this test?\n> \n> René\n> \n> ---\n>  t/t4300-merge-tree.sh | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> \n> diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh\n> index bd43b3d..2defb42 100755\n> --- a/t/t4300-merge-tree.sh\n> +++ b/t/t4300-merge-tree.sh\n> @@ -205,6 +205,19 @@ EXPECTED\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success 'file remove A, B (same)' '\n> +\tcat >expected <<\\EXPECTED &&\n> +EXPECTED\n> +\n> +\tgit reset --hard initial &&\n> +\ttest_commit \"rm-a-b-base\" \"ONE\" \"AAA\" &&\n> +\tgit rm ONE &&\n> +\tgit commit -m \"rm-a-b\" &&\n> +\tgit tag \"rm-a-b\" &&\n> +\tgit merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&\n\nI'm not sure about using the same \"our\" and \"their\" refs here.  The\nexisting tests go out of their way to create separate commits - although\nsince they contain identical trees I don't think that actually buys us\nanything.\n\nSince this test does fail without my patch, it clearly does trigger the\naffected code, so I think it's fine as is.\n\n> +\ttest_cmp expected actual\n> +'\n> +\n>  test_expect_success 'file change A, remove B' '\n>  \tcat >expected <<\\EXPECTED &&\n>  removed in remote\n> -- \n> 1.8.2.1\n"},{"id":"215705","messageId":"dbbdae2f2a471a61a578fcd74471d2b64391a31d.1367069938.git.john@keeping.me.uk","threadId":"33630","inReplyTo":"51cbc79a9b250544a8365980d078601dfcd2b782.1367067799.git.john@keeping.me.uk","subject":"[PATCH v2] merge-tree: fix typo in \"both changed identically\"","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-27T13:40:33Z","receivedAt":"2013-04-27T13:40:33Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"Commit aacecc3 (merge-tree: don't print entries that match \"local\" -\n2013-04-07) had a typo causing the \"same in both\" check to be incorrect\nand check if both the base and \"their\" versions are removed instead of\nchecking that both the \"our\" and \"their\" versions are removed.  Fix\nthis.\n\nReported-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>\nTest-written-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\nChanges since v1:\n- Add test from René\n- s/empty/removed/g in the commit message\n\n builtin/merge-tree.c  |  2 +-\n t/t4300-merge-tree.sh | 13 +++++++++++++\n 2 files changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex ed25d81..ec49917 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -302,7 +302,7 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])\n static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)\n {\n \t/* Same in both? */\n-\tif (same_entry(entry+1, entry+2) || both_empty(entry+0, entry+2)) {\n+\tif (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {\n \t\t/* Modified, added or removed identically */\n \t\tresolve(info, NULL, entry+1);\n \t\treturn mask;\ndiff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh\nindex bd43b3d..2defb42 100755\n--- a/t/t4300-merge-tree.sh\n+++ b/t/t4300-merge-tree.sh\n@@ -205,6 +205,19 @@ EXPECTED\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'file remove A, B (same)' '\n+\tcat >expected <<\\EXPECTED &&\n+EXPECTED\n+\n+\tgit reset --hard initial &&\n+\ttest_commit \"rm-a-b-base\" \"ONE\" \"AAA\" &&\n+\tgit rm ONE &&\n+\tgit commit -m \"rm-a-b\" &&\n+\tgit tag \"rm-a-b\" &&\n+\tgit merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'file change A, remove B' '\n \tcat >expected <<\\EXPECTED &&\n removed in remote\n-- \n1.8.3.rc0.149.g98a72f2.dirty\n"},{"id":"215798","messageId":"7vmwsiqyek.fsf@alter.siamese.dyndns.org","threadId":"33630","inReplyTo":"dbbdae2f2a471a61a578fcd74471d2b64391a31d.1367069938.git.john@keeping.me.uk","subject":"Re: [PATCH v2] merge-tree: fix typo in \"both changed identically\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-28T18:54:11Z","receivedAt":"2013-04-28T18:54:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both.\n"}]}