Hello Ian,

On Thu 02 May 2019 at 08:17PM +01, Ian Jackson wrote:

> Hi.  I'm not sure why are are treating these two cases so differently.
> The purpose the case statement is solely to try to avoid calling "git
> config" on things which are not remote names.
>
> But in both cases we want pushInsteadOf if there is one, I think ?
> (Ie, even for the source branch and even when it's not a configured
> remote.)  Is that possible DYK ?
>
> Hrm.  I tried git-ls-remote and it doesn't seem to have a --push.  And
> git-remote doesn't work on things that aren't configured remotes.
>
> Is that what you meant by "Beginnings of" ?

We do indeed want to expand pushInsteadOf in both cases.  However,
AFAICT, the only way to have git expand pushInsteadOf is `git remote
get-url --push`.  See [1].

My diff improves the situation by fixing things when there is insteadOf
but no pushInsteadOf in the user's config, but it is not a complete fix,
hence "Beginnings of".

Perhaps a complete fix would have to be something like

    git remote add dummyOnlyWeUseThis $remote
    remote=$(git remote get-url --push dummyOnlyWeUseThis)
    git remote remove dummyOnlyWeUseThis

... which is pretty awful.

~ ~ ~ ~

I wanted to fix both this bug and #914399, but I found that #914399
would require basically rewriting git-branchmove, because the assumption
of shell access to the remote is baked pretty deeply into the script.

So I decided just to rewrite git-branchmove, this time in Perl, thereby
fixing both #914398 and #914399.  You can find my mostly untested work
at [2].  Once I've been using it successfully for a while, I was
thinking of proposing that it replace git-branchmove in chiark-utils.

Reading the logic of your script made it pretty straightforward and less
time-consuming to write mine :)

[1]  https://stackoverflow.com/a/32991784
[2]  https://git.spwhitton.name/dotfiles/tree/bin/git-branchmove

-- 
Sean Whitton

Attachment: signature.asc
Description: PGP signature

Reply via email to