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 <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2005-08-05 00:47:56 -07:00
parent b03e2d2091
commit 37fde874c2
4 changed files with 51 additions and 17 deletions

7
tag.c
View File

@ -3,6 +3,13 @@
const char *tag_type = "tag";
struct object *deref_tag(struct object *o)
{
while (o && o->type == tag_type)
o = parse_object(((struct tag *)o)->tagged->sha1);
return o;
}
struct tag *lookup_tag(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);