@matheusbsbs / matheus-bagliano / commits / 6e2f441bd4
Fork 0

Teach git list-objects logic to not follow gitlinks

This allows us to pack superprojects and thus clone them (but not yet check them out on the receiving side.. That's the next patch) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Apr 13, 2007 at 09:25 UTC 6e2f441bd42c55c73b5e7ac1fdc2aded07901cb3
1 file changed +34
list-objects.c
+34
@@ -25,6 +25,37 @@ static void process_blob(struct rev_info *revs,
25 add_object(obj, p, path, name);
26 }
27
28 +/*
29 + * Processing a gitlink entry currently does nothing, since
30 + * we do not recurse into the subproject.
31 + *
32 + * We *could* eventually add a flag that actually does that,
33 + * which would involve:
34 + * - is the subproject actually checked out?
35 + * - if so, see if the subproject has already been added
36 + * to the alternates list, and add it if not.
37 + * - process the commit (or tag) the gitlink points to
38 + * recursively.
39 + *
40 + * However, it's unclear whether there is really ever any
41 + * reason to see superprojects and subprojects as such a
42 + * "unified" object pool (potentially resulting in a totally
43 + * humongous pack - avoiding which was the whole point of
44 + * having gitlinks in the first place!).
45 + *
46 + * So for now, there is just a note that we *could* follow
47 + * the link, and how to do it. Whether it necessarily makes
48 + * any sense what-so-ever to ever do that is another issue.
49 + */
50 +static void process_gitlink(struct rev_info *revs,
51 + const unsigned char *sha1,
52 + struct object_array *p,
53 + struct name_path *path,
54 + const char *name)
55 +{
56 + /* Nothing to do */
57 +}
58 +
59 static void process_tree(struct rev_info *revs,
60 struct tree *tree,
61 struct object_array *p,
@@ -56,6 +87,9 @@ static void process_tree(struct rev_info *revs,
87 process_tree(revs,
88 lookup_tree(entry.sha1),
89 p, &me, entry.path);
90 + else if (S_ISDIRLNK(entry.mode))
91 + process_gitlink(revs, entry.sha1,
92 + p, &me, entry.path);
93 else
94 process_blob(revs,
95 lookup_blob(entry.sha1),