From: Junio C Hamano Date: Wed, 16 Jan 2013 16:36:01 GMT Subject: Re: [PATCH v6 0/8] push: update remote tags only with force Message-ID: <7vsj61xez2.fsf@alter.siamese.dyndns.org> In-Reply-To: Max Horn writes: > But with next, I get this: > > > ! [rejected] master -> master (already exists) > error: failed to push some refs to '/Users/mhorn/Proje...o_orig' > hint: Updates were rejected because the destination reference already exists > hint: in the remote. > > This looks like a regression to me. It is an outright bug. The new helper function is_forwrdable() is bogus to assume that both original and updated objects can be locally inspected, but you do not necessarily have the original locally. remote.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/remote.c b/remote.c index aa6b719..4a253ef 100644 --- a/remote.c +++ b/remote.c @@ -1286,9 +1286,12 @@ static inline int is_forwardable(struct ref* ref) if (!prefixcmp(ref->name, "refs/tags/")) return 0; - /* old object must be a commit */ + /* + * old object must be a commit, but we may be forcing + * without having it in the first place! + */ o = parse_object(ref->old_sha1); - if (!o || o->type != OBJ_COMMIT) + if (o && o->type != OBJ_COMMIT) return 0; /* new object must be commit-ish */