From: Junio C Hamano Date: Fri, 17 Apr 2020 23:22:06 GMT Subject: Re: What's cooking in git.git (Apr 2020, #01; Wed, 15) Message-ID: In-Reply-To: <20200417220445.sasjy4rvzonoz7cn@doriath> Damien Robert writes: > The difference in remote_get_1 is that > name_given = 1; > So > if (name_given && !valid_remote(ret)) > add_url_alias(ret, name); > gets called. Ah, of course ;-) The code in builtin/push.c rely on being able to pass NULL as the name and rely on current branch getting used; you have to pass the name of the ref you are trying to format %(push) for, so you would trigger add_url_alias(), which says as a fallback that URL for "origin" is "origin" and makes ret->url non-NULL (hence it no longer is !valid_remote() and gets returned). Geez. This is tricky. > But I think that means that my fixup is actually wrong when a pushRemote is > set without a remote while 'origin' do exist. Thanks.