{"thread":{"id":"14865","subject":"[PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs","startedAt":"2008-08-06T19:58:20Z","lastAt":"2008-08-09T07:48:38Z","messageCount":14,"participants":["Marcus Griep","Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"86367","messageId":"489A025C.50507@griep.us","threadId":"14865","inReplyTo":null,"subject":"[PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-06T19:58:20Z","receivedAt":"2008-08-06T19:58:20Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"From 3b95061c8d19b2285cdbf94001f3b718c8264c32 Mon Sep 17 00:00:00 2001\nFrom: Marcus Griep <marcus@griep.us>\nDate: Tue, 5 Aug 2008 15:13:20 -0400\nSubject: [PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs\n\nSome repositories use a deep branching strategy, such as:\nbranches/1.0/1.0.rc1\nbranches/1.0/1.0.rc2\nbranches/1.0/1.0.rtm\nbranches/1.0/1.0.gold\n\nOnly allowing a single glob stiffles this.\n\nThis change allows for a single glob 'set' to accept this deep branching\nstrategy.\n\nThe ref glob depth must match the branch glob depth.  When using the -b or -t\noptions for init or clone, this is automatically done.\n\nFor example, using the above branches:\n  svn-remote.svn.branches = branches/*/*:refs/remote/*/*\ngives the following branch names:\n  1.0/1.0.rc1\n  1.0/1.0.rc2\n  1.0/1.0.rtm\n  1.0/1.0.gold\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n git-svn.perl                               |   53 +++++++---\n t/t9108-git-svn-glob.sh                    |    9 +-\n t/t9108-git-svn-multi-glob.sh              |  155 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   40 +++++++\n 4 files changed, 238 insertions(+), 19 deletions(-)\n create mode 100755 t/t9108-git-svn-multi-glob.sh\n create mode 100755 t/t9125-git-svn-multi-glob-branch-names.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 95d11c2..dc80c56 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -981,7 +981,7 @@ sub complete_url_ls_init {\n                die \"--prefix='$pfx' must have a trailing slash '/'\\n\";\n        }\n        command_noisy('config', \"svn-remote.$gs->{repo_id}.$n\",\n-                               \"$remote_path:refs/remotes/$pfx*\");\n+                               \"$remote_path:refs/remotes/$pfx*\" . ('/*' x (($remote_path =~ tr/*/*/)-1)));\n }\n\n sub verify_ref {\n@@ -4113,16 +4113,35 @@ sub gs_fetch_loop_common {\n        Git::SVN::gc();\n }\n\n+sub get_dir_globbed {\n+       my ($self, $left, $depth, $r) = @_;\n+\n+       my @x = eval { $self->get_dir($left, $r) };\n+       return unless scalar @x == 3;\n+       my $dirents = $x[0];\n+       my @finalents;\n+       foreach my $de (keys %$dirents) {\n+               next if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+               if ($depth > 1) {\n+                       foreach my $dir ($self->get_dir_globbed($left.'/'.$de, $depth - 1, $r)) {\n+                               push @finalents, \"$de/$dir\";\n+                       }\n+               } else {\n+                       push @finalents, $de;\n+               }\n+       }\n+       @finalents;\n+}\n+\n sub match_globs {\n        my ($self, $exists, $paths, $globs, $r) = @_;\n\n        sub get_dir_check {\n                my ($self, $exists, $g, $r) = @_;\n-               my @x = eval { $self->get_dir($g->{path}->{left}, $r) };\n-               return unless scalar @x == 3;\n-               my $dirents = $x[0];\n-               foreach my $de (keys %$dirents) {\n-                       next if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\n+               my @dirs = $self->get_dir_globbed($g->{path}->{left}, $g->{path}->{depth}, $r);\n+\n+               foreach my $de (@dirs) {\n                        my $p = $g->{path}->full_path($de);\n                        next if $exists->{$p};\n                        next if (length $g->{path}->{right} &&\n@@ -4904,16 +4923,20 @@ sub new {\n        my ($class, $glob) = @_;\n        my $re = $glob;\n        $re =~ s!/+$!!g; # no need for trailing slashes\n-       my $nr = $re =~ tr/*/*/;\n-       if ($nr > 1) {\n-               die \"Only one '*' wildcard expansion \",\n-                   \"is supported (got $nr): '$glob'\\n\";\n-       } elsif ($nr == 0) {\n+       $re =~ m!^([^*]*)(\\*(?:/\\*)*)([^*]*)$!;\n+       my $temp = $re;\n+       my ($left, $right) = ($1, $3);\n+       $re = $2;\n+       my $depth = $re =~ tr/*/*/;\n+       if ($depth != $temp =~ tr/*/*/) {\n+               die \"Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: '$glob'\\n\";\n+       }\n+       if ($depth == 0) {\n                die \"One '*' is needed for glob: '$glob'\\n\";\n        }\n-       $re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n-       my ($left, $right) = ($1, $2);\n-       $re = quotemeta($left) . $re . quotemeta($right);\n+       $re =~ s!\\*!\\[^/\\]*!g;\n+#      $re =~ s!\\?!\\[^/\\]!g;\n+       $re = quotemeta($left) . \"($re)\" . quotemeta($right);\n        if (length $left && !($left =~ s!/+$!!g)) {\n                die \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\n        }\n@@ -4922,7 +4945,7 @@ sub new {\n        }\n        my $left_re = qr/^\\/\\Q$left\\E(\\/|$)/;\n        bless { left => $left, right => $right, left_regex => $left_re,\n-               regex => qr/$re/, glob => $glob }, $class;\n+               regex => qr/$re/, glob => $glob, depth => $depth }, $class;\n }\n\n sub full_path {\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex ef6d88e..46958e5 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -52,7 +52,8 @@ test_expect_success 'test refspec globbing' '\n        test \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n                \"`git rev-parse refs/remotes/branches/start`\" &&\n        test \"`git rev-parse refs/remotes/branches/start~2`\" = \\\n-               \"`git rev-parse refs/remotes/trunk`\"\n+               \"`git rev-parse refs/remotes/trunk`\" &&\n+       test_must_fail git rev-parse refs/remotes/tags/end@3\n        '\n\n echo try to try > expect.two\n@@ -83,14 +84,14 @@ test_expect_success 'test left-hand-side only globbing' '\n        cmp expect.two output.two\n        '\n\n-echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" > expect.three\n+echo \"Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n echo \"\" >> expect.three\n\n-test_expect_success 'test disallow multi-globs' '\n+test_expect_success 'test disallow multiple globs' '\n        git config --add svn-remote.three.url \"$svnrepo\" &&\n        git config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&\n        git config --add svn-remote.three.branches \\\n-                        \"branches/*/*:refs/remotes/three/branches/*\" &&\n+                        \"branches/*/t/*:refs/remotes/three/branches/*\" &&\n        git config --add svn-remote.three.tags \\\n                         \"tags/*/*:refs/remotes/three/tags/*\" &&\n        cd tmp &&\ndiff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh\nnew file mode 100755\nindex 0000000..1d80cb1\n--- /dev/null\n+++ b/t/t9108-git-svn-multi-glob.sh\n@@ -0,0 +1,155 @@\n+#!/bin/sh\n+# Copyright (c) 2007 Eric Wong\n+test_description='git-svn globbing refspecs'\n+. ./lib-git-svn.sh\n+\n+cat > expect.end <<EOF\n+the end\n+hi\n+start a new branch\n+initial\n+EOF\n+\n+test_expect_success 'test refspec globbing' '\n+       mkdir -p trunk/src/a trunk/src/b trunk/doc &&\n+       echo \"hello world\" > trunk/src/a/readme &&\n+       echo \"goodbye world\" > trunk/src/b/readme &&\n+       svn import -m \"initial\" trunk \"$svnrepo\"/trunk &&\n+       svn co \"$svnrepo\" tmp &&\n+       cd tmp &&\n+               mkdir branches branches/v1 tags &&\n+               svn add branches tags &&\n+               svn cp trunk branches/v1/start &&\n+               svn commit -m \"start a new branch\" &&\n+               svn up &&\n+               echo \"hi\" >> branches/v1/start/src/b/readme &&\n+               poke branches/v1/start/src/b/readme &&\n+               echo \"hey\" >> branches/v1/start/src/a/readme &&\n+               poke branches/v1/start/src/a/readme &&\n+               svn commit -m \"hi\" &&\n+               svn up &&\n+               svn cp branches/v1/start tags/end &&\n+               echo \"bye\" >> tags/end/src/b/readme &&\n+               poke tags/end/src/b/readme &&\n+               echo \"aye\" >> tags/end/src/a/readme &&\n+               poke tags/end/src/a/readme &&\n+               svn commit -m \"the end\" &&\n+               echo \"byebye\" >> tags/end/src/b/readme &&\n+               poke tags/end/src/b/readme &&\n+               svn commit -m \"nothing to see here\"\n+               cd .. &&\n+       git config --add svn-remote.svn.url \"$svnrepo\" &&\n+       git config --add svn-remote.svn.fetch \\\n+                        \"trunk/src/a:refs/remotes/trunk\" &&\n+       git config --add svn-remote.svn.branches \\\n+                        \"branches/*/*/src/a:refs/remotes/branches/*/*\" &&\n+       git config --add svn-remote.svn.tags\\\n+                        \"tags/*/src/a:refs/remotes/tags/*\" &&\n+       git-svn multi-fetch &&\n+       git log --pretty=oneline refs/remotes/tags/end | \\\n+           sed -e \"s/^.\\{41\\}//\" > output.end &&\n+       cmp expect.end output.end &&\n+       test \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n+               \"`git rev-parse refs/remotes/branches/v1/start`\" &&\n+       test \"`git rev-parse refs/remotes/branches/v1/start~2`\" = \\\n+               \"`git rev-parse refs/remotes/trunk`\" &&\n+       test_must_fail git rev-parse refs/remotes/tags/end@3\n+       '\n+\n+echo try to try > expect.two\n+echo nothing to see here >> expect.two\n+cat expect.end >> expect.two\n+\n+test_expect_success 'test left-hand-side only globbing' '\n+       git config --add svn-remote.two.url \"$svnrepo\" &&\n+       git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&\n+       git config --add svn-remote.two.branches \\\n+                        \"branches/*/*:refs/remotes/two/branches/*/*\" &&\n+       git config --add svn-remote.two.tags \\\n+                        \"tags/*:refs/remotes/two/tags/*\" &&\n+       cd tmp &&\n+               echo \"try try\" >> tags/end/src/b/readme &&\n+               poke tags/end/src/b/readme &&\n+               svn commit -m \"try to try\"\n+               cd .. &&\n+       git-svn fetch two &&\n+       test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&\n+       test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&\n+       test `git rev-parse refs/remotes/two/branches/v1/start~2` = \\\n+            `git rev-parse refs/remotes/two/trunk` &&\n+       test `git rev-parse refs/remotes/two/tags/end~3` = \\\n+            `git rev-parse refs/remotes/two/branches/v1/start` &&\n+       git log --pretty=oneline refs/remotes/two/tags/end | \\\n+           sed -e \"s/^.\\{41\\}//\" > output.two &&\n+       cmp expect.two output.two\n+       '\n+cat > expect.four <<EOF\n+adios\n+adding more\n+Changed 2 in v2/start\n+Another versioned branch\n+initial\n+EOF\n+\n+test_expect_success 'test another branch' '\n+       (\n+               cd tmp &&\n+               mkdir branches/v2 &&\n+               svn add branches/v2 &&\n+               svn cp trunk branches/v2/start &&\n+               svn commit -m \"Another versioned branch\" &&\n+               svn up &&\n+               echo \"hello\" >> branches/v2/start/src/b/readme &&\n+               poke branches/v2/start/src/b/readme &&\n+               echo \"howdy\" >> branches/v2/start/src/a/readme &&\n+               poke branches/v2/start/src/a/readme &&\n+               svn commit -m \"Changed 2 in v2/start\" &&\n+               svn up &&\n+               svn cp branches/v2/start tags/next &&\n+               echo \"bye\" >> tags/next/src/b/readme &&\n+               poke tags/next/src/b/readme &&\n+               echo \"aye\" >> tags/next/src/a/readme &&\n+               poke tags/next/src/a/readme &&\n+               svn commit -m \"adding more\" &&\n+               echo \"byebye\" >> tags/next/src/b/readme &&\n+               poke tags/next/src/b/readme &&\n+               svn commit -m \"adios\"\n+       ) &&\n+       git config --add svn-remote.four.url \"$svnrepo\" &&\n+       git config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk &&\n+       git config --add svn-remote.four.branches \\\n+                        \"branches/*/*:refs/remotes/four/branches/*/*\" &&\n+       git config --add svn-remote.four.tags \\\n+                        \"tags/*:refs/remotes/four/tags/*\" &&\n+       git-svn fetch four &&\n+       test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&\n+       test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&\n+       test `git rev-parse refs/remotes/four/branches/v2/start~2` = \\\n+            `git rev-parse refs/remotes/four/trunk` &&\n+       test `git rev-parse refs/remotes/four/tags/next~2` = \\\n+            `git rev-parse refs/remotes/four/branches/v2/start` &&\n+       git log --pretty=oneline refs/remotes/four/tags/next | \\\n+           sed -e \"s/^.\\{41\\}//\" > output.four &&\n+       cmp expect.four output.four\n+       '\n+\n+echo \"Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multiple globs' '\n+       git config --add svn-remote.three.url \"$svnrepo\" &&\n+       git config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&\n+       git config --add svn-remote.three.branches \\\n+                        \"branches/*/t/*:refs/remotes/three/branches/*/*\" &&\n+       git config --add svn-remote.three.tags \\\n+                        \"tags/*:refs/remotes/three/tags/*\" &&\n+       cd tmp &&\n+               echo \"try try\" >> tags/end/src/b/readme &&\n+               poke tags/end/src/b/readme &&\n+               svn commit -m \"try to try\"\n+               cd .. &&\n+       test_must_fail git-svn fetch three &> stderr.three &&\n+       cmp expect.three stderr.three\n+       '\n+\n+test_done\ndiff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh\nnew file mode 100755\nindex 0000000..f7c7836\n--- /dev/null\n+++ b/t/t9125-git-svn-multi-glob-branch-names.sh\n@@ -0,0 +1,40 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Eric Wong\n+#\n+\n+test_description='git-svn multi-glob branch names'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup svnrepo' '\n+       mkdir project project/trunk project/branches project/branches/v14.1 project/tags &&\n+       echo foo > project/trunk/foo &&\n+       svn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+       rm -rf project &&\n+       svn cp -m \"fun\" \"$svnrepo/project/trunk\" \\\n+                       \"$svnrepo/project/branches/v14.1/beta\" &&\n+       svn cp -m \"more fun!\" \"$svnrepo/project/branches/v14.1/beta\" \\\n+                             \"$svnrepo/project/branches/v14.1/gold\" &&\n+       start_httpd\n+       '\n+\n+test_expect_success 'test clone with multi-glob in branch names' '\n+       git svn clone -T trunk -b branches/*/* -t tags \"$svnrepo/project\" project &&\n+       cd project &&\n+               git rev-parse \"refs/remotes/v14.1/beta\" &&\n+               git rev-parse \"refs/remotes/v14.1/gold\" &&\n+       cd ..\n+       '\n+\n+test_expect_success 'test dcommit to multi-globbed branch' \"\n+       cd project &&\n+       git reset --hard 'refs/remotes/v14.1/gold' &&\n+       echo hello >> foo &&\n+       git commit -m 'hello' -- foo &&\n+       git svn dcommit &&\n+       cd ..\n+       \"\n+\n+stop_httpd\n+\n+test_done\n--\n1.5.4.3\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n"},{"id":"86406","messageId":"20080807090008.GA9161@untitled","threadId":"14865","inReplyTo":"489A025C.50507@griep.us","subject":"Re: [PATCH 2/2] git-svn: Allow deep branch names by supporting multi-globs","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-07T09:00:08Z","receivedAt":"2008-08-07T09:00:08Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marcus Griep <marcus@griep.us> wrote:\n> Some repositories use a deep branching strategy, such as:\n> branches/1.0/1.0.rc1\n> branches/1.0/1.0.rc2\n> branches/1.0/1.0.rtm\n> branches/1.0/1.0.gold\n> \n> Only allowing a single glob stiffles this.\n> \n> This change allows for a single glob 'set' to accept this deep branching\n> strategy.\n> \n> The ref glob depth must match the branch glob depth.  When using the -b or -t\n> options for init or clone, this is automatically done.\n> \n> For example, using the above branches:\n>   svn-remote.svn.branches = branches/*/*:refs/remote/*/*\n> gives the following branch names:\n>   1.0/1.0.rc1\n>   1.0/1.0.rc2\n>   1.0/1.0.rtm\n>   1.0/1.0.gold\n\nHi Marcus,\n\nThis looks awesome.  Some folks have been wanting to do this for a\nlong time but I was always too lazy to touch this code.\n\nUnfortunately, I'm having trouble applying your patches due to\nwhitespace conversion issues with your MUA.  I suggest taking a look at\nDocumentation/SubmittingPatches on how to submit easily applyable\npatches to the mailing list.\n\nI usually use git-send-email myself, but sometimes mutt, too.\n\nAlso, there are some long lines that need to be wrapped at\n80 characters or less to conform to the existing coding\nconventions.\n\nI look forward to applying and testing your patches,\n\nThank you!\n\n-- \nEric Wong\n"},{"id":"86421","messageId":"1218123242-26260-1-git-send-email-marcus@griep.us","threadId":"14865","inReplyTo":"20080807090008.GA9161@untitled","subject":"[PATCH v2 0/2] git-svn multi-glob fix and extension","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-07T15:34:00Z","receivedAt":"2008-08-07T15:34:00Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"\nThis patch series fixes and extends globs for branches and tags.\n\nThe first patch fixes the assertion that protects git-svn from allowing\nmulti-globs in branch names, whereas the second removes that restriction\naltogether, allowing up to one multi-glob set in defining a branch hierarchy.\n\nAlso, patches are now under 80 chars wide except for a couple of echos in the\ntest cases.\n\nMarcus Griep (2):\n      Fix multi-glob assertion in git-svn\n      git-svn: Allow deep branch names by supporting multi-globs\n\n git-svn.perl                               |   63 +++++++++---\n t/t9108-git-svn-glob.sh                    |   22 ++++-\n t/t9108-git-svn-multi-glob.sh              |  155 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   41 ++++++++\n 4 files changed, 264 insertions(+), 17 deletions(-)\n"},{"id":"86419","messageId":"1218123242-26260-2-git-send-email-marcus@griep.us","threadId":"14865","inReplyTo":"1218123242-26260-1-git-send-email-marcus@griep.us","subject":"[PATCH v2 1/2] Fix multi-glob assertion in git-svn","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-07T15:34:01Z","receivedAt":"2008-08-07T15:34:01Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Fixes bad regex match check for multiple globs (would always return\none glob regardless of actual number).\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n git-svn.perl            |    5 +++--\n t/t9108-git-svn-glob.sh |   19 +++++++++++++++++++\n 2 files changed, 22 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex df0ed90..5974a06 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4912,14 +4912,15 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = ($re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g);\n-\tmy ($left, $right) = ($1, $2);\n+\tmy $nr = $re =~ tr/*/*/;\n \tif ($nr > 1) {\n \t\tdie \"Only one '*' wildcard expansion \",\n \t\t    \"is supported (got $nr): '$glob'\\n\";\n \t} elsif ($nr == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n+\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n+\tmy ($left, $right) = ($1, $2);\n \t$re = quotemeta($left) . $re . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex f6f71d0..ef6d88e 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -83,4 +83,23 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n+echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multi-globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three &> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n test_done\n-- \n1.6.0.rc2.4.g39f8\n"},{"id":"86420","messageId":"1218123242-26260-3-git-send-email-marcus@griep.us","threadId":"14865","inReplyTo":"1218123242-26260-2-git-send-email-marcus@griep.us","subject":"[PATCH v2 2/2] git-svn: Allow deep branch names by supporting multi-globs","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-07T15:34:02Z","receivedAt":"2008-08-07T15:34:02Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Some repositories use a deep branching strategy, such as:\nbranches/1.0/1.0.rc1\nbranches/1.0/1.0.rc2\nbranches/1.0/1.0.rtm\nbranches/1.0/1.0.gold\n\nOnly allowing a single glob stiffles this.\n\nThis change allows for a single glob 'set' to accept this deep branching\nstrategy.\n\nThe ref glob depth must match the branch glob depth.  When using the -b or -t\noptions for init or clone, this is automatically done.\n\nFor example, using the above branches:\n  svn-remote.svn.branches = branches/*/*:refs/remote/*/*\ngives the following branch names:\n  1.0/1.0.rc1\n  1.0/1.0.rc2\n  1.0/1.0.rtm\n  1.0/1.0.gold\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n git-svn.perl                               |   64 +++++++++---\n t/t9108-git-svn-glob.sh                    |    9 +-\n t/t9108-git-svn-multi-glob.sh              |  155 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   41 ++++++++\n 4 files changed, 248 insertions(+), 21 deletions(-)\n create mode 100755 t/t9108-git-svn-multi-glob.sh\n create mode 100755 t/t9125-git-svn-multi-glob-branch-names.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 5974a06..fe78461 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -169,7 +169,8 @@ my %cmd = (\n \t\t\t  'color' => \\$Git::SVN::Log::color,\n \t\t\t  'pager=s' => \\$Git::SVN::Log::pager\n \t\t\t} ],\n-\t'find-rev' => [ \\&cmd_find_rev, \"Translate between SVN revision numbers and tree-ish\",\n+\t'find-rev' => [ \\&cmd_find_rev, \n+\t\t\t\t   \"Translate between SVN revision numbers and tree-ish\",\n \t\t\t{} ],\n \t'rebase' => [ \\&cmd_rebase, \"Fetch and rebase your working directory\",\n \t\t\t{ 'merge|m|M' => \\$_merge,\n@@ -229,7 +230,9 @@ unless ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n \n read_repo_config(\\%opts);\n-Getopt::Long::Configure('pass_through') if ($cmd && ($cmd eq 'log' || $cmd eq 'blame'));\n+if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n+\tGetopt::Long::Configure('pass_through');\n+}\n my $rv = GetOptions(%opts, 'help|H|h' => \\$_help, 'version|V' => \\$_version,\n                     'minimize-connections' => \\$Git::SVN::Migration::_minimize,\n                     'id|i=s' => \\$Git::SVN::default_ref_id,\n@@ -985,7 +988,7 @@ sub complete_url_ls_init {\n \t\tdie \"--prefix='$pfx' must have a trailing slash '/'\\n\";\n \t}\n \tcommand_noisy('config', \"svn-remote.$gs->{repo_id}.$n\",\n-\t\t\t\t\"$remote_path:refs/remotes/$pfx*\");\n+\t\t\t\t\"$remote_path:refs/remotes/$pfx*\" . ('/*' x (($remote_path =~ tr/*/*/)-1)));\n }\n \n sub verify_ref {\n@@ -4121,16 +4124,38 @@ sub gs_fetch_loop_common {\n \tGit::SVN::gc();\n }\n \n+sub get_dir_globbed {\n+\tmy ($self, $left, $depth, $r) = @_;\n+\n+\tmy @x = eval { $self->get_dir($left, $r) };\n+\treturn unless scalar @x == 3;\n+\tmy $dirents = $x[0];\n+\tmy @finalents;\n+\tforeach my $de (keys %$dirents) {\n+\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\t\tif ($depth > 1) {\n+\t\t\tforeach my $dir ($self->get_dir_globbed($left.'/'.$de, $depth - 1, $r)) {\n+\t\t\t\tpush @finalents, \"$de/$dir\";\n+\t\t\t}\n+\t\t} else {\n+\t\t\tpush @finalents, $de;\n+\t\t}\n+\t}\n+\t@finalents;\n+}\n+\n sub match_globs {\n \tmy ($self, $exists, $paths, $globs, $r) = @_;\n \n \tsub get_dir_check {\n \t\tmy ($self, $exists, $g, $r) = @_;\n-\t\tmy @x = eval { $self->get_dir($g->{path}->{left}, $r) };\n-\t\treturn unless scalar @x == 3;\n-\t\tmy $dirents = $x[0];\n-\t\tforeach my $de (keys %$dirents) {\n-\t\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\n+\t\tmy @dirs = $self->get_dir_globbed(\n+\t\t\t\t\t\t\t$g->{path}->{left}, \n+\t\t\t\t\t\t\t$g->{path}->{depth}, \n+\t\t\t\t\t\t\t$r);\n+\n+\t\tforeach my $de (@dirs) {\n \t\t\tmy $p = $g->{path}->full_path($de);\n \t\t\tnext if $exists->{$p};\n \t\t\tnext if (length $g->{path}->{right} &&\n@@ -4912,16 +4937,21 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = $re =~ tr/*/*/;\n-\tif ($nr > 1) {\n-\t\tdie \"Only one '*' wildcard expansion \",\n-\t\t    \"is supported (got $nr): '$glob'\\n\";\n-\t} elsif ($nr == 0) {\n+\t$re =~ m!^([^*]*)(\\*(?:/\\*)*)([^*]*)$!;\n+\tmy $temp = $re;\n+\tmy ($left, $right) = ($1, $3);\n+\t$re = $2;\n+\tmy $depth = $re =~ tr/*/*/;\n+\tif ($depth != $temp =~ tr/*/*/) {\n+\t\tdie \"Only one set of wildcard directories \" .\n+\t\t\t\"(e.g. '*' or '*/*/*') is supported: '$glob'\\n\";\n+\t}\n+\tif ($depth == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n-\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n-\tmy ($left, $right) = ($1, $2);\n-\t$re = quotemeta($left) . $re . quotemeta($right);\n+\t$re =~ s!\\*!\\[^/\\]*!g;\n+#\t$re =~ s!\\?!\\[^/\\]!g;\n+\t$re = quotemeta($left) . \"($re)\" . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\n \t}\n@@ -4930,7 +4960,7 @@ sub new {\n \t}\n \tmy $left_re = qr/^\\/\\Q$left\\E(\\/|$)/;\n \tbless { left => $left, right => $right, left_regex => $left_re,\n-\t        regex => qr/$re/, glob => $glob }, $class;\n+\t        regex => qr/$re/, glob => $glob, depth => $depth }, $class;\n }\n \n sub full_path {\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex ef6d88e..46958e5 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -52,7 +52,8 @@ test_expect_success 'test refspec globbing' '\n \ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n \t\t\"`git rev-parse refs/remotes/branches/start`\" &&\n \ttest \"`git rev-parse refs/remotes/branches/start~2`\" = \\\n-\t\t\"`git rev-parse refs/remotes/trunk`\"\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n \t'\n \n echo try to try > expect.two\n@@ -83,14 +84,14 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n-echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" > expect.three\n+echo \"Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n echo \"\" >> expect.three\n \n-test_expect_success 'test disallow multi-globs' '\n+test_expect_success 'test disallow multiple globs' '\n \tgit config --add svn-remote.three.url \"$svnrepo\" &&\n \tgit config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&\n \tgit config --add svn-remote.three.branches \\\n-\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*\" &&\n \tgit config --add svn-remote.three.tags \\\n \t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n \tcd tmp &&\ndiff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh\nnew file mode 100755\nindex 0000000..1d80cb1\n--- /dev/null\n+++ b/t/t9108-git-svn-multi-glob.sh\n@@ -0,0 +1,155 @@\n+#!/bin/sh\n+# Copyright (c) 2007 Eric Wong\n+test_description='git-svn globbing refspecs'\n+. ./lib-git-svn.sh\n+\n+cat > expect.end <<EOF\n+the end\n+hi\n+start a new branch\n+initial\n+EOF\n+\n+test_expect_success 'test refspec globbing' '\n+\tmkdir -p trunk/src/a trunk/src/b trunk/doc &&\n+\techo \"hello world\" > trunk/src/a/readme &&\n+\techo \"goodbye world\" > trunk/src/b/readme &&\n+\tsvn import -m \"initial\" trunk \"$svnrepo\"/trunk &&\n+\tsvn co \"$svnrepo\" tmp &&\n+\tcd tmp &&\n+\t\tmkdir branches branches/v1 tags &&\n+\t\tsvn add branches tags &&\n+\t\tsvn cp trunk branches/v1/start &&\n+\t\tsvn commit -m \"start a new branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hi\" >> branches/v1/start/src/b/readme &&\n+\t\tpoke branches/v1/start/src/b/readme &&\n+\t\techo \"hey\" >> branches/v1/start/src/a/readme &&\n+\t\tpoke branches/v1/start/src/a/readme &&\n+\t\tsvn commit -m \"hi\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v1/start tags/end &&\n+\t\techo \"bye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\techo \"aye\" >> tags/end/src/a/readme &&\n+\t\tpoke tags/end/src/a/readme &&\n+\t\tsvn commit -m \"the end\" &&\n+\t\techo \"byebye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"nothing to see here\"\n+\t\tcd .. &&\n+\tgit config --add svn-remote.svn.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.svn.fetch \\\n+\t                 \"trunk/src/a:refs/remotes/trunk\" &&\n+\tgit config --add svn-remote.svn.branches \\\n+\t                 \"branches/*/*/src/a:refs/remotes/branches/*/*\" &&\n+\tgit config --add svn-remote.svn.tags\\\n+\t                 \"tags/*/src/a:refs/remotes/tags/*\" &&\n+\tgit-svn multi-fetch &&\n+\tgit log --pretty=oneline refs/remotes/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.end &&\n+\tcmp expect.end output.end &&\n+\ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n+\t\t\"`git rev-parse refs/remotes/branches/v1/start`\" &&\n+\ttest \"`git rev-parse refs/remotes/branches/v1/start~2`\" = \\\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n+\t'\n+\n+echo try to try > expect.two\n+echo nothing to see here >> expect.two\n+cat expect.end >> expect.two\n+\n+test_expect_success 'test left-hand-side only globbing' '\n+\tgit config --add svn-remote.two.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&\n+\tgit config --add svn-remote.two.branches \\\n+\t                 \"branches/*/*:refs/remotes/two/branches/*/*\" &&\n+\tgit config --add svn-remote.two.tags \\\n+\t                 \"tags/*:refs/remotes/two/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\tgit-svn fetch two &&\n+\ttest `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&\n+\ttest `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/two/branches/v1/start~2` = \\\n+\t     `git rev-parse refs/remotes/two/trunk` &&\n+\ttest `git rev-parse refs/remotes/two/tags/end~3` = \\\n+\t     `git rev-parse refs/remotes/two/branches/v1/start` &&\n+\tgit log --pretty=oneline refs/remotes/two/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.two &&\n+\tcmp expect.two output.two\n+\t'\n+cat > expect.four <<EOF\n+adios\n+adding more\n+Changed 2 in v2/start\n+Another versioned branch\n+initial\n+EOF\n+\n+test_expect_success 'test another branch' '\n+\t(\n+\t\tcd tmp &&\n+\t\tmkdir branches/v2 &&\n+\t\tsvn add branches/v2 &&\n+\t\tsvn cp trunk branches/v2/start &&\n+\t\tsvn commit -m \"Another versioned branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hello\" >> branches/v2/start/src/b/readme &&\n+\t\tpoke branches/v2/start/src/b/readme &&\n+\t\techo \"howdy\" >> branches/v2/start/src/a/readme &&\n+\t\tpoke branches/v2/start/src/a/readme &&\n+\t\tsvn commit -m \"Changed 2 in v2/start\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v2/start tags/next &&\n+\t\techo \"bye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\techo \"aye\" >> tags/next/src/a/readme &&\n+\t\tpoke tags/next/src/a/readme &&\n+\t\tsvn commit -m \"adding more\" &&\n+\t\techo \"byebye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\tsvn commit -m \"adios\"\n+\t) &&\n+\tgit config --add svn-remote.four.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk &&\n+\tgit config --add svn-remote.four.branches \\\n+\t                 \"branches/*/*:refs/remotes/four/branches/*/*\" &&\n+\tgit config --add svn-remote.four.tags \\\n+\t                 \"tags/*:refs/remotes/four/tags/*\" &&\n+\tgit-svn fetch four &&\n+\ttest `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&\n+\ttest `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/four/branches/v2/start~2` = \\\n+\t     `git rev-parse refs/remotes/four/trunk` &&\n+\ttest `git rev-parse refs/remotes/four/tags/next~2` = \\\n+\t     `git rev-parse refs/remotes/four/branches/v2/start` &&\n+\tgit log --pretty=oneline refs/remotes/four/tags/next | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.four &&\n+\tcmp expect.four output.four\n+\t'\n+\n+echo \"Only one set of wildcard directories (e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multiple globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three &> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n+test_done\ndiff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh\nnew file mode 100755\nindex 0000000..5560db0\n--- /dev/null\n+++ b/t/t9125-git-svn-multi-glob-branch-names.sh\n@@ -0,0 +1,41 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Eric Wong\n+#\n+\n+test_description='git-svn multi-glob branch names'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup svnrepo' '\n+\tmkdir project project/trunk project/branches \\\n+\t\t\tproject/branches/v14.1 project/tags &&\n+\techo foo > project/trunk/foo &&\n+\tsvn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+\trm -rf project &&\n+\tsvn cp -m \"fun\" \"$svnrepo/project/trunk\" \\\n+\t                \"$svnrepo/project/branches/v14.1/beta\" &&\n+\tsvn cp -m \"more fun!\" \"$svnrepo/project/branches/v14.1/beta\" \\\n+\t                      \"$svnrepo/project/branches/v14.1/gold\" &&\n+\tstart_httpd\n+\t'\n+\n+test_expect_success 'test clone with multi-glob in branch names' '\n+\tgit svn clone -T trunk -b branches/*/* -t tags \"$svnrepo/project\" project &&\n+\tcd project &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/beta\" &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/gold\" &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'test dcommit to multi-globbed branch' \"\n+\tcd project &&\n+\tgit reset --hard 'refs/remotes/v14.1/gold' &&\n+\techo hello >> foo &&\n+\tgit commit -m 'hello' -- foo &&\n+\tgit svn dcommit &&\n+\tcd ..\n+\t\"\n+\n+stop_httpd\n+\n+test_done\n-- \n1.6.0.rc2.4.g39f8\n"},{"id":"86467","messageId":"20080808084025.GA8718@untitled","threadId":"14865","inReplyTo":"1218123242-26260-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH v2 0/2] git-svn multi-glob fix and extension","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:40:25Z","receivedAt":"2008-08-08T08:40:25Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marcus Griep <marcus@griep.us> wrote:\n> \n> This patch series fixes and extends globs for branches and tags.\n> \n> The first patch fixes the assertion that protects git-svn from allowing\n> multi-globs in branch names, whereas the second removes that restriction\n> altogether, allowing up to one multi-glob set in defining a branch hierarchy.\n> \n> Also, patches are now under 80 chars wide except for a couple of echos in the\n> test cases.\n\nThanks.  At least I can apply the patches now :)\nI've made couple of fixups which will be replies to this message.\n\nEric Wong (1):\n      git-svn: wrap long lines in a few places\n\nMarcus Griep (2):\n      Fix multi-glob assertion in git-svn\n      git-svn: Allow deep branch names by supporting multi-globs\n\n---\n git-svn.perl                               |   67 +++++++++---\n t/t9108-git-svn-glob.sh                    |   24 ++++-\n t/t9108-git-svn-multi-glob.sh              |  157 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   37 +++++++\n 4 files changed, 267 insertions(+), 18 deletions(-)\n\n-- \nEric Wong\n"},{"id":"86468","messageId":"1218184918-9135-1-git-send-email-normalperson@yhbt.net","threadId":"14865","inReplyTo":"20080808084025.GA8718@untitled","subject":"[PATCH 1/3] Fix multi-glob assertion in git-svn","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:41:56Z","receivedAt":"2008-08-08T08:41:56Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"From: Marcus Griep <marcus@griep.us>\n\nFixes bad regex match check for multiple globs (would always return\none glob regardless of actual number).\n\n[ew: fixed a bashism in the test and some minor line-wrapping]\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\nAcked-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl            |    5 +++--\n t/t9108-git-svn-glob.sh |   21 +++++++++++++++++++++\n 2 files changed, 24 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 06a82c8..503a7c9 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4915,14 +4915,15 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = ($re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g);\n-\tmy ($left, $right) = ($1, $2);\n+\tmy $nr = $re =~ tr/*/*/;\n \tif ($nr > 1) {\n \t\tdie \"Only one '*' wildcard expansion \",\n \t\t    \"is supported (got $nr): '$glob'\\n\";\n \t} elsif ($nr == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n+\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n+\tmy ($left, $right) = ($1, $2);\n \t$re = quotemeta($left) . $re . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex f6f71d0..a6f88bd 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -83,4 +83,25 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n+echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" \\\n+     > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multi-globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch \\\n+\t                 trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three 2> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n test_done\n-- \n1.6.0.rc2.4.g0643f\n"},{"id":"86470","messageId":"1218184918-9135-2-git-send-email-normalperson@yhbt.net","threadId":"14865","inReplyTo":"20080808084025.GA8718@untitled","subject":"[PATCH 2/3] git-svn: Allow deep branch names by supporting multi-globs","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:41:57Z","receivedAt":"2008-08-08T08:41:57Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"From: Marcus Griep <marcus@griep.us>\n\nSome repositories use a deep branching strategy, such as:\nbranches/1.0/1.0.rc1\nbranches/1.0/1.0.rc2\nbranches/1.0/1.0.rtm\nbranches/1.0/1.0.gold\n\nOnly allowing a single glob stiffles this.\n\nThis change allows for a single glob 'set' to accept this deep\nbranching strategy.\n\nThe ref glob depth must match the branch glob depth.  When using\nthe -b or -t options for init or clone, this is automatically\ndone.\n\nFor example, using the above branches:\n  svn-remote.svn.branches = branches/*/*:refs/remote/*/*\ngives the following branch names:\n  1.0/1.0.rc1\n  1.0/1.0.rc2\n  1.0/1.0.rtm\n  1.0/1.0.gold\n\n[ew:\n  * removed unrelated line-wrapping changes\n  * fixed line-wrapping in a few more places\n  * removed trailing whitespace\n  * fixed bashism in test\n  * removed unnecessary httpd startup in test\n  * changed copyright on tests to 2008 Marcus Griep\n  * added executable permissions to new tests\n]\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\nAcked-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl                               |   61 ++++++++---\n t/t9108-git-svn-glob.sh                    |    9 +-\n t/t9108-git-svn-multi-glob.sh              |  157 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   37 +++++++\n 4 files changed, 244 insertions(+), 20 deletions(-)\n create mode 100755 t/t9108-git-svn-multi-glob.sh\n create mode 100755 t/t9125-git-svn-multi-glob-branch-names.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 503a7c9..47ad378 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -987,8 +987,10 @@ sub complete_url_ls_init {\n \tif (length $pfx && $pfx !~ m#/$#) {\n \t\tdie \"--prefix='$pfx' must have a trailing slash '/'\\n\";\n \t}\n-\tcommand_noisy('config', \"svn-remote.$gs->{repo_id}.$n\",\n-\t\t\t\t\"$remote_path:refs/remotes/$pfx*\");\n+\tcommand_noisy('config',\n+\t              \"svn-remote.$gs->{repo_id}.$n\",\n+\t              \"$remote_path:refs/remotes/$pfx*\" .\n+\t                ('/*' x (($remote_path =~ tr/*/*/) - 1)) );\n }\n \n sub verify_ref {\n@@ -4124,16 +4126,38 @@ sub gs_fetch_loop_common {\n \tGit::SVN::gc();\n }\n \n+sub get_dir_globbed {\n+\tmy ($self, $left, $depth, $r) = @_;\n+\n+\tmy @x = eval { $self->get_dir($left, $r) };\n+\treturn unless scalar @x == 3;\n+\tmy $dirents = $x[0];\n+\tmy @finalents;\n+\tforeach my $de (keys %$dirents) {\n+\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\t\tif ($depth > 1) {\n+\t\t\tmy @args = (\"$left/$de\", $depth - 1, $r);\n+\t\t\tforeach my $dir ($self->get_dir_globbed(@args)) {\n+\t\t\t\tpush @finalents, \"$de/$dir\";\n+\t\t\t}\n+\t\t} else {\n+\t\t\tpush @finalents, $de;\n+\t\t}\n+\t}\n+\t@finalents;\n+}\n+\n sub match_globs {\n \tmy ($self, $exists, $paths, $globs, $r) = @_;\n \n \tsub get_dir_check {\n \t\tmy ($self, $exists, $g, $r) = @_;\n-\t\tmy @x = eval { $self->get_dir($g->{path}->{left}, $r) };\n-\t\treturn unless scalar @x == 3;\n-\t\tmy $dirents = $x[0];\n-\t\tforeach my $de (keys %$dirents) {\n-\t\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\n+\t\tmy @dirs = $self->get_dir_globbed($g->{path}->{left},\n+\t\t                                  $g->{path}->{depth},\n+\t\t                                  $r);\n+\n+\t\tforeach my $de (@dirs) {\n \t\t\tmy $p = $g->{path}->full_path($de);\n \t\t\tnext if $exists->{$p};\n \t\t\tnext if (length $g->{path}->{right} &&\n@@ -4915,16 +4939,21 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = $re =~ tr/*/*/;\n-\tif ($nr > 1) {\n-\t\tdie \"Only one '*' wildcard expansion \",\n-\t\t    \"is supported (got $nr): '$glob'\\n\";\n-\t} elsif ($nr == 0) {\n+\t$re =~ m!^([^*]*)(\\*(?:/\\*)*)([^*]*)$!;\n+\tmy $temp = $re;\n+\tmy ($left, $right) = ($1, $3);\n+\t$re = $2;\n+\tmy $depth = $re =~ tr/*/*/;\n+\tif ($depth != $temp =~ tr/*/*/) {\n+\t\tdie \"Only one set of wildcard directories \" .\n+\t\t\t\"(e.g. '*' or '*/*/*') is supported: '$glob'\\n\";\n+\t}\n+\tif ($depth == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n-\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n-\tmy ($left, $right) = ($1, $2);\n-\t$re = quotemeta($left) . $re . quotemeta($right);\n+\t$re =~ s!\\*!\\[^/\\]*!g;\n+#\t$re =~ s!\\?!\\[^/\\]!g;\n+\t$re = quotemeta($left) . \"($re)\" . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\n \t}\n@@ -4933,7 +4962,7 @@ sub new {\n \t}\n \tmy $left_re = qr/^\\/\\Q$left\\E(\\/|$)/;\n \tbless { left => $left, right => $right, left_regex => $left_re,\n-\t        regex => qr/$re/, glob => $glob }, $class;\n+\t        regex => qr/$re/, glob => $glob, depth => $depth }, $class;\n }\n \n sub full_path {\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex a6f88bd..bb9df56 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -52,7 +52,8 @@ test_expect_success 'test refspec globbing' '\n \ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n \t\t\"`git rev-parse refs/remotes/branches/start`\" &&\n \ttest \"`git rev-parse refs/remotes/branches/start~2`\" = \\\n-\t\t\"`git rev-parse refs/remotes/trunk`\"\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n \t'\n \n echo try to try > expect.two\n@@ -83,8 +84,8 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n-echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" \\\n-     > expect.three\n+echo \"Only one set of wildcard directories\" \\\n+     \"(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n echo \"\" >> expect.three\n \n test_expect_success 'test disallow multi-globs' '\n@@ -92,7 +93,7 @@ test_expect_success 'test disallow multi-globs' '\n \tgit config --add svn-remote.three.fetch \\\n \t                 trunk:refs/remotes/three/trunk &&\n \tgit config --add svn-remote.three.branches \\\n-\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*\" &&\n \tgit config --add svn-remote.three.tags \\\n \t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n \tcd tmp &&\ndiff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh\nnew file mode 100755\nindex 0000000..9fb51d6\n--- /dev/null\n+++ b/t/t9108-git-svn-multi-glob.sh\n@@ -0,0 +1,157 @@\n+#!/bin/sh\n+# Copyright (c) 2007 Eric Wong\n+test_description='git-svn globbing refspecs'\n+. ./lib-git-svn.sh\n+\n+cat > expect.end <<EOF\n+the end\n+hi\n+start a new branch\n+initial\n+EOF\n+\n+test_expect_success 'test refspec globbing' '\n+\tmkdir -p trunk/src/a trunk/src/b trunk/doc &&\n+\techo \"hello world\" > trunk/src/a/readme &&\n+\techo \"goodbye world\" > trunk/src/b/readme &&\n+\tsvn import -m \"initial\" trunk \"$svnrepo\"/trunk &&\n+\tsvn co \"$svnrepo\" tmp &&\n+\tcd tmp &&\n+\t\tmkdir branches branches/v1 tags &&\n+\t\tsvn add branches tags &&\n+\t\tsvn cp trunk branches/v1/start &&\n+\t\tsvn commit -m \"start a new branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hi\" >> branches/v1/start/src/b/readme &&\n+\t\tpoke branches/v1/start/src/b/readme &&\n+\t\techo \"hey\" >> branches/v1/start/src/a/readme &&\n+\t\tpoke branches/v1/start/src/a/readme &&\n+\t\tsvn commit -m \"hi\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v1/start tags/end &&\n+\t\techo \"bye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\techo \"aye\" >> tags/end/src/a/readme &&\n+\t\tpoke tags/end/src/a/readme &&\n+\t\tsvn commit -m \"the end\" &&\n+\t\techo \"byebye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"nothing to see here\"\n+\t\tcd .. &&\n+\tgit config --add svn-remote.svn.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.svn.fetch \\\n+\t                 \"trunk/src/a:refs/remotes/trunk\" &&\n+\tgit config --add svn-remote.svn.branches \\\n+\t                 \"branches/*/*/src/a:refs/remotes/branches/*/*\" &&\n+\tgit config --add svn-remote.svn.tags\\\n+\t                 \"tags/*/src/a:refs/remotes/tags/*\" &&\n+\tgit-svn multi-fetch &&\n+\tgit log --pretty=oneline refs/remotes/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.end &&\n+\tcmp expect.end output.end &&\n+\ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n+\t\t\"`git rev-parse refs/remotes/branches/v1/start`\" &&\n+\ttest \"`git rev-parse refs/remotes/branches/v1/start~2`\" = \\\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n+\t'\n+\n+echo try to try > expect.two\n+echo nothing to see here >> expect.two\n+cat expect.end >> expect.two\n+\n+test_expect_success 'test left-hand-side only globbing' '\n+\tgit config --add svn-remote.two.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&\n+\tgit config --add svn-remote.two.branches \\\n+\t                 \"branches/*/*:refs/remotes/two/branches/*/*\" &&\n+\tgit config --add svn-remote.two.tags \\\n+\t                 \"tags/*:refs/remotes/two/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\tgit-svn fetch two &&\n+\ttest `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&\n+\ttest `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/two/branches/v1/start~2` = \\\n+\t     `git rev-parse refs/remotes/two/trunk` &&\n+\ttest `git rev-parse refs/remotes/two/tags/end~3` = \\\n+\t     `git rev-parse refs/remotes/two/branches/v1/start` &&\n+\tgit log --pretty=oneline refs/remotes/two/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.two &&\n+\tcmp expect.two output.two\n+\t'\n+cat > expect.four <<EOF\n+adios\n+adding more\n+Changed 2 in v2/start\n+Another versioned branch\n+initial\n+EOF\n+\n+test_expect_success 'test another branch' '\n+\t(\n+\t\tcd tmp &&\n+\t\tmkdir branches/v2 &&\n+\t\tsvn add branches/v2 &&\n+\t\tsvn cp trunk branches/v2/start &&\n+\t\tsvn commit -m \"Another versioned branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hello\" >> branches/v2/start/src/b/readme &&\n+\t\tpoke branches/v2/start/src/b/readme &&\n+\t\techo \"howdy\" >> branches/v2/start/src/a/readme &&\n+\t\tpoke branches/v2/start/src/a/readme &&\n+\t\tsvn commit -m \"Changed 2 in v2/start\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v2/start tags/next &&\n+\t\techo \"bye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\techo \"aye\" >> tags/next/src/a/readme &&\n+\t\tpoke tags/next/src/a/readme &&\n+\t\tsvn commit -m \"adding more\" &&\n+\t\techo \"byebye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\tsvn commit -m \"adios\"\n+\t) &&\n+\tgit config --add svn-remote.four.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk &&\n+\tgit config --add svn-remote.four.branches \\\n+\t                 \"branches/*/*:refs/remotes/four/branches/*/*\" &&\n+\tgit config --add svn-remote.four.tags \\\n+\t                 \"tags/*:refs/remotes/four/tags/*\" &&\n+\tgit-svn fetch four &&\n+\ttest `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&\n+\ttest `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/four/branches/v2/start~2` = \\\n+\t     `git rev-parse refs/remotes/four/trunk` &&\n+\ttest `git rev-parse refs/remotes/four/tags/next~2` = \\\n+\t     `git rev-parse refs/remotes/four/branches/v2/start` &&\n+\tgit log --pretty=oneline refs/remotes/four/tags/next | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.four &&\n+\tcmp expect.four output.four\n+\t'\n+\n+echo \"Only one set of wildcard directories\" \\\n+     \"(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multiple globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch \\\n+\t                 trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three 2> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n+test_done\ndiff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh\nnew file mode 100755\nindex 0000000..6b62b52\n--- /dev/null\n+++ b/t/t9125-git-svn-multi-glob-branch-names.sh\n@@ -0,0 +1,37 @@\n+#!/bin/sh\n+# Copyright (c) 2008 Marcus Griep\n+\n+test_description='git-svn multi-glob branch names'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup svnrepo' '\n+\tmkdir project project/trunk project/branches \\\n+\t\t\tproject/branches/v14.1 project/tags &&\n+\techo foo > project/trunk/foo &&\n+\tsvn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+\trm -rf project &&\n+\tsvn cp -m \"fun\" \"$svnrepo/project/trunk\" \\\n+\t                \"$svnrepo/project/branches/v14.1/beta\" &&\n+\tsvn cp -m \"more fun!\" \"$svnrepo/project/branches/v14.1/beta\" \\\n+\t                      \"$svnrepo/project/branches/v14.1/gold\"\n+\t'\n+\n+test_expect_success 'test clone with multi-glob in branch names' '\n+\tgit svn clone -T trunk -b branches/*/* -t tags \\\n+\t              \"$svnrepo/project\" project &&\n+\tcd project &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/beta\" &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/gold\" &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'test dcommit to multi-globbed branch' \"\n+\tcd project &&\n+\tgit reset --hard 'refs/remotes/v14.1/gold' &&\n+\techo hello >> foo &&\n+\tgit commit -m 'hello' -- foo &&\n+\tgit svn dcommit &&\n+\tcd ..\n+\t\"\n+\n+test_done\n-- \n1.6.0.rc2.4.g0643f\n"},{"id":"86469","messageId":"1218184918-9135-3-git-send-email-normalperson@yhbt.net","threadId":"14865","inReplyTo":"20080808084025.GA8718@untitled","subject":"[PATCH 3/3] git-svn: wrap long lines in a few places","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:41:58Z","receivedAt":"2008-08-08T08:41:58Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Oops, I let a few patches slip by with long lines in them.\nExtracted from an unrelated patch by: Marcus Griep <marcus@griep.us>\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 47ad378..d7a884d 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -171,7 +171,8 @@ my %cmd = (\n \t\t\t  'color' => \\$Git::SVN::Log::color,\n \t\t\t  'pager=s' => \\$Git::SVN::Log::pager\n \t\t\t} ],\n-\t'find-rev' => [ \\&cmd_find_rev, \"Translate between SVN revision numbers and tree-ish\",\n+\t'find-rev' => [ \\&cmd_find_rev,\n+\t                \"Translate between SVN revision numbers and tree-ish\",\n \t\t\t{} ],\n \t'rebase' => [ \\&cmd_rebase, \"Fetch and rebase your working directory\",\n \t\t\t{ 'merge|m|M' => \\$_merge,\n@@ -231,7 +232,9 @@ unless ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n \n read_repo_config(\\%opts);\n-Getopt::Long::Configure('pass_through') if ($cmd && ($cmd eq 'log' || $cmd eq 'blame'));\n+if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n+\tGetopt::Long::Configure('pass_through');\n+}\n my $rv = GetOptions(%opts, 'help|H|h' => \\$_help, 'version|V' => \\$_version,\n                     'minimize-connections' => \\$Git::SVN::Migration::_minimize,\n                     'id|i=s' => \\$Git::SVN::default_ref_id,\n-- \n1.6.0.rc2.4.g0643f\n"},{"id":"86472","messageId":"20080808085655.GA9479@untitled","threadId":"14865","inReplyTo":"20080808084025.GA8718@untitled","subject":"[PATCH 1/3] Fix multi-glob assertion in git-svn","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:56:55Z","receivedAt":"2008-08-08T08:56:55Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"From: Marcus Griep <marcus@griep.us>\nDate: Thu, 7 Aug 2008 11:34:01 -0400\nSubject: [PATCH 1/3] Fix multi-glob assertion in git-svn\n\nFixes bad regex match check for multiple globs (would always return\none glob regardless of actual number).\n\n[ew: fixed a bashism in the test and some minor line-wrapping]\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\nAcked-by: Eric Wong <normalperson@yhbt.net>\n---\n\n Oops, resent as I forgot to change the From: header\n\n git-svn.perl            |    5 +++--\n t/t9108-git-svn-glob.sh |   21 +++++++++++++++++++++\n 2 files changed, 24 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 06a82c8..503a7c9 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4915,14 +4915,15 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = ($re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g);\n-\tmy ($left, $right) = ($1, $2);\n+\tmy $nr = $re =~ tr/*/*/;\n \tif ($nr > 1) {\n \t\tdie \"Only one '*' wildcard expansion \",\n \t\t    \"is supported (got $nr): '$glob'\\n\";\n \t} elsif ($nr == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n+\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n+\tmy ($left, $right) = ($1, $2);\n \t$re = quotemeta($left) . $re . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex f6f71d0..a6f88bd 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -83,4 +83,25 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n+echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" \\\n+     > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multi-globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch \\\n+\t                 trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three 2> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n test_done\n-- \n1.6.0.rc2.4.g0643f\n"},{"id":"86473","messageId":"20080808085724.GB9479@untitled","threadId":"14865","inReplyTo":"20080808084025.GA8718@untitled","subject":"[PATCH 2/3] git-svn: Allow deep branch names by supporting multi-globs","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-08T08:57:24Z","receivedAt":"2008-08-08T08:57:24Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"From: Marcus Griep <marcus@griep.us>\nDate: Thu, 7 Aug 2008 11:34:02 -0400\nSubject: [PATCH 2/3] git-svn: Allow deep branch names by supporting multi-globs\n\nSome repositories use a deep branching strategy, such as:\nbranches/1.0/1.0.rc1\nbranches/1.0/1.0.rc2\nbranches/1.0/1.0.rtm\nbranches/1.0/1.0.gold\n\nOnly allowing a single glob stiffles this.\n\nThis change allows for a single glob 'set' to accept this deep\nbranching strategy.\n\nThe ref glob depth must match the branch glob depth.  When using\nthe -b or -t options for init or clone, this is automatically\ndone.\n\nFor example, using the above branches:\n  svn-remote.svn.branches = branches/*/*:refs/remote/*/*\ngives the following branch names:\n  1.0/1.0.rc1\n  1.0/1.0.rc2\n  1.0/1.0.rtm\n  1.0/1.0.gold\n\n[ew:\n  * removed unrelated line-wrapping changes\n  * fixed line-wrapping in a few more places\n  * removed trailing whitespace\n  * fixed bashism in test\n  * removed unnecessary httpd startup in test\n  * changed copyright on tests to 2008 Marcus Griep\n  * added executable permissions to new tests\n]\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\nAcked-by: Eric Wong <normalperson@yhbt.net>\n---\n Oops, resent as I forgot to change the From: header\n\n git-svn.perl                               |   61 ++++++++---\n t/t9108-git-svn-glob.sh                    |    9 +-\n t/t9108-git-svn-multi-glob.sh              |  157 ++++++++++++++++++++++++++++\n t/t9125-git-svn-multi-glob-branch-names.sh |   37 +++++++\n 4 files changed, 244 insertions(+), 20 deletions(-)\n create mode 100755 t/t9108-git-svn-multi-glob.sh\n create mode 100755 t/t9125-git-svn-multi-glob-branch-names.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 503a7c9..47ad378 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -987,8 +987,10 @@ sub complete_url_ls_init {\n \tif (length $pfx && $pfx !~ m#/$#) {\n \t\tdie \"--prefix='$pfx' must have a trailing slash '/'\\n\";\n \t}\n-\tcommand_noisy('config', \"svn-remote.$gs->{repo_id}.$n\",\n-\t\t\t\t\"$remote_path:refs/remotes/$pfx*\");\n+\tcommand_noisy('config',\n+\t              \"svn-remote.$gs->{repo_id}.$n\",\n+\t              \"$remote_path:refs/remotes/$pfx*\" .\n+\t                ('/*' x (($remote_path =~ tr/*/*/) - 1)) );\n }\n \n sub verify_ref {\n@@ -4124,16 +4126,38 @@ sub gs_fetch_loop_common {\n \tGit::SVN::gc();\n }\n \n+sub get_dir_globbed {\n+\tmy ($self, $left, $depth, $r) = @_;\n+\n+\tmy @x = eval { $self->get_dir($left, $r) };\n+\treturn unless scalar @x == 3;\n+\tmy $dirents = $x[0];\n+\tmy @finalents;\n+\tforeach my $de (keys %$dirents) {\n+\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\t\tif ($depth > 1) {\n+\t\t\tmy @args = (\"$left/$de\", $depth - 1, $r);\n+\t\t\tforeach my $dir ($self->get_dir_globbed(@args)) {\n+\t\t\t\tpush @finalents, \"$de/$dir\";\n+\t\t\t}\n+\t\t} else {\n+\t\t\tpush @finalents, $de;\n+\t\t}\n+\t}\n+\t@finalents;\n+}\n+\n sub match_globs {\n \tmy ($self, $exists, $paths, $globs, $r) = @_;\n \n \tsub get_dir_check {\n \t\tmy ($self, $exists, $g, $r) = @_;\n-\t\tmy @x = eval { $self->get_dir($g->{path}->{left}, $r) };\n-\t\treturn unless scalar @x == 3;\n-\t\tmy $dirents = $x[0];\n-\t\tforeach my $de (keys %$dirents) {\n-\t\t\tnext if $dirents->{$de}->{kind} != $SVN::Node::dir;\n+\n+\t\tmy @dirs = $self->get_dir_globbed($g->{path}->{left},\n+\t\t                                  $g->{path}->{depth},\n+\t\t                                  $r);\n+\n+\t\tforeach my $de (@dirs) {\n \t\t\tmy $p = $g->{path}->full_path($de);\n \t\t\tnext if $exists->{$p};\n \t\t\tnext if (length $g->{path}->{right} &&\n@@ -4915,16 +4939,21 @@ sub new {\n \tmy ($class, $glob) = @_;\n \tmy $re = $glob;\n \t$re =~ s!/+$!!g; # no need for trailing slashes\n-\tmy $nr = $re =~ tr/*/*/;\n-\tif ($nr > 1) {\n-\t\tdie \"Only one '*' wildcard expansion \",\n-\t\t    \"is supported (got $nr): '$glob'\\n\";\n-\t} elsif ($nr == 0) {\n+\t$re =~ m!^([^*]*)(\\*(?:/\\*)*)([^*]*)$!;\n+\tmy $temp = $re;\n+\tmy ($left, $right) = ($1, $3);\n+\t$re = $2;\n+\tmy $depth = $re =~ tr/*/*/;\n+\tif ($depth != $temp =~ tr/*/*/) {\n+\t\tdie \"Only one set of wildcard directories \" .\n+\t\t\t\"(e.g. '*' or '*/*/*') is supported: '$glob'\\n\";\n+\t}\n+\tif ($depth == 0) {\n \t\tdie \"One '*' is needed for glob: '$glob'\\n\";\n \t}\n-\t$re =~ s!^(.*)\\*(.*)$!\\(\\[^/\\]+\\)!g;\n-\tmy ($left, $right) = ($1, $2);\n-\t$re = quotemeta($left) . $re . quotemeta($right);\n+\t$re =~ s!\\*!\\[^/\\]*!g;\n+#\t$re =~ s!\\?!\\[^/\\]!g;\n+\t$re = quotemeta($left) . \"($re)\" . quotemeta($right);\n \tif (length $left && !($left =~ s!/+$!!g)) {\n \t\tdie \"Missing trailing '/' on left side of: '$glob' ($left)\\n\";\n \t}\n@@ -4933,7 +4962,7 @@ sub new {\n \t}\n \tmy $left_re = qr/^\\/\\Q$left\\E(\\/|$)/;\n \tbless { left => $left, right => $right, left_regex => $left_re,\n-\t        regex => qr/$re/, glob => $glob }, $class;\n+\t        regex => qr/$re/, glob => $glob, depth => $depth }, $class;\n }\n \n sub full_path {\ndiff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh\nindex a6f88bd..bb9df56 100755\n--- a/t/t9108-git-svn-glob.sh\n+++ b/t/t9108-git-svn-glob.sh\n@@ -52,7 +52,8 @@ test_expect_success 'test refspec globbing' '\n \ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n \t\t\"`git rev-parse refs/remotes/branches/start`\" &&\n \ttest \"`git rev-parse refs/remotes/branches/start~2`\" = \\\n-\t\t\"`git rev-parse refs/remotes/trunk`\"\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n \t'\n \n echo try to try > expect.two\n@@ -83,8 +84,8 @@ test_expect_success 'test left-hand-side only globbing' '\n \tcmp expect.two output.two\n \t'\n \n-echo \"Only one '*' wildcard expansion is supported (got 2): 'branches/*/*'\" \\\n-     > expect.three\n+echo \"Only one set of wildcard directories\" \\\n+     \"(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n echo \"\" >> expect.three\n \n test_expect_success 'test disallow multi-globs' '\n@@ -92,7 +93,7 @@ test_expect_success 'test disallow multi-globs' '\n \tgit config --add svn-remote.three.fetch \\\n \t                 trunk:refs/remotes/three/trunk &&\n \tgit config --add svn-remote.three.branches \\\n-\t                 \"branches/*/*:refs/remotes/three/branches/*\" &&\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*\" &&\n \tgit config --add svn-remote.three.tags \\\n \t                 \"tags/*/*:refs/remotes/three/tags/*\" &&\n \tcd tmp &&\ndiff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh\nnew file mode 100755\nindex 0000000..9fb51d6\n--- /dev/null\n+++ b/t/t9108-git-svn-multi-glob.sh\n@@ -0,0 +1,157 @@\n+#!/bin/sh\n+# Copyright (c) 2007 Eric Wong\n+test_description='git-svn globbing refspecs'\n+. ./lib-git-svn.sh\n+\n+cat > expect.end <<EOF\n+the end\n+hi\n+start a new branch\n+initial\n+EOF\n+\n+test_expect_success 'test refspec globbing' '\n+\tmkdir -p trunk/src/a trunk/src/b trunk/doc &&\n+\techo \"hello world\" > trunk/src/a/readme &&\n+\techo \"goodbye world\" > trunk/src/b/readme &&\n+\tsvn import -m \"initial\" trunk \"$svnrepo\"/trunk &&\n+\tsvn co \"$svnrepo\" tmp &&\n+\tcd tmp &&\n+\t\tmkdir branches branches/v1 tags &&\n+\t\tsvn add branches tags &&\n+\t\tsvn cp trunk branches/v1/start &&\n+\t\tsvn commit -m \"start a new branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hi\" >> branches/v1/start/src/b/readme &&\n+\t\tpoke branches/v1/start/src/b/readme &&\n+\t\techo \"hey\" >> branches/v1/start/src/a/readme &&\n+\t\tpoke branches/v1/start/src/a/readme &&\n+\t\tsvn commit -m \"hi\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v1/start tags/end &&\n+\t\techo \"bye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\techo \"aye\" >> tags/end/src/a/readme &&\n+\t\tpoke tags/end/src/a/readme &&\n+\t\tsvn commit -m \"the end\" &&\n+\t\techo \"byebye\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"nothing to see here\"\n+\t\tcd .. &&\n+\tgit config --add svn-remote.svn.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.svn.fetch \\\n+\t                 \"trunk/src/a:refs/remotes/trunk\" &&\n+\tgit config --add svn-remote.svn.branches \\\n+\t                 \"branches/*/*/src/a:refs/remotes/branches/*/*\" &&\n+\tgit config --add svn-remote.svn.tags\\\n+\t                 \"tags/*/src/a:refs/remotes/tags/*\" &&\n+\tgit-svn multi-fetch &&\n+\tgit log --pretty=oneline refs/remotes/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.end &&\n+\tcmp expect.end output.end &&\n+\ttest \"`git rev-parse refs/remotes/tags/end~1`\" = \\\n+\t\t\"`git rev-parse refs/remotes/branches/v1/start`\" &&\n+\ttest \"`git rev-parse refs/remotes/branches/v1/start~2`\" = \\\n+\t\t\"`git rev-parse refs/remotes/trunk`\" &&\n+\ttest_must_fail git rev-parse refs/remotes/tags/end@3\n+\t'\n+\n+echo try to try > expect.two\n+echo nothing to see here >> expect.two\n+cat expect.end >> expect.two\n+\n+test_expect_success 'test left-hand-side only globbing' '\n+\tgit config --add svn-remote.two.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&\n+\tgit config --add svn-remote.two.branches \\\n+\t                 \"branches/*/*:refs/remotes/two/branches/*/*\" &&\n+\tgit config --add svn-remote.two.tags \\\n+\t                 \"tags/*:refs/remotes/two/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\tgit-svn fetch two &&\n+\ttest `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&\n+\ttest `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/two/branches/v1/start~2` = \\\n+\t     `git rev-parse refs/remotes/two/trunk` &&\n+\ttest `git rev-parse refs/remotes/two/tags/end~3` = \\\n+\t     `git rev-parse refs/remotes/two/branches/v1/start` &&\n+\tgit log --pretty=oneline refs/remotes/two/tags/end | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.two &&\n+\tcmp expect.two output.two\n+\t'\n+cat > expect.four <<EOF\n+adios\n+adding more\n+Changed 2 in v2/start\n+Another versioned branch\n+initial\n+EOF\n+\n+test_expect_success 'test another branch' '\n+\t(\n+\t\tcd tmp &&\n+\t\tmkdir branches/v2 &&\n+\t\tsvn add branches/v2 &&\n+\t\tsvn cp trunk branches/v2/start &&\n+\t\tsvn commit -m \"Another versioned branch\" &&\n+\t\tsvn up &&\n+\t\techo \"hello\" >> branches/v2/start/src/b/readme &&\n+\t\tpoke branches/v2/start/src/b/readme &&\n+\t\techo \"howdy\" >> branches/v2/start/src/a/readme &&\n+\t\tpoke branches/v2/start/src/a/readme &&\n+\t\tsvn commit -m \"Changed 2 in v2/start\" &&\n+\t\tsvn up &&\n+\t\tsvn cp branches/v2/start tags/next &&\n+\t\techo \"bye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\techo \"aye\" >> tags/next/src/a/readme &&\n+\t\tpoke tags/next/src/a/readme &&\n+\t\tsvn commit -m \"adding more\" &&\n+\t\techo \"byebye\" >> tags/next/src/b/readme &&\n+\t\tpoke tags/next/src/b/readme &&\n+\t\tsvn commit -m \"adios\"\n+\t) &&\n+\tgit config --add svn-remote.four.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk &&\n+\tgit config --add svn-remote.four.branches \\\n+\t                 \"branches/*/*:refs/remotes/four/branches/*/*\" &&\n+\tgit config --add svn-remote.four.tags \\\n+\t                 \"tags/*:refs/remotes/four/tags/*\" &&\n+\tgit-svn fetch four &&\n+\ttest `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 &&\n+\ttest `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 &&\n+\ttest `git rev-parse refs/remotes/four/branches/v2/start~2` = \\\n+\t     `git rev-parse refs/remotes/four/trunk` &&\n+\ttest `git rev-parse refs/remotes/four/tags/next~2` = \\\n+\t     `git rev-parse refs/remotes/four/branches/v2/start` &&\n+\tgit log --pretty=oneline refs/remotes/four/tags/next | \\\n+\t    sed -e \"s/^.\\{41\\}//\" > output.four &&\n+\tcmp expect.four output.four\n+\t'\n+\n+echo \"Only one set of wildcard directories\" \\\n+     \"(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'\" > expect.three\n+echo \"\" >> expect.three\n+\n+test_expect_success 'test disallow multiple globs' '\n+\tgit config --add svn-remote.three.url \"$svnrepo\" &&\n+\tgit config --add svn-remote.three.fetch \\\n+\t                 trunk:refs/remotes/three/trunk &&\n+\tgit config --add svn-remote.three.branches \\\n+\t                 \"branches/*/t/*:refs/remotes/three/branches/*/*\" &&\n+\tgit config --add svn-remote.three.tags \\\n+\t                 \"tags/*:refs/remotes/three/tags/*\" &&\n+\tcd tmp &&\n+\t\techo \"try try\" >> tags/end/src/b/readme &&\n+\t\tpoke tags/end/src/b/readme &&\n+\t\tsvn commit -m \"try to try\"\n+\t\tcd .. &&\n+\ttest_must_fail git-svn fetch three 2> stderr.three &&\n+\tcmp expect.three stderr.three\n+\t'\n+\n+test_done\ndiff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh\nnew file mode 100755\nindex 0000000..6b62b52\n--- /dev/null\n+++ b/t/t9125-git-svn-multi-glob-branch-names.sh\n@@ -0,0 +1,37 @@\n+#!/bin/sh\n+# Copyright (c) 2008 Marcus Griep\n+\n+test_description='git-svn multi-glob branch names'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup svnrepo' '\n+\tmkdir project project/trunk project/branches \\\n+\t\t\tproject/branches/v14.1 project/tags &&\n+\techo foo > project/trunk/foo &&\n+\tsvn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+\trm -rf project &&\n+\tsvn cp -m \"fun\" \"$svnrepo/project/trunk\" \\\n+\t                \"$svnrepo/project/branches/v14.1/beta\" &&\n+\tsvn cp -m \"more fun!\" \"$svnrepo/project/branches/v14.1/beta\" \\\n+\t                      \"$svnrepo/project/branches/v14.1/gold\"\n+\t'\n+\n+test_expect_success 'test clone with multi-glob in branch names' '\n+\tgit svn clone -T trunk -b branches/*/* -t tags \\\n+\t              \"$svnrepo/project\" project &&\n+\tcd project &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/beta\" &&\n+\t\tgit rev-parse \"refs/remotes/v14.1/gold\" &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'test dcommit to multi-globbed branch' \"\n+\tcd project &&\n+\tgit reset --hard 'refs/remotes/v14.1/gold' &&\n+\techo hello >> foo &&\n+\tgit commit -m 'hello' -- foo &&\n+\tgit svn dcommit &&\n+\tcd ..\n+\t\"\n+\n+test_done\n-- \n1.6.0.rc2.4.g0643f\n"},{"id":"86476","messageId":"7vk5erete1.fsf@gitster.siamese.dyndns.org","threadId":"14865","inReplyTo":"1218184918-9135-1-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH 1/3] Fix multi-glob assertion in git-svn","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-08T09:41:10Z","receivedAt":"2008-08-08T09:41:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> From: Marcus Griep <marcus@griep.us>\n>\n> Fixes bad regex match check for multiple globs (would always return\n> one glob regardless of actual number).\n>\n> [ew: fixed a bashism in the test and some minor line-wrapping]\n\nThanks both.\n\n> +test_expect_success 'test disallow multi-globs' '\n> ...\n> +\tcd tmp &&\n> +\t\techo \"try try\" >> tags/end/src/b/readme &&\n> +\t\tpoke tags/end/src/b/readme &&\n> +\t\tsvn commit -m \"try to try\"\n> +\t\tcd .. &&\n\nDo you want to ignore exit code from 'svn commit -m' here?\n\nIn any case, I'd want to see \"temporarily work in subdirectory\" done in a\nsubshell when applicable, so that we won't have to worry about where we\nare when we later add more tests, like this:\n\n\t(\n        \tcd tmp &&\n                echo \"try try\" >>tags/end/src/b/readme &&\n                poke tags/end/src/b/readme &&\n                svn commit -m \"try to try\" &&\n\t) &&\n\n> +\ttest_must_fail git-svn fetch three 2> stderr.three &&\n> +\tcmp expect.three stderr.three\n\ns/cmp/test_cmp/;\n"},{"id":"86578","messageId":"20080809072806.GA20504@untitled","threadId":"14865","inReplyTo":"7vk5erete1.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/3] Fix multi-glob assertion in git-svn","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-09T07:28:06Z","receivedAt":"2008-08-09T07:28:06Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > From: Marcus Griep <marcus@griep.us>\n> >\n> > Fixes bad regex match check for multiple globs (would always return\n> > one glob regardless of actual number).\n> >\n> > [ew: fixed a bashism in the test and some minor line-wrapping]\n> \n> Thanks both.\n> \n> > +test_expect_success 'test disallow multi-globs' '\n> > ...\n> > +\tcd tmp &&\n> > +\t\techo \"try try\" >> tags/end/src/b/readme &&\n> > +\t\tpoke tags/end/src/b/readme &&\n> > +\t\tsvn commit -m \"try to try\"\n> > +\t\tcd .. &&\n> \n> Do you want to ignore exit code from 'svn commit -m' here?\n\nOops, no missed that.\n\n> In any case, I'd want to see \"temporarily work in subdirectory\" done in a\n> subshell when applicable, so that we won't have to worry about where we\n> are when we later add more tests, like this:\n> \n> \t(\n>         \tcd tmp &&\n>                 echo \"try try\" >>tags/end/src/b/readme &&\n>                 poke tags/end/src/b/readme &&\n>                 svn commit -m \"try to try\" &&\n> \t) &&\n\nYes, that's a good idea\n\n> > +\ttest_must_fail git-svn fetch three 2> stderr.three &&\n> > +\tcmp expect.three stderr.three\n> \n> s/cmp/test_cmp/;\n\nNoted.\n\nShall I make those changes and resubmit or are they simple enough\nfor you to do?\n\n-- \nEric Wong\n"},{"id":"86581","messageId":"7vskte8w89.fsf@gitster.siamese.dyndns.org","threadId":"14865","inReplyTo":"20080809072806.GA20504@untitled","subject":"Re: [PATCH 1/3] Fix multi-glob assertion in git-svn","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-09T07:48:38Z","receivedAt":"2008-08-09T07:48:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> Shall I make those changes and resubmit or are they simple enough\n> for you to do?\n\nI've already queued them with fixups.  Thanks.\n"}]}