summaryrefslogtreecommitdiff
path: root/reachable.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-07-02 16:41:44 -0700
committerJunio C Hamano <gitster@pobox.com>2007-07-02 17:12:48 -0700
commitb941ffac506d3f57246e46a8913da614e62a1d48 (patch)
treef76758c462c69b87f40bfc0ae898d2aae255efca /reachable.c
parent1fd81efad0d65afba91f8fb27b40a6345bfb50de (diff)
parent8d2244ba74f5207b9f7f9f1b4efbcccacbbb2c7b (diff)
downloadgit-b941ffac506d3f57246e46a8913da614e62a1d48.tar.gz
Merge branch 'maint'
* maint: Make git-prune submodule aware (and fix a SEGFAULT in the process)
Diffstat (limited to 'reachable.c')
-rw-r--r--reachable.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/reachable.c b/reachable.c
index ff3dd34962..6383401e2d 100644
--- a/reachable.c
+++ b/reachable.c
@@ -21,6 +21,14 @@ static void process_blob(struct blob *blob,
/* Nothing to do, really .. The blob lookup was the important part */
}
+static void process_gitlink(const unsigned char *sha1,
+ struct object_array *p,
+ struct name_path *path,
+ const char *name)
+{
+ /* I don't think we want to recurse into this, really. */
+}
+
static void process_tree(struct tree *tree,
struct object_array *p,
struct name_path *path,
@@ -47,6 +55,8 @@ static void process_tree(struct tree *tree,
while (tree_entry(&desc, &entry)) {
if (S_ISDIR(entry.mode))
process_tree(lookup_tree(entry.sha1), p, &me, entry.path);
+ 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);
}
@@ -159,6 +169,16 @@ static void add_cache_refs(struct rev_info *revs)
read_cache();
for (i = 0; i < active_nr; i++) {
+ /*
+ * 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