# Tree tags again..

3 messages from 2005-08-05 to 2005-08-05. Participants: Linus Torvalds, Junio C Hamano.
Thread: https://gitlist.dev/t/1424

## Linus Torvalds, 2005-08-05 00:03

Subject: Tree tags again..
Message-ID: <Pine.LNX.4.58.0508041702180.3258@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0508041702180.3258%40g5.osdl.org

```

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'.
	error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not a commit
	error: remote ref 'refs/tags/v2.6.11-tree' is not a strict subset of local ref 'refs/tags/v2.6.11-tree'.

Hmm?

		Linus

```

## Junio C Hamano, 2005-08-05 00:17

Subject: Re: Tree tags again..
Message-ID: <7vu0i5qlsc.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vu0i5qlsc.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.58.0508041702180.3258@g5.osdl.org>

```
Linus Torvalds <torvalds@osdl.org> 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");

```

## Junio C Hamano, 2005-08-05 09:16

Subject: Re: Tree tags again..
Message-ID: <7virykn3p3.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7virykn3p3.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.58.0508041702180.3258@g5.osdl.org>

```
Sorry about the breakage.  I pushed out a fix.

Since you always give me hard time with this "tree-tag", I
decided to trump it with an even weirder tag myself.  We will
see what else would break shortly ;-).

```
