summaryrefslogtreecommitdiff
path: root/bin/git-branchmove
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git-branchmove')
-rwxr-xr-xbin/git-branchmove5
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";