threads / discuss / 1424

Tree tags again..

Subject: Tree tags again..

## tl;dr

3 messages between Aug 5, 2005 and Aug 5, 2005.

replies: 2people: 2as markdown or json

Linus Torvalds· Aug 5, 2005, 00:03 UTC · lore
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· Aug 5, 2005, 00:17 UTC · re: Linus Torvalds · lore

Re: Tree tags again..

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· Aug 5, 2005, 09:16 UTC · re: Linus Torvalds · lore

Re: Tree tags again..

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 ;-).

← back to recent threads