read-cache: save index SHA-1 after reading
[gitweb.git] / walker.c
index dce7128daf8487a61e8d2f35cf15fca618964f86..1dd86b8f33e04cfc6c0616578416acb1160b5718 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -56,13 +56,11 @@ static int process_tree(struct walker *walker, struct tree *tree)
                if (!obj || process(walker, obj))
                        return -1;
        }
-       free(tree->buffer);
-       tree->buffer = NULL;
-       tree->size = 0;
-       tree->object.parsed = 0;
+       free_tree_buffer(tree);
        return 0;
 }
 
+/* Remember to update object flag allocation in object.h */
 #define COMPLETE       (1U << 0)
 #define SEEN           (1U << 1)
 #define TO_SCAN                (1U << 2)
@@ -190,7 +188,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)) {
+       if (!check_refname_format(target, 0)) {
                struct ref *ref = alloc_ref(target);
                if (!walker->fetch_ref(walker, ref)) {
                        hashcpy(sha1, ref->old_sha1);