From e0830b3247541071d867fa34b5635e552d8dff58 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 3 May 2019 14:01:01 -0700 Subject: git-branchmove: factor out $named_remote --- bin/git-branchmove | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin/git-branchmove') 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"; -- cgit v1.2.3