X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=reachable.c;h=6383401e2dd6bef3251a105ac136312dfdcdeb3c;hb=36a189c86e4a4ad75a75f598eedfe2defab3cbf3;hp=4dfee1dbe8acb4bb6dbf2570585974d0cca6f757;hpb=94421474e068c2f0a7bef3d658216a0f1e75b906;p=git.git diff --git a/reachable.c b/reachable.c index 4dfee1dbe..6383401e2 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_ISGITLINK(entry.mode)) + process_gitlink(entry.sha1, p, &me, entry.path); else process_blob(lookup_blob(entry.sha1), p, &me, entry.path); } @@ -104,7 +113,9 @@ static void walk_commit_list(struct rev_info *revs) } } -static int add_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1, char *datail, void *cb_data) +static int add_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1, + const char *email, unsigned long timestamp, int tz, + const char *message, void *cb_data) { struct object *object; struct rev_info *revs = (struct rev_info *)cb_data; @@ -158,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 @@ -186,9 +207,9 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog) /* Add all external refs */ for_each_ref(add_one_ref, revs); - /* Add all reflog info from refs */ + /* Add all reflog info */ if (mark_reflog) - for_each_ref(add_one_reflog, revs); + for_each_reflog(add_one_reflog, revs); /* * Set up the revision walk - this will move all commits