Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] server-info: do not complain if a tag points at a non-commit.
Date: Thu, 28 Jul 2005 19:24:03 -0700	[thread overview]
Message-ID: <7vr7diqri4.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.58.0507280040380.3227@g5.osdl.org

Linux 2.6 tree has one of those tree tags.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 server-info.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

42fa3ca33f92381a73c08ab98dc4b54e6a6412cc
diff --git a/server-info.c b/server-info.c
--- a/server-info.c
+++ b/server-info.c
@@ -2,6 +2,7 @@
 #include "refs.h"
 #include "object.h"
 #include "commit.h"
+#include "tag.h"
 #include "rev-cache.h"
 
 /* refs */
@@ -518,10 +519,16 @@ static int update_info_packs(int force)
 /* rev-cache */
 static int record_rev_cache_ref(const char *path, const unsigned char *sha1)
 {
-	struct commit *commit;
-	if (!(commit = lookup_commit_reference(sha1)))
-		return error("not a commit: %s", sha1_to_hex(sha1));
-	return record_rev_cache(commit->object.sha1, NULL);
+	struct object *obj = parse_object(sha1);
+
+	if (!obj)
+		return error("ref %s has bad sha %s", path, sha1_to_hex(sha1));
+	while (obj && obj->type == tag_type)
+		obj = parse_object(((struct tag *)obj)->tagged->sha1);
+	if (!obj || obj->type != commit_type)
+		/* tag pointing at a non-commit */
+		return 0;
+	return record_rev_cache(obj->sha1, NULL);
 }
 
 static int update_info_revs(int force)

           reply	other threads:[~2005-07-29  2:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <Pine.LNX.4.58.0507280040380.3227@g5.osdl.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr7diqri4.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox