Re: [PATCH v6 0/8] push: update remote tags only with force
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 16, 2013, 16:36 UTC
- Message-ID
- <7vsj61xez2.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <DBF53EC2-A669-4B77-B88E-BFCDF43C862E@quendi.de>
Max Horn <max@quendi.de> writes:
Show 9 quoted lines
> 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 */