struct ref_lock: convert old_sha1 member to object_id
[gitweb.git] / transport.c
index f080e93dcd50e5f2329b180bae93c59a461810f8..40692f8ae8aba65001bdee1300e525def1e1870d 100644 (file)
@@ -278,8 +278,8 @@ static int fetch_objs_via_rsync(struct transport *transport,
        return run_command(&rsync);
 }
 
-static int write_one_ref(const char *name, const unsigned char *sha1,
-               int flags, void *data)
+static int write_one_ref(const char *name, const struct object_id *oid,
+                        int flags, void *data)
 {
        struct strbuf *buf = data;
        int len = buf->len;
@@ -291,7 +291,7 @@ static int write_one_ref(const char *name, const unsigned char *sha1,
 
        strbuf_addstr(buf, name);
        if (safe_create_leading_directories(buf->buf) ||
-           write_file(buf->buf, 0, "%s\n", sha1_to_hex(sha1)))
+           write_file(buf->buf, 0, "%s\n", oid_to_hex(oid)))
                return error("problems writing temporary file %s: %s",
                             buf->buf, strerror(errno));
        strbuf_setlen(buf, len);
@@ -299,18 +299,18 @@ static int write_one_ref(const char *name, const unsigned char *sha1,
 }
 
 static int write_refs_to_temp_dir(struct strbuf *temp_dir,
-               int refspec_nr, const char **refspec)
+                                 int refspec_nr, const char **refspec)
 {
        int i;
 
        for (i = 0; i < refspec_nr; i++) {
-               unsigned char sha1[20];
+               struct object_id oid;
                char *ref;
 
-               if (dwim_ref(refspec[i], strlen(refspec[i]), sha1, &ref) != 1)
+               if (dwim_ref(refspec[i], strlen(refspec[i]), oid.hash, &ref) != 1)
                        return error("Could not get ref %s", refspec[i]);
 
-               if (write_one_ref(ref, sha1, 0, temp_dir)) {
+               if (write_one_ref(ref, &oid, 0, temp_dir)) {
                        free(ref);
                        return -1;
                }