bundle transport: fix an alloc_ref() call
[gitweb.git] / send-pack.c
index fecbda981b7c6c2504abdd7afb94e35e73e18cce..4533d1bf8ebde7c78a1c7c550ce8feec1870fde0 100644 (file)
@@ -305,22 +305,16 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
                if (remote) {
                        struct refspec rs;
                        rs.src = ref->name;
-                       remote_find_tracking(remote, &rs);
-                       if (rs.dst) {
-                               struct ref_lock *lock;
+                       rs.dst = NULL;
+                       if (!remote_find_tracking(remote, &rs)) {
                                fprintf(stderr, " Also local %s\n", rs.dst);
                                if (will_delete_ref) {
                                        if (delete_ref(rs.dst, NULL)) {
                                                error("Failed to delete");
                                        }
-                               } else {
-                                       lock = lock_any_ref_for_update(rs.dst, NULL, 0);
-                                       if (!lock)
-                                               error("Failed to lock");
-                                       else
-                                               write_ref_sha1(lock, ref->new_sha1,
-                                                              "update by push");
-                               }
+                               } else
+                                       update_ref("update by push", rs.dst,
+                                               ref->new_sha1, NULL, 0, 0);
                                free(rs.dst);
                        }
                }
@@ -426,7 +420,7 @@ int main(int argc, char **argv)
 
        if (remote_name) {
                remote = remote_get(remote_name);
-               if (!remote_has_uri(remote, dest)) {
+               if (!remote_has_url(remote, dest)) {
                        die("Destination %s is not a uri for %s",
                            dest, remote_name);
                }