@@ -21,6 +21,14 @@ static void process_blob(struct blob *blob,
2121 /* Nothing to do, really .. The blob lookup was the important part */
2222}
2323
24+ static void process_gitlink (const unsigned char * sha1 ,
25+ struct object_array * p ,
26+ struct name_path * path ,
27+ const char * name )
28+ {
29+ /* I don't think we want to recurse into this, really. */
30+ }
31+
2432static void process_tree (struct tree * tree ,
2533 struct object_array * p ,
2634 struct name_path * path ,
@@ -47,6 +55,8 @@ static void process_tree(struct tree *tree,
4755 while (tree_entry (& desc , & entry )) {
4856 if (S_ISDIR (entry .mode ))
4957 process_tree (lookup_tree (entry .sha1 ), p , & me , entry .path );
58+ else if (S_ISGITLINK (entry .mode ))
59+ process_gitlink (entry .sha1 , p , & me , entry .path );
5060 else
5161 process_blob (lookup_blob (entry .sha1 ), p , & me , entry .path );
5262 }
@@ -159,6 +169,16 @@ static void add_cache_refs(struct rev_info *revs)
159169
160170 read_cache ();
161171 for (i = 0 ; i < active_nr ; i ++ ) {
172+ /*
173+ * The index can contain blobs and GITLINKs, GITLINKs are hashes
174+ * that don't actually point to objects in the repository, it's
175+ * almost guaranteed that they are NOT blobs, so we don't call
176+ * lookup_blob() on them, to avoid populating the hash table
177+ * with invalid information
178+ */
179+ if (S_ISGITLINK (ntohl (active_cache [i ]-> ce_mode )))
180+ continue ;
181+
162182 lookup_blob (active_cache [i ]-> sha1 );
163183 /*
164184 * We could add the blobs to the pending list, but quite
0 commit comments