From: "Michał Kiedrowicz" <michal.kiedrowicz@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Sverre Rabbelier <srabbelier@gmail.com>,
Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Anders Melchiorsen <mail@cup.kalibalik.dk>,
Tuncer Ayaz <tuncer.ayaz@gmail.com>,
git@vger.kernel.org
Subject: Re: correct git merge behavior or corner case?
Date: Tue, 21 Apr 2009 19:54:34 +0200 [thread overview]
Message-ID: <20090421195434.3a01676d@gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0904211100350.10279@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 21 Apr 2009, Johannes Schindelin wrote:
>
> > I actually agree with Junio, though, that we want this special
> > handling of empty files only in merge-recursive.
>
> And this _might_ be enough (not even compile-tested due to lack of
> time; the OP did not provide the test as a proper patch):
>
> ---
>
> merge-recursive.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/merge-recursive.c b/merge-recursive.c
> index 774bacd..b7ea3cd 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -343,7 +343,7 @@ static struct string_list *get_renames(struct
> merge_options *o, struct string_list_item *item;
> struct rename *re;
> struct diff_filepair *pair =
> diff_queued_diff.queue[i];
> - if (pair->status != 'R') {
> + if (pair->status != 'R' || !re->pair->one->size) {
> diff_free_filepair(pair);
> continue;
> }
> --
And here is a test case:
---
t/t6035-merge-suspected-rename.sh | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/t/t6035-merge-suspected-rename.sh b/t/t6035-merge-suspected-rename.sh
new file mode 100755
index 0000000..81615fd
--- /dev/null
+++ b/t/t6035-merge-suspected-rename.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test_description='Merge-recursive merging suspected rename'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "hello" > date &&
+ git add date &&
+ git commit -m initial &&
+
+ git branch parallel &&
+
+ echo "hello" > LICENSE &&
+ cp LICENSE LICENSE-copy &&
+ git add LICENSE &&
+ git commit -m LICENSE &&
+
+ git rm date &&
+ git commit -m removed &&
+
+ git checkout parallel &&
+ date > date &&
+ git add date &&
+ git commit -m date
+'
+
+test_expect_success 'merge' '
+ git checkout master &&
+ test_must_fail git merge parallel &&
+ test_cmp LICENSE LICENSE-copy
+'
+
+test_done
next prev parent reply other threads:[~2009-04-21 17:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-19 22:40 correct git merge behavior or corner case? Tuncer Ayaz
2009-04-20 3:19 ` Shawn O. Pearce
2009-04-20 9:49 ` Johannes Schindelin
2009-04-20 10:10 ` Anders Melchiorsen
2009-04-21 2:44 ` Jeff King
2009-04-21 2:51 ` Jeff King
2009-04-21 3:09 ` Junio C Hamano
2009-04-21 8:48 ` Sverre Rabbelier
2009-04-21 8:56 ` Johannes Schindelin
2009-04-21 9:00 ` Sverre Rabbelier
2009-04-21 9:04 ` Johannes Schindelin
2009-04-21 9:01 ` Johannes Schindelin
2009-04-21 17:27 ` Michał Kiedrowicz
2009-04-21 17:54 ` Michał Kiedrowicz [this message]
2009-04-21 18:05 ` Jeff King
2009-04-21 18:47 ` Michał Kiedrowicz
2009-04-21 19:11 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2009-04-20 14:50 François Beausoleil
2009-04-21 19:27 ` Jeff King
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=20090421195434.3a01676d@gmail.com \
--to=michal.kiedrowicz@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mail@cup.kalibalik.dk \
--cc=peff@peff.net \
--cc=srabbelier@gmail.com \
--cc=tuncer.ayaz@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.