diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-05-03 15:46:54 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-05-03 15:47:15 -0700 |
commit | 7e80ee06b67e280dd5c234b190e79ea25c067e87 (patch) | |
tree | 278dde548db5806cfaec303b440ecc1518db44ad /bin/git-branchmove | |
parent | 7ec5c5de02388e412e7bd8fe9ce937d9827e3bf9 (diff) | |
download | dotfiles-7e80ee06b67e280dd5c234b190e79ea25c067e87.tar.gz |
git-branchmove: add some insteadOf expansion
Diffstat (limited to 'bin/git-branchmove')
-rwxr-xr-x | bin/git-branchmove | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/git-branchmove b/bin/git-branchmove index c59d936a..e0529697 100755 --- a/bin/git-branchmove +++ b/bin/git-branchmove @@ -25,8 +25,6 @@ # As much as possible we treat the remote argument as opaque, i.e., we # don't distinguish between git URIs and named remotes. That means # that git will expand insteadOf and pushInsteadOf user config for us. -# Some information on the difficulties of getting git to expand these: -# <https://stackoverflow.com/a/32991784> =head1 NAME @@ -99,9 +97,12 @@ my $named_remote = $remote =~ m|:| or $remote =~ m|^[/.]|; # remote HEAD. These regexps are lifted from Ian's script my $rurl, my $rrune, my $rdir; if ($named_remote) { + # this will expand insteadOf and pushInsteadOf $rurl = `git remote get-url --push $remote`; } else { - $rurl = $remote; + # this will expand insteadOf but not pushInsteadOf, which is the + # best we can do; see <https://stackoverflow.com/a/32991784> + $rurl = `git ls-remote --get-url $remote`; } if ($rurl =~ m#^ssh://([^:/]+)(?:\:(\w+))?#) { $rdir = "$'\''"; |