This one has a logic flaw.  The logic outlined in the cover letter
is correct, and the one described in the log message of this one is
not.

We should say "fetch first" only when we do not have old_sha1.


diff --git a/remote.c b/remote.c
index 248910f..8c39ea2 100644
--- a/remote.c
+++ b/remote.c
@@ -1325,10 +1325,10 @@ void set_ref_status_for_push(struct ref *remote_refs, 
int send_mirror,
 
                        if (!prefixcmp(ref->name, "refs/tags/"))
                                ref->status = REF_STATUS_REJECT_ALREADY_EXISTS;
-                       else if (!has_sha1_file(ref->old_sha1) ||
-                                !lookup_commit_reference_gently(ref->old_sha1, 
1))
+                       else if (!has_sha1_file(ref->old_sha1))
                                ref->status = REF_STATUS_REJECT_FETCH_FIRST;
-                       else if (!lookup_commit_reference_gently(ref->new_sha1, 
1))
+                       else if (!lookup_commit_reference_gently(ref->new_sha1, 
1) ||
+                                !lookup_commit_reference_gently(ref->old_sha1, 
1))
                                ref->status = REF_STATUS_REJECT_NEEDS_FORCE;
                        else if (!ref_newer(ref->new_sha1, ref->old_sha1))
                                ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to