login
Header Space

 
 

Re: [PATCH 0/6] Initial subproject support (RFC?)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Git Mailing List <git@...>, Junio C Hamano <junkio@...>
Date: Tuesday, April 10, 2007 - 12:46 am

On Mon, 9 Apr 2007, Linus Torvalds wrote:

Here is, for your enjoyment, the last patch I used to actually test this 
all. I do *not* submit it as a patch for actual inclusion - the other 
patches in the series are, I think, ready to actually be merged. This one 
is not.

It's broken for a few reasons:

 - it allows you to do "git add subproject" to add the subproject to the 
   index (and then use "git commit" to commit it), but even something as 
   simple as "git commit -a" doesn't work right, because the sequence that 
   "git commit -a" uses to update the index doesn't work with the current 
   state of the plumbing (ie the

	git-diff-files --name-only -z |
		git-update-index --remove -z --stdin

   thing doesn't work right.

 - even for "git add", the logic isn't really right. It should take the 
   old index state into account to decide if it wants to add it as a 
   subproject. 

so this patch really isn't very good, but it allows people who are 
interested to perhaps actually test something. For example, my test repo 
was actually created with this:

	[torvalds@woody superproject]$ git log --raw
	commit 649ad968bdd79cb3b0f50feb819b7e9b134d3a1a
	Author: Linus Torvalds <torvalds@woody.linux-foundation.org>
	Date:   Mon Apr 9 21:36:53 2007 -0700
	
	    This commits the modification to sub-project B
	
	:160000 160000 5813084832d3c680a3436b0253639c94ed55445d 17d246a35f27a46762328281eb6e9d4558f91e9d M      sub-B

	commit f3c55ffcc000a8c0fecc6801e8909d084e3d419e
	Author: Linus Torvalds <torvalds@woody.linux-foundation.org>
	Date:   Mon Apr 9 16:12:29 2007 -0700
	
	    Superproject with two subprojects
	
	:000000 160000 0000000... c0daf4c85d48879ab450a6a887bbb241eb0de00a A    sub-A
	:000000 160000 0000000... 5813084832d3c680a3436b0253639c94ed55445d A    sub-B

	commit 45eb14edb43b10e3d3ac7a495a1ec861e85dc36f
	Author: Linus Torvalds <torvalds@woody.linux-foundation.org>
	Date:   Mon Apr 9 15:36:24 2007 -0700
	
	    Add top-level Makefile for super-project
	
	:000000 100644 0000000... 57e8394... A  Makefile

so you can see how things look at a low level (ie a "gitlink" is just a 
tree entry with mode 0160000, and the SHA1 is just the SHA1 of the HEAD 
commit in the subproject)

		Linus

---
diff --git a/dir.c b/dir.c
index 4f5a224..ef284a2 100644
--- a/dir.c
+++ b/dir.c
@@ -378,6 +378,14 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
 					continue;
 				/* fallthrough */
 			case DT_DIR:
+				/* Does it have a git directory? If so, it's a DIRLNK */
+				if (!dir->no_dirlinks) {
+					memcpy(fullname + baselen + len, "/.git/", 7);
+					if (!stat(fullname, &st)) {
+						if (S_ISDIR(st.st_mode))
+							break;
+					}
+				}
 				memcpy(fullname + baselen + len, "/", 2);
 				len++;
 				if (dir->show_other_directories &&
diff --git a/dir.h b/dir.h
index 33c31f2..1931609 100644
--- a/dir.h
+++ b/dir.h
@@ -33,7 +33,8 @@ struct dir_struct {
 	int nr, alloc;
 	unsigned int show_ignored:1,
 		     show_other_directories:1,
-		     hide_empty_directories:1;
+		     hide_empty_directories:1,
+		     no_dirlinks;
 	struct dir_entry **entries;
 
 	/* Exclude info */
-
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:
[PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:12 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:46 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 9:04 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Martin Waitz, (Wed Apr 11, 4:32 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Wed Apr 11, 4:42 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Martin Waitz, (Wed Apr 11, 4:57 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 11:13 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 11:48 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:07 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 3:32 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 4:11 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 4:52 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Sam Ravnborg, (Tue Apr 10, 5:02 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 5:27 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Nicolas Pitre, (Tue Apr 10, 5:03 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), J. Bruce Fields, (Sun Apr 15, 7:21 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 12:43 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Thu Apr 12, 11:12 am)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 12:28 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 3:29 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 1:23 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Frank Lichtenheld, (Tue Apr 10, 4:40 am)
[PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Tue Apr 10, 12:15 am)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:00 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:06 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Wed Apr 11, 10:28 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Wed Apr 11, 10:14 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Fri Apr 13, 11:23 am)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:30 pm)
[PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 12:14 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 10:58 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Josef Weidendorfer, (Tue Apr 10, 11:54 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 11:52 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 12:16 pm)
speck-geostationary