Make old sha1 optional with git update-ref -d
[gitweb.git] / walker.c
index 397b80de9e949ea7d70c723f7a58c9ffdaf0a168..31de6c16bd021003bdd4fc1475bfe500f28773f4 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -190,9 +190,13 @@ 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 (!walker->fetch_ref(walker, target, sha1)) {
+               struct ref *ref = alloc_ref_from_str(target);
+               if (!walker->fetch_ref(walker, ref)) {
+                       hashcpy(sha1, ref->old_sha1);
+                       free(ref);
                        return 0;
                }
+               free(ref);
        }
        return -1;
 }
@@ -256,7 +260,6 @@ int walker_fetch(struct walker *walker, int targets, char **target,
        int i;
 
        save_commit_buffer = 0;
-       track_object_refs = 0;
 
        for (i = 0; i < targets; i++) {
                if (!write_ref || !write_ref[i])
@@ -274,7 +277,7 @@ int walker_fetch(struct walker *walker, int targets, char **target,
 
        for (i = 0; i < targets; i++) {
                if (interpret_target(walker, target[i], &sha1[20 * i])) {
-                       error("Could not interpret %s as something to pull", target[i]);
+                       error("Could not interpret response from server '%s' as something to pull", target[i]);
                        goto unlock_and_fail;
                }
                if (process(walker, lookup_unknown_object(&sha1[20 * i])))