From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Alex Riesen <raa.lkml@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Gerrit Pape <pape@smarden.org>
Subject: Re: merge doesn't remove files
Date: Sat, 3 Feb 2007 23:59:33 -0500 [thread overview]
Message-ID: <20070204045933.GC16766@spearce.org> (raw)
In-Reply-To: <7vd54qzoka.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Having said that, I think there is a worse problem with
> merge-recursive. It loses untracked files that are not
> involved in the merge.
I tracked it down to my commit 8371234e which was supposed to fix
the bug that started this thread.
Apparently what I did was make merge-recursive remove the file from
the working directory if it was renamed, even though it wasn't in
the index when the merge started.
So merge-recursive is only deleting untracked files which are in
the merge base, but aren't in one of the heads involved in the merge.
I'm looking at patching this. Clearly we should only delete the
old file from the working directory during a rename if the tree-ish
which was supposed to match the working directory had the file
in it. But that tree-ish doesn't have to be the first non-base
argument to merge-recursive, does it? In practice it usually is,
but can I assume it in the code?
I'm looking at something like the following:
diff --git a/merge-recursive.c b/merge-recursive.c
index fa320eb..bbb52a7 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -891,7 +891,7 @@ static int process_renames(struct path_list *a_renames,
struct diff_filespec src_other, dst_other;
int try_merge, stage = a_renames == renames1 ? 3: 2;
- remove_file(1, ren1_src, index_only);
+ remove_file(1, ren1_src, index_only || stage == 3);
hashcpy(src_other.sha1, ren1->src_entry->stages[stage].s
src_other.mode = ren1->src_entry->stages[stage].mode;
--
Shawn.
next prev parent reply other threads:[~2007-02-04 4:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-03 22:48 merge doesn't remove files Gerrit Pape
2007-02-04 0:48 ` Junio C Hamano
2007-02-04 1:41 ` Junio C Hamano
2007-02-04 4:59 ` Shawn O. Pearce [this message]
2007-02-04 10:40 ` Linus Torvalds
2007-02-04 3:50 ` Shawn O. Pearce
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=20070204045933.GC16766@spearce.org \
--to=spearce@spearce.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=pape@smarden.org \
--cc=raa.lkml@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 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).