git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: ben.humphreys@atlassian.com, Elijah Newren <newren@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [ANNOUNCE] Git v2.22.0-rc3
Date: Tue, 4 Jun 2019 04:30:39 +0200	[thread overview]
Message-ID: <20190604023039.GR951@szeder.dev> (raw)
In-Reply-To: <CAFkS+y+dS51+nHTDy+A0HrXZpfsEE1UYPN-Xk0257o36ScUOHg@mail.gmail.com>

On Tue, Jun 04, 2019 at 11:32:24AM +1000, Ben Humphreys wrote:
> Hi folks,
> 
> I’m one of the Bitbucket Server developers and I just wanted to let
> you know of one of our test cases that is now failing on the 2.22.0
> release candidates (tested rc2 and rc3). I’m still looking into it,
> but figure the release is probably imminent so worth reporting sooner
> than later.
> 
> The problem seems to be related to some recent changes in
> merge-recursive.c. I’ve made available our test dataset and the
> following steps will reproduce the problem:
> 
> $ git --version
> git version 2.22.0.rc3
> 
> $ git clone https://bitbucket.org/ben_humphreys/merge-dataset.git
> $ cd merge-dataset
> $ git checkout branch_that_has_rename_add_triggering_content_conflict_trgt
> $ git merge origin/branch_that_has_rename_add_triggering_content_conflict_src
> Assertion failed: (a->path && b->path), function merge_3way, file
> merge-recursive.c, line 1044.
> Abort trap: 6
> 
> The assertion is failing because b->path is null:
> 
> (lldb) print a->path
> (char *const) $2 = 0x00007f8e177025f8 "count.txt"
> (lldb) print b->path
> (char *const) $3 = 0x0000000000000000 <no value available>

merge_3way() is called from merge_mode_and_contents(), which in turn
is called from handle_rename_add(), which was modified in 8daec1df03
(merge-recursive: switch from (oid,mode) pairs to a diff_filespec,
2019-04-05) like this:

> diff --git a/merge-recursive.c b/merge-recursive.c
> index ada1c19ed2..1d2c9e1772 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> 
> @@ -1654,7 +1625,6 @@ static int handle_rename_add(struct merge_options *opt,
>  	/* a was renamed to c, and a separate c was added. */
>  	struct diff_filespec *a = ci->ren1->pair->one;
>  	struct diff_filespec *c = ci->ren1->pair->two;
> -	struct diff_filespec tmp;
>  	char *path = c->path;
>  	char *prev_path_desc;
>  	struct merge_file_info mfi;
> @@ -1669,23 +1639,21 @@ static int handle_rename_add(struct merge_options *opt,
>  	       a->path, c->path, rename_branch,
>  	       c->path, add_branch);
>  
> -	filespec_from_entry(&tmp, ci->ren1->src_entry, other_stage);
> -	tmp.path = a->path;

Note that 'tmp.path' used to be set ...

> -
>  	prev_path_desc = xstrfmt("version of %s from %s", path, a->path);
> -	if (merge_mode_and_contents(opt, a, c, &tmp,

... and that this 'tmp' used to become 'b' in
merge_mode_and_contents() and then in merge_3way().

> +	if (merge_mode_and_contents(opt, a, c,
> +				    &ci->ren1->src_entry->stages[other_stage],
>  				    prev_path_desc,
>  				    opt->branch1, opt->branch2,
>  				    1 + opt->call_depth * 2, &mfi))
>  		return -1;
>  	free(prev_path_desc);


This one-liner patch below the issue, the merge fails with conflicts
as expected, but, honestly, I have no idea what I am doing :)  At
least the test suite still passes, but that might not mean all that
much since it missed this issue in the first place...

diff --git a/merge-recursive.c b/merge-recursive.c
index a7bcfcbeb4..d2e380b7ed 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1660,6 +1660,7 @@ static int handle_rename_add(struct merge_options *opt,
 	       c->path, add_branch);
 
 	prev_path_desc = xstrfmt("version of %s from %s", path, a->path);
+	ci->ren1->src_entry->stages[other_stage].path = a->path;
 	if (merge_mode_and_contents(opt, a, c,
 				    &ci->ren1->src_entry->stages[other_stage],
 				    prev_path_desc,


> On Git 2.21.0 the merge succeeds (with conflicts as expected):
> 
> $ git merge origin/branch_that_has_rename_add_triggering_content_conflict_src
> CONFLICT (rename/add): Rename numbers.txt->count.txt in
> origin/branch_that_has_rename_add_triggering_content_conflict_src.
> Added count.txt in HEAD
> Auto-merging version of count.txt from numbers.txt
> Auto-merging count.txt
> Automatic merge failed; fix conflicts and then commit the result.
> 
> I’ll let you know if I get any further investigating this.

  reply	other threads:[~2019-06-04  2:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 20:23 [ANNOUNCE] Git v2.22.0-rc3 Junio C Hamano
2019-06-04  1:32 ` Ben Humphreys
2019-06-04  2:30   ` SZEDER Gábor [this message]
2019-06-04  7:26     ` [PATCH] merge-recursive: restore accidentally dropped setting of path Elijah Newren
2019-06-04  8:33       ` Ben Humphreys
2019-06-04 13:14       ` SZEDER Gábor
2019-06-04 20:14         ` Elijah Newren
2019-06-04 20:22       ` Elijah Newren
2019-06-04 20:27       ` [PATCH v2] " Elijah Newren
2019-06-04 21:07         ` SZEDER Gábor
2019-06-04 21:33           ` Junio C Hamano
2019-06-04 22:48           ` Elijah Newren
2019-06-04  1:47 ` [ANNOUNCE] Git v2.22.0-rc3 Bhaskar Chowdhury
2019-06-04 14:45 ` Git for Windows v2.22.0-rc3, was " Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2019-06-06 20:04 Randall S. Becker

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190604023039.GR951@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=ben.humphreys@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).