Linus Torvalds <[EMAIL PROTECTED]> writes:

> Junio, maybe there should be some test-case for this:
>
>       error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not a 
> commit
>       error: remote ref 'refs/tags/v2.6.11' is not a strict subset of local 
> ref 'refs/tags/v2.6.11'.

I assume this is syncing two linux-2.6 repo which both have the
same refs/tags/v2.6.11 (tree tag).

Sorry, in send_pack(), up-to-date check should be made first
before ref_newer() check.  My mistake.

A more interesting question is what to do if they are indeed
different trees.  More realistically, you may decide to
retroactively create a commit that wraps the same v2.6.11 tree,
perhaps grafting it in front of the current 2.6.12-rcX based
history, and replace 'refs/tags/v2.6.11' with a tag to that
commit.  What should happen?

I do not have a good answer to that.  From the end-user point of
view, we _could_ treat tags differently from heads in that we
always omit the ref_newer() check, but from the machinery point
of view, I think the plumbing should just ask the user to use
the --force when such a tag is involved.

------------
diff --git a/send-pack.c b/send-pack.c
--- a/send-pack.c
+++ b/send-pack.c
@@ -173,6 +173,10 @@ static int send_pack(int in, int out, in
                char old_hex[60], *new_hex;
                if (!ref->peer_ref)
                        continue;
+               if (!memcmp(ref->old_sha1, ref->peer_ref->new_sha1, 20)) {
+                       fprintf(stderr, "'%s': up-to-date\n", ref->name);
+                       continue;
+               }
                if (!is_zero_sha1(ref->old_sha1)) {
                        if (!has_sha1_file(ref->old_sha1)) {
                                error("remote '%s' object %s does not "
@@ -188,10 +192,6 @@ static int send_pack(int in, int out, in
                                continue;
                        }
                }
-               if (!memcmp(ref->old_sha1, ref->peer_ref->new_sha1, 20)) {
-                       fprintf(stderr, "'%s': up-to-date\n", ref->name);
-                       continue;
-               }
                memcpy(ref->new_sha1, ref->peer_ref->new_sha1, 20);
                if (is_zero_sha1(ref->new_sha1)) {
                        error("cannot happen anymore");


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to