git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
Cc: <git@vger.kernel.org>
Subject: Re: Merge: "git rm bla": "bla: needs merge", but still removes file "bla"
Date: Wed, 17 Jul 2019 09:44:03 -0700	[thread overview]
Message-ID: <xmqqd0i81ui4.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <5D2ED50D020000A100032435@gwsmtp.uni-regensburg.de> (Ulrich Windl's message of "Wed, 17 Jul 2019 09:58:05 +0200")

"Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> writes:

> I just had "an interesting case" for a merge with conflicts:
> The merge re-introduced a file that had been renamed (say old one is "bla", and the new one is "foo").
> After merging the changes from bla into foo, I added foo, trying to remove bla:
>> git add foo
>> git rm bla
> bla: needs merge
> rm 'bla'

Yeah, I think I've known about this for a long time.  We have an
internal call to "update-index --refresh" before starting to remove,
because we need to know which path is up-to-date wrt the index, and
the machinery for refreshing the index by default gives the "needs
merge" message.  We never bothered to squelch it.

Perhaps this one-liner would be a sufficient fix.



 builtin/rm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/rm.c b/builtin/rm.c
index 2eacda42b4..19ce95a901 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -273,7 +273,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	parse_pathspec(&pathspec, 0,
 		       PATHSPEC_PREFER_CWD,
 		       prefix, argv);
-	refresh_index(&the_index, REFRESH_QUIET, &pathspec, NULL, NULL);
+	refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &pathspec, NULL, NULL);
 
 	seen = xcalloc(pathspec.nr, 1);
 

  reply	other threads:[~2019-07-17 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  7:58 Merge: "git rm bla": "bla: needs merge", but still removes file "bla" Ulrich Windl
2019-07-17 16:44 ` Junio C Hamano [this message]
2019-07-17 20:38   ` [PATCH] rm: resolving by removal is not a warning-worthy event Junio C Hamano
2019-07-18 20:26     ` Jeff King
2019-07-18 21:07       ` Junio C Hamano
2019-07-18 21:43         ` 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=xmqqd0i81ui4.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=git@vger.kernel.org \
    /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).