Convert struct ref to use object_id.
[gitweb.git] / walker.c
index 483da4e0fb5771b8a64d62648624258dcf3fdcb0..ce2f57abe79a68539b8c48e3c024d7826ad34417 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -17,10 +17,9 @@ void walker_say(struct walker *walker, const char *fmt, const char *hex)
 
 static void report_missing(const struct object *obj)
 {
-       char missing_hex[41];
-       strcpy(missing_hex, sha1_to_hex(obj->sha1));
        fprintf(stderr, "Cannot obtain needed %s %s\n",
-               obj->type ? typename(obj->type): "object", missing_hex);
+               obj->type ? typename(obj->type): "object",
+               sha1_to_hex(obj->sha1));
        if (!is_null_sha1(current_commit_sha1))
                fprintf(stderr, "while processing commit %s.\n",
                        sha1_to_hex(current_commit_sha1));
@@ -191,7 +190,7 @@ static int interpret_target(struct walker *walker, char *target, unsigned char *
        if (!check_refname_format(target, 0)) {
                struct ref *ref = alloc_ref(target);
                if (!walker->fetch_ref(walker, ref)) {
-                       hashcpy(sha1, ref->old_sha1);
+                       hashcpy(sha1, ref->old_oid.hash);
                        free(ref);
                        return 0;
                }
@@ -200,9 +199,11 @@ static int interpret_target(struct walker *walker, char *target, unsigned char *
        return -1;
 }
 
-static int mark_complete(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int mark_complete(const char *path, const struct object_id *oid,
+                        int flag, void *cb_data)
 {
-       struct commit *commit = lookup_commit_reference_gently(sha1, 1);
+       struct commit *commit = lookup_commit_reference_gently(oid->hash, 1);
+
        if (commit) {
                commit->object.flags |= COMPLETE;
                commit_list_insert(commit, &complete);
@@ -299,7 +300,7 @@ int walker_fetch(struct walker *walker, int targets, char **target,
                strbuf_reset(&refname);
                strbuf_addf(&refname, "refs/%s", write_ref[i]);
                if (ref_transaction_update(transaction, refname.buf,
-                                          &sha1[20 * i], NULL, 0, 0,
+                                          &sha1[20 * i], NULL, 0,
                                           msg ? msg : "fetch (unknown)",
                                           &err)) {
                        error("%s", err.buf);