git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] merge-recursive: Avoid excessive output for and reprocessing of renames
@ 2010-08-20 12:55 Elijah Newren
  0 siblings, 0 replies; only message in thread
From: Elijah Newren @ 2010-08-20 12:55 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

In 5a2580d (merge_recursive: Fix renames across paths below D/F conflicts
2010-07-09) and ae74548 (merge-recursive: Fix multiple file rename across
D/F conflict 2010-08-17), renames across D/F conflicts were fixed by
making process_renames() consider as unprocessed renames whose dst_entry
"still" had higher stage entries.  The assumption was that those higher
stage entries would have been cleared out of dst_entry by that point in
cases where the conflict could be resolved (normal renames with no D/F
conflicts).  That is not the case -- higher stage entries will remain in
all cases.

Fix this by checking for higher stage entries corresponding to D/F
conflicts, namely that stages 2 and 3 have exactly one nonzero mode between
them.  The nonzero mode stage corresponds to a file at the path, while the
stage with a zero mode will correspond to a directory at that path (since
rename/delete conflicts will have already been handled before this codepath
is reached.)

Signed-off-by: Elijah Newren <newren@gmail.com>
---
What a mess, sorry for flubbing up the D/F series so badly and the need
for so many fixups after it already hit next.  I hope this finally fixes
things and that there's no more embarrasing bugs (or even
non-embarrasing ones).  Also, it looks like Alex was right about this
(http://article.gmane.org/gmane.comp.version-control.git/149948), though
I just didn't quite understand him at the time.  

 merge-recursive.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index a3fc443..aadd48c 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1020,7 +1020,6 @@ static int process_renames(struct merge_options *o,
 				if (mfi.clean &&
 				    sha_eq(mfi.sha, ren1->pair->two->sha1) &&
 				    mfi.mode == ren1->pair->two->mode) {
-					int i;
 					/*
 					 * This message is part of
 					 * t6022 test. If you change
@@ -1032,12 +1031,9 @@ static int process_renames(struct merge_options *o,
 					 * in the index (e.g. due to a D/F
 					 * conflict) that need to be resolved.
 					 */
-					for (i = 1; i <= 3; i++) {
-						if (!ren1->dst_entry->stages[i].mode)
-							continue;
+					if (!ren1->dst_entry->stages[2].mode !=
+					    !ren1->dst_entry->stages[3].mode)
 						ren1->dst_entry->processed = 0;
-						break;
-					}
 				} else {
 					if (mfi.merge || !mfi.clean)
 						output(o, 1, "Renaming %s => %s", ren1_src, ren1_dst);
-- 
1.7.2.1.365.gf72e17

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-20 12:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-20 12:55 [PATCH] merge-recursive: Avoid excessive output for and reprocessing of renames Elijah Newren

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).