Re: [PATCH] threeway_merge: if file will not be touched, leave it alone

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Sunday, October 22, 2006 - 9:17 pm

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:


I think the conditional "output" is to mimic the first case in
git-merge-one-file; there we conditionally give that message
only when ours had that path.  If we lost the path while they
have it the same way as the common ancestor, then we do not have
the path to begin with when we start the merge.  It is not
correct to say "Removing" in such a case.

So the output() call being tied to if (a_sha) _is_ correct in
your code.

What we would want to prevent is to remove the path from the
working tree when we did not have the path at the beginning of
the merge and the merge result says we do not want that path.
In such a case, the file in the working tree is an untracked
file that is not touched by the merge.

E.g gitweb/gitweb.cgi is not tracked in the current "master",
but used to be around v1.4.0 time.  If you try to merge a
branch forked from v1.4.0 because you are interested in a work
on other part of the system (i.e. the branch did not touch
gitweb/ at all), we want to successfully merge that branch into
our "master" even after "make" created gitweb/gitweb.cgi.

Such a merge would start with your HEAD and index missing
gitweb/gitweb.cgi but the path still in your working tree.  The
common ancestor and their tree has the path tracked, so you
would end up with identical stage #1 and #3 with missing stage
#2.

The merge machinery should say the merge result does not have
the path, so it should remove it from the index.  However, it
should _not_ touch the untracked (from the beginning of the time
the merge started) working tree file.  So remove_file() call you
touch in your patch needs to be told not to update working
directory in such a case.

Under "aggressive" rule, threeway_merge() is requested to make
the merge policy decision, so it should also loosen this check
itself.  The change by commit 0b35995 needs to be updated with
this patch:

diff --git a/unpack-trees.c b/unpack-trees.c
index b1d78b8..7cfd628 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -642,7 +642,7 @@ int threeway_merge(struct cache_entry **
 		    (remote_deleted && head && head_match)) {
 			if (index)
 				return deleted_entry(index, index, o);
-			else if (path)
+			else if (path && !head_deleted)
 				verify_absent(path, "removed", o);
 			return 0;
 		}


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 7:56 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 8:34 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 9:21 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 10:03 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 10:18 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Shawn Pearce, (Fri Oct 20, 10:21 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 10:45 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 10:47 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 10:48 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, David Lang, (Fri Oct 20, 10:58 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 10:59 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 11:06 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jan Hudec, (Fri Oct 20, 11:12 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jon Smirl, (Fri Oct 20, 11:15 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 11:30 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 11:35 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 11:46 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 11:47 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 11:48 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 12:00 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 12:04 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 12:10 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Fri Oct 20, 12:14 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 12:31 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 12:46 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 1:12 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Junio C Hamano, (Fri Oct 20, 1:17 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Petr Baudis, (Fri Oct 20, 1:23 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 1:29 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, David Lang, (Fri Oct 20, 1:49 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Shawn Pearce, (Fri Oct 20, 1:53 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Petr Baudis, (Fri Oct 20, 1:53 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, David Lang, (Fri Oct 20, 1:55 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 1:57 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jeff Licquia, (Fri Oct 20, 3:13 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Petr Baudis, (Fri Oct 20, 3:40 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jeff King, (Fri Oct 20, 3:59 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Robert Collins, (Fri Oct 20, 4:05 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Robert Collins, (Fri Oct 20, 4:15 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Aaron Bentley, (Fri Oct 20, 4:33 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jeff Licquia, (Fri Oct 20, 4:39 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Fri Oct 20, 4:59 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Junio C Hamano, (Fri Oct 20, 6:26 pm)
git-merge-recursive, was Re: [ANNOUNCE] Example Cogito Add ..., Johannes Schindelin, (Fri Oct 20, 7:03 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Matthieu Moy, (Sat Oct 21, 12:56 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Sat Oct 21, 1:36 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Sat Oct 21, 1:40 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Matthieu Moy, (Sat Oct 21, 3:09 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Sat Oct 21, 3:34 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jan Hudec, (Sat Oct 21, 10:40 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Sat Oct 21, 10:51 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Linus Torvalds, (Sat Oct 21, 11:42 am)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jan Hudec, (Sat Oct 21, 12:20 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Jakub Narebski, (Sat Oct 21, 12:21 pm)
[PATCH] threeway_merge: if file will not be touched, leave ..., Johannes Schindelin, (Sun Oct 22, 2:04 pm)
Re: [PATCH] threeway_merge: if file will not be touched, l ..., Johannes Schindelin, (Sun Oct 22, 5:48 pm)
Re: [PATCH] threeway_merge: if file will not be touched, l ..., Junio C Hamano, (Sun Oct 22, 9:17 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Matthew Hannigan, (Thu Nov 2, 8:43 pm)
Re: [ANNOUNCE] Example Cogito Addon - cogito-bundle, Martin Langhoff, (Thu Nov 2, 11:36 pm)