diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-05-03 14:01:01 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-05-03 14:04:36 -0700 |
commit | e0830b3247541071d867fa34b5635e552d8dff58 (patch) | |
tree | 4a34d3605cf6b9c90653afdb1b1de41c76fdc282 /bin/git-branchmove | |
parent | 8d1573143fcaa5dd814e3ab2fabdd34167145aae (diff) | |
download | dotfiles-e0830b3247541071d867fa34b5635e552d8dff58.tar.gz |
git-branchmove: factor out $named_remote
Diffstat (limited to 'bin/git-branchmove')
-rwxr-xr-x | bin/git-branchmove | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/git-branchmove b/bin/git-branchmove index 0b928285..dc35a0a9 100755 --- a/bin/git-branchmove +++ b/bin/git-branchmove @@ -86,6 +86,9 @@ my ($op, $remote, @patterns) = @ARGV; die "git-branchmove: unknown operation\n" unless ($op eq 'get' or $op eq 'put'); +# is this a named remote or a git URL? +my $named_remote = $remote =~ m|:| or $remote =~ m|^[/.]|; + # If we don't prefix the patterns, we might match branches the user # doesn't intend. E.g. 'foo' would match 'wip/foo' my @branch_pats = map { $_ =~ s|^|[r]efs/heads/|; $_ } @patterns; @@ -155,7 +158,7 @@ if ($op eq 'put') { # if the remote is a named remote, rather than just a URI, update # remote-tracking branches -unless ($remote =~ m|:| or $remote =~ m|^[/.]|) { +unless ($named_remote) { foreach my $source_branch (@source_branches) { my $branch = $source_branch->{ref} =~ s|^refs/heads/||r; my $tracking_ref = "refs/remotes/$remote/$branch"; |