upload-pack: optionally allow fetching reachable sha1
[gitweb.git] / builtin / fetch.c
index 75a55e590bdc3411e5e4aeee6275fbfff4451904..f9512652cf1389a770bd94fd170d123206e024c5 100644 (file)
@@ -415,8 +415,10 @@ static int s_update_ref(const char *action,
 
        transaction = ref_transaction_begin(&err);
        if (!transaction ||
-           ref_transaction_update(transaction, ref->name, ref->new_sha1,
-                                  ref->old_sha1, 0, check_old, msg, &err))
+           ref_transaction_update(transaction, ref->name,
+                                  ref->new_sha1,
+                                  check_old ? ref->old_sha1 : NULL,
+                                  0, msg, &err))
                goto fail;
 
        ret = ref_transaction_commit(transaction, &err);