]> asedeno.scripts.mit.edu Git - git.git/blobdiff - reachable.c
Makefile: add missing dependency on http.h
[git.git] / reachable.c
index 823e3242ec126a5d55c36b24eb8699a2efecad52..b515fa2de332cc570a8a32861bd8d6491b61133e 100644 (file)
@@ -15,6 +15,8 @@ static void process_blob(struct blob *blob,
 {
        struct object *obj = &blob->object;
 
+       if (!blob)
+               die("bad blob object");
        if (obj->flags & SEEN)
                return;
        obj->flags |= SEEN;
@@ -39,12 +41,13 @@ static void process_tree(struct tree *tree,
        struct name_entry entry;
        struct name_path me;
 
+       if (!tree)
+               die("bad tree object");
        if (obj->flags & SEEN)
                return;
        obj->flags |= SEEN;
        if (parse_tree(tree) < 0)
                die("bad tree object %s", sha1_to_hex(obj->sha1));
-       name = xstrdup(name);
        add_object(obj, p, path, name);
        me.up = path;
        me.elem = name;
@@ -79,7 +82,8 @@ static void process_tag(struct tag *tag, struct object_array *p, const char *nam
 
        if (parse_tag(tag) < 0)
                die("bad tag object %s", sha1_to_hex(obj->sha1));
-       add_object(tag->tagged, p, NULL, name);
+       if (tag->tagged)
+               add_object(tag->tagged, p, NULL, name);
 }
 
 static void walk_commit_list(struct rev_info *revs)
@@ -150,7 +154,8 @@ static int add_one_reflog(const char *path, const unsigned char *sha1, int flag,
 static void add_one_tree(const unsigned char *sha1, struct rev_info *revs)
 {
        struct tree *tree = lookup_tree(sha1);
-       add_pending_object(revs, &tree->object, "");
+       if (tree)
+               add_pending_object(revs, &tree->object, "");
 }
 
 static void add_cache_tree(struct cache_tree *it, struct rev_info *revs)