author | Junio C Hamano <gitster@pobox.com> | |
Mon, 2 Jul 2007 23:41:44 +0000 (16:41 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 3 Jul 2007 00:12:48 +0000 (17:12 -0700) |
* maint:
Make git-prune submodule aware (and fix a SEGFAULT in the process)
Make git-prune submodule aware (and fix a SEGFAULT in the process)
1 | 2 | |||
---|---|---|---|---|
reachable.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc reachable.c
index ff3dd34962ec69320a67a4823b844755ebfe0e7d,c1aee603e7df68d6a12ce25b183c478d7da6ab4e..6383401e2dd6bef3251a105ac136312dfdcdeb3c
--- 1/reachable.c
--- 2/reachable.c
+++ b/reachable.c
while (tree_entry(&desc, &entry)) {
if (S_ISDIR(entry.mode))
process_tree(lookup_tree(entry.sha1), p, &me, entry.path);
- else if (S_ISDIRLNK(entry.mode))
++ else if (S_ISGITLINK(entry.mode))
+ process_gitlink(entry.sha1, p, &me, entry.path);
else
process_blob(lookup_blob(entry.sha1), p, &me, entry.path);
}
read_cache();
for (i = 0; i < active_nr; i++) {
- if (S_ISDIRLNK(ntohl(active_cache[i]->ce_mode)))
+ /*
+ * The index can contain blobs and GITLINKs, GITLINKs are hashes
+ * that don't actually point to objects in the repository, it's
+ * almost guaranteed that they are NOT blobs, so we don't call
+ * lookup_blob() on them, to avoid populating the hash table
+ * with invalid information
+ */
++ if (S_ISGITLINK(ntohl(active_cache[i]->ce_mode)))
+ continue;
+
lookup_blob(active_cache[i]->sha1);
/*
* We could add the blobs to the pending list, but quite