File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -666,9 +666,22 @@ sub cmd_branch {
666666 }
667667 }
668668 unless (defined $glob ) {
669- die " Unknown " ,
670- $_tag ? " tag" : " branch" ,
671- " destination $_branch_dest\n " ;
669+ my $dest_re = qr /\b\Q $_branch_dest\E\b / ;
670+ foreach my $g (@{$allglobs }) {
671+ $g -> {path }-> {left } =~ / $dest_re / or next ;
672+ if (defined $glob ) {
673+ die " Ambiguous destination: " ,
674+ $_branch_dest, " \n matches both '" ,
675+ $glob -> {path }-> {left }, " ' and '" ,
676+ $g -> {path }-> {left }, " '\n " ;
677+ }
678+ $glob = $g ;
679+ }
680+ unless (defined $glob ) {
681+ die " Unknown " ,
682+ $_tag ? " tag" : " branch" ,
683+ " destination $_branch_dest\n " ;
684+ }
672685 }
673686 }
674687 my ($lft , $rgt ) = @{ $glob -> {path } }{qw/ left right/ };
Original file line number Diff line number Diff line change @@ -99,22 +99,22 @@ test_expect_success 'Multiple branch or tag paths require -d' '
9999
100100test_expect_success ' create new branches and tags' '
101101 ( cd git_project &&
102- git svn branch -m "New branch 1" -d project/ b_one New1 ) &&
102+ git svn branch -m "New branch 1" -d b_one New1 ) &&
103103 ( cd svn_project &&
104104 svn_cmd up && test -e b_one/New1/a.file ) &&
105105
106106 ( cd git_project &&
107- git svn branch -m "New branch 2" -d project/ b_two New2 ) &&
107+ git svn branch -m "New branch 2" -d b_two New2 ) &&
108108 ( cd svn_project &&
109109 svn_cmd up && test -e b_two/New2/a.file ) &&
110110
111111 ( cd git_project &&
112- git svn branch -t -m "New tag 1" -d project/ tags_A Tag1 ) &&
112+ git svn branch -t -m "New tag 1" -d tags_A Tag1 ) &&
113113 ( cd svn_project &&
114114 svn_cmd up && test -e tags_A/Tag1/a.file ) &&
115115
116116 ( cd git_project &&
117- git svn tag -m "New tag 2" -d project/ tags_B Tag2 ) &&
117+ git svn tag -m "New tag 2" -d tags_B Tag2 ) &&
118118 ( cd svn_project &&
119119 svn_cmd up && test -e tags_B/Tag2/a.file )
120120'
You can’t perform that action at this time.
0 commit comments