Re: Handling large files with GIT

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Tuesday, February 14, 2006 - 7:18 pm

On Tue, 14 Feb 2006, Linus Torvalds wrote:

Here, btw, is the trivial diff to turn my previous "tree-resolve" into a 
"resolve tree relative to the current branch".

In particular, it makes the example merge perhaps even more interesting, 
and makes the "merging directories and merging files should use different 
heuristics more obvious". It's quite instructive, I think.

So if you want to test this, the merge I have been testing with is the 
last infiniband merge in the kernel:

	git-merge-tree 3c3b809 4cbf876 7d2babc

and you'll need to spend a few moments on thinking about what the 
"directory merge" thing there means: in particular, we should probably 
make the

	if (entry[2].sha1) {

test be

	if (entry[2].sha && !S_ISDIR(entry[2].mode)) {

(and same for "resolve to entry[1]" case for that matter) so that we never 
create a "resolve()" that picks a whole subdirectory from one of the 
branches.

The current logic is "logical", just probably not what we want.

		Linus

----
diff --git a/merge-tree.c b/merge-tree.c
index 0d6d434..0bf871c 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -55,9 +55,19 @@ static int same_entry(struct name_entry 
 		a->mode == b->mode;
 }
 
-static void resolve(const char *base, struct name_entry *result)
+static void resolve(const char *base, struct name_entry *branch1, struct name_entry *result)
 {
-	printf("0 %06o %s %s%s\n", result->mode, sha1_to_hex(result->sha1), base, result->path);
+	char branch1_sha1[50];
+
+	/* If it's already branch1, don't bother showing it */
+	if (!branch1)
+		return;
+	memcpy(branch1_sha1, sha1_to_hex(branch1->sha1), 41);
+
+	printf("0 %06o->%06o %s->%s %s%s\n",
+		branch1->mode, result->mode,
+		branch1_sha1, sha1_to_hex(result->sha1),
+		base, result->path);
 }
 
 static int unresolved_directory(const char *base, struct name_entry n[3])
@@ -183,21 +193,21 @@ static void merge_trees(struct tree_desc
 		/* Same in both? */
 		if (same_entry(entry+1, entry+2)) {
 			if (entry[0].sha1) {
-				resolve(base, entry+1);
+				resolve(base, NULL, entry+1);
 				continue;
 			}
 		}
 
 		if (same_entry(entry+0, entry+1)) {
 			if (entry[2].sha1) {
-				resolve(base, entry+2);
+				resolve(base, entry+1, entry+2);
 				continue;
 			}
 		}
 
 		if (same_entry(entry+0, entry+2)) {
 			if (entry[1].sha1) {
-				resolve(base, entry+1);
+				resolve(base, NULL, entry+1);
 				continue;
 			}
 		}
-
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:
Handling large files with GIT, Martin Langhoff, (Wed Feb 8, 2:14 am)
Re: Handling large files with GIT, Johannes Schindelin, (Wed Feb 8, 4:54 am)
Re: Handling large files with GIT, Linus Torvalds, (Wed Feb 8, 9:34 am)
Re: Handling large files with GIT, Linus Torvalds, (Wed Feb 8, 10:01 am)
Re: Handling large files with GIT, Junio C Hamano, (Wed Feb 8, 1:11 pm)
Re: Handling large files with GIT, Florian Weimer, (Wed Feb 8, 2:20 pm)
Re: Handling large files with GIT, Martin Langhoff, (Wed Feb 8, 3:35 pm)
Re: Handling large files with GIT, Greg KH, (Wed Feb 8, 9:54 pm)
Re: Handling large files with GIT, Martin Langhoff, (Wed Feb 8, 10:38 pm)
Re: Handling large files with GIT, Ben Clifford, (Sun Feb 12, 6:26 pm)
Re: Handling large files with GIT, Linus Torvalds, (Sun Feb 12, 8:42 pm)
Re: Handling large files with GIT, Martin Langhoff, (Sun Feb 12, 9:40 pm)
Re: Handling large files with GIT, Linus Torvalds, (Sun Feb 12, 9:57 pm)
Re: Handling large files with GIT, Linus Torvalds, (Sun Feb 12, 10:05 pm)
Re: Handling large files with GIT, Jeff Garzik, (Sun Feb 12, 10:55 pm)
Re: Handling large files with GIT, Keith Packard, (Sun Feb 12, 11:07 pm)
Re: Handling large files with GIT, Linus Torvalds, (Mon Feb 13, 9:19 am)
Re: Handling large files with GIT, Ian Molton, (Mon Feb 13, 4:17 pm)
Re: Handling large files with GIT, Martin Langhoff, (Mon Feb 13, 4:19 pm)
Re: Handling large files with GIT, Martin Langhoff, (Mon Feb 13, 5:07 pm)
Re: Handling large files with GIT, Johannes Schindelin, (Tue Feb 14, 11:56 am)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 12:52 pm)
Re: Handling large files with GIT, Sam Vilain, (Tue Feb 14, 2:21 pm)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 3:01 pm)
Re: Handling large files with GIT, Junio C Hamano, (Tue Feb 14, 3:30 pm)
Re: Handling large files with GIT, Sam Vilain, (Tue Feb 14, 5:40 pm)
Re: Handling large files with GIT, Junio C Hamano, (Tue Feb 14, 6:39 pm)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 7:05 pm)
Re: Handling large files with GIT, Martin Langhoff, (Tue Feb 14, 7:07 pm)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 7:18 pm)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 7:33 pm)
Re: Handling large files with GIT, Linus Torvalds, (Tue Feb 14, 8:58 pm)
Re: Handling large files with GIT, Sam Vilain, (Tue Feb 14, 9:03 pm)
Re: Handling large files with GIT, Junio C Hamano, (Wed Feb 15, 2:54 am)
Re: Handling large files with GIT, Linus Torvalds, (Wed Feb 15, 8:44 am)
Re: Handling large files with GIT, Linus Torvalds, (Wed Feb 15, 10:16 am)
Re: Handling large files with GIT, Linus Torvalds, (Wed Feb 15, 8:25 pm)
Re: Handling large files with GIT, Junio C Hamano, (Wed Feb 15, 8:29 pm)
Re: Handling large files with GIT, Fredrik Kuivinen, (Thu Feb 16, 1:32 pm)