Simplify is_kept_pack()
[gitweb.git] / walker.c
index fa96a7c7d293ee43a86317c8407d4e960311d59e..0e68ee6d2e2fb1b866ecec00c5f6446af366a62e 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -59,6 +59,7 @@ static int process_tree(struct walker *walker, struct tree *tree)
        free(tree->buffer);
        tree->buffer = NULL;
        tree->size = 0;
+       tree->object.parsed = 0;
        return 0;
 }
 
@@ -190,8 +191,7 @@ static int interpret_target(struct walker *walker, char *target, unsigned char *
        if (!get_sha1_hex(target, sha1))
                return 0;
        if (!check_ref_format(target)) {
-               struct ref *ref = alloc_ref(strlen(target));
-               strcpy(ref->name, target);
+               struct ref *ref = alloc_ref_from_str(target);
                if (!walker->fetch_ref(walker, ref)) {
                        hashcpy(sha1, ref->old_sha1);
                        free(ref);