From: John Keeping <john@keeping.me.uk>
To: git@vger.kernel.org
Cc: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
"Junio C Hamano" <gitster@pobox.com>,
"John Keeping" <john@keeping.me.uk>
Subject: [PATCH v2] merge-tree: fix typo in "both changed identically"
Date: Sat, 27 Apr 2013 14:40:33 +0100 [thread overview]
Message-ID: <dbbdae2f2a471a61a578fcd74471d2b64391a31d.1367069938.git.john@keeping.me.uk> (raw)
In-Reply-To: <51cbc79a9b250544a8365980d078601dfcd2b782.1367067799.git.john@keeping.me.uk>
Commit aacecc3 (merge-tree: don't print entries that match "local" -
2013-04-07) had a typo causing the "same in both" check to be incorrect
and check if both the base and "their" versions are removed instead of
checking that both the "our" and "their" versions are removed. Fix
this.
Reported-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Test-written-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: John Keeping <john@keeping.me.uk>
---
Changes since v1:
- Add test from René
- s/empty/removed/g in the commit message
builtin/merge-tree.c | 2 +-
t/t4300-merge-tree.sh | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index ed25d81..ec49917 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -302,7 +302,7 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)
{
/* Same in both? */
- if (same_entry(entry+1, entry+2) || both_empty(entry+0, entry+2)) {
+ if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {
/* Modified, added or removed identically */
resolve(info, NULL, entry+1);
return mask;
diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh
index bd43b3d..2defb42 100755
--- a/t/t4300-merge-tree.sh
+++ b/t/t4300-merge-tree.sh
@@ -205,6 +205,19 @@ EXPECTED
test_cmp expected actual
'
+test_expect_success 'file remove A, B (same)' '
+ cat >expected <<\EXPECTED &&
+EXPECTED
+
+ git reset --hard initial &&
+ test_commit "rm-a-b-base" "ONE" "AAA" &&
+ git rm ONE &&
+ git commit -m "rm-a-b" &&
+ git tag "rm-a-b" &&
+ git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'file change A, remove B' '
cat >expected <<\EXPECTED &&
removed in remote
--
1.8.3.rc0.149.g98a72f2.dirty
next prev parent reply other threads:[~2013-04-27 13:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 13:03 [PATCH] merge-tree: fix typo in "both changed identically" John Keeping
2013-04-27 13:23 ` René Scharfe
2013-04-27 13:38 ` John Keeping
2013-04-27 13:40 ` John Keeping [this message]
2013-04-28 18:54 ` [PATCH v2] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbbdae2f2a471a61a578fcd74471d2b64391a31d.1367069938.git.john@keeping.me.uk \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rene.scharfe@lsrfire.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).