X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=reachable.c;h=c1aee603e7df68d6a12ce25b183c478d7da6ab4e;hb=1b2782a5e2f88bf5e6e2cbb58e54fea015e21af5;hp=01760d70462927ad33c7976a50e31372863a45f9;hpb=3eee9c6dbebcf6341ad202f7dd4d416ef3fcba5e;p=git.git diff --git a/reachable.c b/reachable.c index 01760d704..c1aee603e 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, @@ -42,12 +50,13 @@ static void process_tree(struct tree *tree, me.elem = name; me.elem_len = strlen(name); - desc.buf = tree->buffer; - desc.size = tree->size; + init_tree_desc(&desc, tree->buffer, tree->size); 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)) + process_gitlink(entry.sha1, p, &me, entry.path); else process_blob(lookup_blob(entry.sha1), p, &me, entry.path); } @@ -160,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_ISDIRLNK(ntohl(active_cache[i]->ce_mode))) + continue; + lookup_blob(active_cache[i]->sha1); /* * We could add the blobs to the pending list, but quite