git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: Emily Shaffer <emilyshaffer@google.com>
To: newren@gmail.com
Cc: git@vger.kernel.org, jrn@google.com
Subject: BUG() during criss-cross merge with directory rename and deleted file
Date: Fri, 26 Jul 2019 15:09:28 -0700
Message-ID: <20190726220928.GG113966@google.com> (raw)

Hi all,

As mentioned during the standup in #git-devel today, we encountered a
BUG() during certain circumstances of a criss-cross merge. Timing has
prevented me from getting the repro case together to send just yet, but
it appears that the issue is as follows:

 - During a merge in a repo with fairly complicated, merge-y history,
   the following BUG() is seen:
   "BUG: There are unmerged index entries:
    BUG: 2 baz/bar.txt
    BUG: merge-recursive.c:429: unmerged index entries in
    merge-recursive.c
    Aborted"
 - But when the user then runs `git status` (after clearing
   .git/index.lock) the directory is clean.
 - The repo does not contain a 'baz/bar.txt' (although 'baz/' exists).
 - In the repo's history a 'foo/bar.txt' can be found (that is the only
   'bar.txt' to ever exist in the project).

Digging further shows:

 - The merge had  multiple closest shared ancestors (criss-cross
   merge)
 - Directory 'foo/' was renamed on one side to 'baz/'...
 - ...and 'foo/bar.txt' was deleted on the other side.
 - When the virtual ancestor is generated, the directory rename can't be
   resolved and leaves a conflict.
 - The virtual ancestor being written to disk is in a conflicted state.
 - This causes the top-level merge to fail, printing the BUG() above
   which references a 'baz/bar.txt' that never really lived there.

Furthermore...

 - If merge.directoryrenames is set to any value besides "conflict", the
   merge succeeds (no BUG() generated).

This seems to have been introduced in 8c8e5bd6eb331d055aa7fa6345f6dcdadd658979
although I haven't bisected it yet.

It seems like the solution is to watch for whether we're making a
virtual ancestor during a recursive merge, and if so, to treat
merge.directoryrenames = "conflict" as "true" or "false" instead.

I plan to modify the tests added in 8c8e5bd6 to highlight this issue
(just haven't had time, and probably won't til next week), and send a
patch doing the special treatment on merge.directoryrenames.

Happy to hear other ideas folks have.

 - Emily

             reply	other threads:[~2019-07-26 22:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 22:09 Emily Shaffer [this message]
2019-08-05 22:33 ` [PATCH 1/1] merge-recursive: avoid directory rename detection in recursive case Elijah Newren
2019-08-06 16:57   ` Junio C Hamano
2019-08-06 17:26     ` Elijah Newren
2019-08-06 17:49     ` Junio C Hamano
2019-08-06 17:26   ` Junio C Hamano
2019-08-06 17:29     ` Elijah Newren
2019-08-06 20:28   ` Emily Shaffer
2019-08-06 21:16     ` Elijah Newren
2019-08-06 21:54       ` Emily Shaffer
2019-08-08 11:00       ` 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

  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=20190726220928.GG113966@google.com \
    --to=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrn@google.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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git