Re: [PATCH v6 0/8] push: update remote tags only with force
- From
Jeff King <peff@peff.net>
- Date
- Jan 16, 2013, 16:01 UTC
- Message-ID
- <20130116160131.GB22400@sigill.intra.peff.net>
- In-Reply-To
- <DBF53EC2-A669-4B77-B88E-BFCDF43C862E@quendi.de>
On Wed, Jan 16, 2013 at 02:32:03PM +0100, Max Horn wrote:
Show 7 quoted lines
> With git 1.8.1, I get this message: > > ! [rejected] master -> master (non-fast-forward) > [...] > But with next, I get this: > > ! [rejected] master -> master (already exists)
Thanks for the detailed report. I was able to reproduce easily here.
The problem is the logic in is_forwardable:
static inline int is_forwardable(struct ref* ref)
{
struct object *o; if (!prefixcmp(ref->name, "refs/tags/"))
return 0; /* old object must be a commit */
o = parse_object(ref->old_sha1);
if (!o || o->type != OBJ_COMMIT)
return 0; /* new object must be commit-ish */
o = deref_tag(parse_object(ref->new_sha1), NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;return 1; }
The intent is to allow fast-forward only between objects that both point to commits eventually. But we are doing this check on the client, which does not necessarily have the object for ref->old_sha1 at all. So it cannot know the type, and cannot enforce this condition accurately.
I.e., we trigger the "!o" branch after the parse_object in your example.
-Peff