summaryrefslogtreecommitdiff
path: root/server-info.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-07-28 14:33:17 -0700
committerJunio C Hamano <junkio@cox.net>2005-07-29 00:12:02 -0700
commitb614e3d75730490180f9271cec714a4a8c721636 (patch)
tree09cb67fabff40c1dbc3141abea8a44326afab84a /server-info.c
parent629170973d6fca813a7593c3aac9bb18a8e476a8 (diff)
downloadgit-b614e3d75730490180f9271cec714a4a8c721636.tar.gz
server-info: do not complain if a tag points at a non-commit.
Linux 2.6 tree has one of those tree tags. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'server-info.c')
-rw-r--r--server-info.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/server-info.c b/server-info.c
index 00f8ca0c58..3dd201afb9 100644
--- 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)