From 37fde874c2448ae2cd98abe24df2bd2a50aa2cda Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 5 Aug 2005 00:47:56 -0700 Subject: Fix send-pack for non-commitish tags. Again I left the v2.6.11-tree tag behind. My bad. This commit makes sure that we do not barf when pushing a ref that is a non-commitish tag. You can update a remote ref under the following conditions: * You can always use --force. * Creating a brand new ref is OK. * If the remote ref is exactly the same as what you are pushing, it is OK (nothing is pushed). * You can replace a commitish with another commitish which is a descendant of it, if you can verify the ancestry between them; this and the above means you have to have what you are replacing. * Otherwise you cannot update; you need to use --force. Signed-off-by: Junio C Hamano --- commit.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'commit.c') diff --git a/commit.c b/commit.c index 6db31651c2..3ac421ac34 100644 --- a/commit.c +++ b/commit.c @@ -48,13 +48,10 @@ static struct commit *check_commit(struct object *obj, const unsigned char *sha1 struct commit *lookup_commit_reference(const unsigned char *sha1) { - struct object *obj = parse_object(sha1); + struct object *obj = deref_tag(parse_object(sha1)); if (!obj) return NULL; - while (obj->type == tag_type) - obj = parse_object(((struct tag *)obj)->tagged->sha1); - return check_commit(obj, sha1); } -- cgit v1.2.3