{"thread":{"id":"14581","subject":"[PATCH 1/2] git-svn: teach dcommit about svn auto-props","startedAt":"2008-07-21T21:40:26Z","lastAt":"2008-08-05T03:18:16Z","messageCount":11,"participants":["Brad King","Eric Wong","Dmitry Potapov"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"84246","messageId":"4885024A.3050200@kitware.com","threadId":"14581","inReplyTo":null,"subject":"[PATCH 1/2] git-svn: teach dcommit about svn auto-props","fromName":"Brad King","fromEmail":"brad.king@kitware.com","sentAt":"2008-07-21T21:40:26Z","receivedAt":"2008-07-21T21:40:26Z","isPatch":true,"sender":{"key":"brad.king@kitware.com","avatar":"https://avatars.githubusercontent.com/u/87268?v=4"},"body":"\nSubversion repositories often require files to have properties such as\nsvn:mime-type and svn:eol-style set when they are added.  Users\ntypically set these properties automatically using the SVN auto-props\nfeature with 'svn add'.  This commit teaches dcommit to look at the user\nSVN configuration and apply matching auto-props entries for files added\nby a diff as it is applied to the SVN remote.  A later commit will make\nthis feature optional.\n\nSigned-off-by: Brad King <brad.king@kitware.com>\n---\nThis change honors the user's enable-auto-props svn config setting.\nThe next patch will configure this at the git level and add the\ncorresponding documentation.\n\nI've tested this by hand on an real SVN repo that checks for mime type.\nUnfortunately I'm unable to run the git-svn test suite because I get\nthe error reported here:\n\n  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486527\n\n(even without my changes).\n\n git-svn.perl |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\n\n\n\n\n\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 2e0e552..1975b62 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3340,6 +3340,7 @@ sub new {\n \t$self->{rm} = { };\n \t$self->{path_prefix} = length $self->{svn_path} ?\n \t                       \"$self->{svn_path}/\" : '';\n+\t$self->{config} = $opts->{config};\n \treturn $self;\n }\n \n@@ -3528,6 +3529,51 @@ sub ensure_path {\n \treturn $bat->{$c};\n }\n \n+# Subroutine to convert a globbing pattern to a regular expression.\n+# From perl cookbook.\n+sub glob2pat {\n+\tmy $globstr = shift;\n+\tmy %patmap = ('*' => '.*', '?' => '.', '[' => '[', ']' => ']');\n+\t$globstr =~ s{(.)} { $patmap{$1} || \"\\Q$1\" }ge;\n+\treturn '^' . $globstr . '$';\n+}\n+\n+sub check_autoprop {\n+\tmy ($self, $pattern, $properties, $file, $fbat) = @_;\n+\t# Convert the globbing pattern to a regular expression.\n+\tmy $regex = glob2pat($pattern);\n+\t# Check if the pattern matches the file name.\n+\tif($file =~ m/($regex)/) {\n+\t\t# Parse the list of properties to set.\n+\t\tmy @props = split(/;/, $properties);\n+\t\tforeach my $prop (@props) {\n+\t\t\t# Parse 'name=value' syntax and set the property.\n+\t\t\tif ($prop =~ /([^=]+)=(.*)/) {\n+\t\t\t\t$self->change_file_prop($fbat, $1, $2);\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n+sub apply_autoprops {\n+\tmy ($self, $file, $fbat) = @_;\n+\tmy $conf_t = ${$self->{config}}{'config'};\n+\tno warnings 'once';\n+\t# Check [miscellany]/enable-auto-props in svn configuration.\n+\tif (SVN::_Core::svn_config_get_bool($conf_t,\n+\t\t\t\t\t    $SVN::_Core::SVN_CONFIG_SECTION_MISCELLANY,\n+\t\t\t\t\t    $SVN::_Core::SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS,\n+\t\t\t\t\t    0)) {\n+\t\t# Auto-props are enabled.  Enumerate them to look for matches.\n+\t\tmy $callback = sub {\n+\t\t\t$self->check_autoprop($_[0], $_[1], $file, $fbat);\n+\t\t};\n+\t\tSVN::_Core::svn_config_enumerate($conf_t,\n+\t\t\t\t\t\t $SVN::_Core::SVN_CONFIG_SECTION_AUTO_PROPS,\n+\t\t\t\t\t\t $callback);\n+\t}\n+}\n+\n sub A {\n \tmy ($self, $m) = @_;\n \tmy ($dir, $file) = split_path($m->{file_b});\n@@ -3535,6 +3581,7 @@ sub A {\n \tmy $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,\n \t\t\t\t\tundef, -1);\n \tprint \"\\tA\\t$m->{file_b}\\n\" unless $::_q;\n+        $self->apply_autoprops($file, $fbat);\n \t$self->chg_file($fbat, $m);\n \t$self->close_file($fbat,undef,$self->{pool});\n }\n\n\n\n\n\n\n"},{"id":"84835","messageId":"20080725060037.GB14756@untitled","threadId":"14581","inReplyTo":"4885024A.3050200@kitware.com","subject":"Re: [PATCH 1/2] git-svn: teach dcommit about svn auto-props","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-07-25T06:00:37Z","receivedAt":"2008-07-25T06:00:37Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Brad King <brad.king@kitware.com> wrote:\n> \n> Subversion repositories often require files to have properties such as\n> svn:mime-type and svn:eol-style set when they are added.  Users\n> typically set these properties automatically using the SVN auto-props\n> feature with 'svn add'.  This commit teaches dcommit to look at the user\n> SVN configuration and apply matching auto-props entries for files added\n> by a diff as it is applied to the SVN remote.  A later commit will make\n> this feature optional.\n> \n> Signed-off-by: Brad King <brad.king@kitware.com>\n\nHi Brad,\n\nI like this patch.  Can we get an automated test of this functionality?\nWe can (and probably should) set $HOME for the test and ignore the\nexisting ~/.subversion/config of the user.\n\nAlso, some minor nitpicks on whitespace/formatting inline below.\n\nNot sure if writing a new unit test will trigger that bug below for you.\nIt really shouldn't...\n\n> ---\n> This change honors the user's enable-auto-props svn config setting.\n> The next patch will configure this at the git level and add the\n> corresponding documentation.\n> \n> I've tested this by hand on an real SVN repo that checks for mime type.\n> Unfortunately I'm unable to run the git-svn test suite because I get\n> the error reported here:\n> \n>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486527\n>\n> (even without my changes).\n\nI haven't had the chance to look at this.   Can anybody else shed more\nlight on that bug?  It's really strange that the tests won't run because\nof it.  Are you unable to run some git-svn tests or all of them?\n\n<snip>\n\n> +sub apply_autoprops {\n> +\tmy ($self, $file, $fbat) = @_;\n> +\tmy $conf_t = ${$self->{config}}{'config'};\n> +\tno warnings 'once';\n> +\t# Check [miscellany]/enable-auto-props in svn configuration.\n> +\tif (SVN::_Core::svn_config_get_bool($conf_t,\n> +\t\t\t\t\t    $SVN::_Core::SVN_CONFIG_SECTION_MISCELLANY,\n> +\t\t\t\t\t    $SVN::_Core::SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS,\n\nLong lines here and below.  I'd rather just align to the left (tabs are\nassumed to be 8 characters wide on screen).\n\n> +\t\t\t\t\t    0)) {\n> +\t\t# Auto-props are enabled.  Enumerate them to look for matches.\n> +\t\tmy $callback = sub {\n> +\t\t\t$self->check_autoprop($_[0], $_[1], $file, $fbat);\n> +\t\t};\n> +\t\tSVN::_Core::svn_config_enumerate($conf_t,\n> +\t\t\t\t\t\t $SVN::_Core::SVN_CONFIG_SECTION_AUTO_PROPS,\n> +\t\t\t\t\t\t $callback);\n> +\t}\n> +}\n> +\n>  sub A {\n>  \tmy ($self, $m) = @_;\n>  \tmy ($dir, $file) = split_path($m->{file_b});\n> @@ -3535,6 +3581,7 @@ sub A {\n>  \tmy $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,\n>  \t\t\t\t\tundef, -1);\n>  \tprint \"\\tA\\t$m->{file_b}\\n\" unless $::_q;\n> +        $self->apply_autoprops($file, $fbat);\n\nHard tabs are used for indentation.\n\nThanks!\n\n-- \nEric Wong\n"},{"id":"84893","messageId":"4889F215.9020804@kitware.com","threadId":"14581","inReplyTo":"20080725060037.GB14756@untitled","subject":"[PATCH] git-svn: teach dcommit about svn auto-props","fromName":"Brad King","fromEmail":"brad.king@kitware.com","sentAt":"2008-07-25T15:32:37Z","receivedAt":"2008-07-25T15:32:37Z","isPatch":true,"sender":{"key":"brad.king@kitware.com","avatar":"https://avatars.githubusercontent.com/u/87268?v=4"},"body":"\nSubversion repositories often require files to have properties such as\nsvn:mime-type and svn:eol-style set when they are added.  Users\ntypically set these properties automatically using the SVN auto-props\nfeature with 'svn add'.  This commit teaches dcommit to look at the user\nSVN configuration and apply matching auto-props entries for files added\nby a diff as it is applied to the SVN remote.\n\nSigned-off-by: Brad King <brad.king@kitware.com>\n---\nEric Wong wrote:\n> I like this patch.\n\nThanks.\n\n> Can we get an automated test of this functionality?\n\nThis patch adds a test.  I also fixed the property name/value parsing\nto remove leading and trailing whitespace.\n\n> We can (and probably should) set $HOME for the test and ignore the\n> existing ~/.subversion/config of the user.\n\nI used the --config-dir option.\n\n> Also, some minor nitpicks on whitespace/formatting inline below.\n\nAddressed.  I missed the wrong indentation before because my second patch\nremoved it.\n\n> I haven't had the chance to look at this.   Can anybody else shed more\n> light on that bug?  It's really strange that the tests won't run because\n> of it.  Are you unable to run some git-svn tests or all of them?\n\nJust that one fails.  All others (including the one in the patch below) pass.\n\nThanks for reviewing,\n-Brad\n\n git-svn.perl                          |   52 ++++++++++++++++++++\n t/t9124-git-svn-dcommit-auto-props.sh |   84 +++++++++++++++++++++++++++++++++\n 2 files changed, 136 insertions(+), 0 deletions(-)\n create mode 100755 t/t9124-git-svn-dcommit-auto-props.sh\n\n\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 2e0e552..0a8e907 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3340,6 +3340,7 @@ sub new {\n \t$self->{rm} = { };\n \t$self->{path_prefix} = length $self->{svn_path} ?\n \t                       \"$self->{svn_path}/\" : '';\n+\t$self->{config} = $opts->{config};\n \treturn $self;\n }\n \n@@ -3528,6 +3529,56 @@ sub ensure_path {\n \treturn $bat->{$c};\n }\n \n+# Subroutine to convert a globbing pattern to a regular expression.\n+# From perl cookbook.\n+sub glob2pat {\n+\tmy $globstr = shift;\n+\tmy %patmap = ('*' => '.*', '?' => '.', '[' => '[', ']' => ']');\n+\t$globstr =~ s{(.)} { $patmap{$1} || \"\\Q$1\" }ge;\n+\treturn '^' . $globstr . '$';\n+}\n+\n+sub check_autoprop {\n+\tmy ($self, $pattern, $properties, $file, $fbat) = @_;\n+\t# Convert the globbing pattern to a regular expression.\n+\tmy $regex = glob2pat($pattern);\n+\t# Check if the pattern matches the file name.\n+\tif($file =~ m/($regex)/) {\n+\t\t# Parse the list of properties to set.\n+\t\tmy @props = split(/;/, $properties);\n+\t\tforeach my $prop (@props) {\n+\t\t\t# Parse 'name=value' syntax and set the property.\n+\t\t\tif ($prop =~ /([^=]+)=(.*)/) {\n+\t\t\t\tmy ($n,$v) = ($1,$2);\n+\t\t\t\t$n =~ s/^\\s+//; $n =~ s/\\s+$//;\n+\t\t\t\t$v =~ s/^\\s+//; $v =~ s/\\s+$//;\n+\t\t\t\t$self->change_file_prop($fbat, $n, $v);\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n+sub apply_autoprops {\n+\tmy ($self, $file, $fbat) = @_;\n+\tmy $conf_t = ${$self->{config}}{'config'};\n+\tno warnings 'once';\n+\t# Check [miscellany]/enable-auto-props in svn configuration.\n+\tif (SVN::_Core::svn_config_get_bool(\n+\t\t$conf_t,\n+\t\t$SVN::_Core::SVN_CONFIG_SECTION_MISCELLANY,\n+\t\t$SVN::_Core::SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS,\n+\t\t0)) {\n+\t\t# Auto-props are enabled.  Enumerate them to look for matches.\n+\t\tmy $callback = sub {\n+\t\t\t$self->check_autoprop($_[0], $_[1], $file, $fbat);\n+\t\t};\n+\t\tSVN::_Core::svn_config_enumerate(\n+\t\t\t$conf_t,\n+\t\t\t$SVN::_Core::SVN_CONFIG_SECTION_AUTO_PROPS,\n+\t\t\t$callback);\n+\t}\n+}\n+\n sub A {\n \tmy ($self, $m) = @_;\n \tmy ($dir, $file) = split_path($m->{file_b});\n@@ -3535,6 +3586,7 @@ sub A {\n \tmy $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,\n \t\t\t\t\tundef, -1);\n \tprint \"\\tA\\t$m->{file_b}\\n\" unless $::_q;\n+\t$self->apply_autoprops($file, $fbat);\n \t$self->chg_file($fbat, $m);\n \t$self->close_file($fbat,undef,$self->{pool});\n }\ndiff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh\nnew file mode 100755\nindex 0000000..beefbcc\n--- /dev/null\n+++ b/t/t9124-git-svn-dcommit-auto-props.sh\n@@ -0,0 +1,84 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Brad King\n+\n+test_description='git-svn dcommit honors auto-props'\n+\n+. ./lib-git-svn.sh\n+\n+generate_auto_props() {\n+cat << EOF\n+[miscellany]\n+enable-auto-props=$1\n+[auto-props]\n+*.sh  = svn:mime-type=application/x-shellscript; svn:eol-style=LF\n+*.txt = svn:mime-type=text/plain; svn:eol-style = native\n+EOF\n+}\n+\n+test_expect_success 'initialize git-svn' '\n+\tmkdir import &&\n+\tcd import &&\n+\techo foo > foo &&\n+\tsvn import -m \"import for git-svn\" . \"$svnrepo\" >/dev/null &&\n+\tcd .. &&\n+\trm -rf import &&\n+\tgit-svn init \"$svnrepo\"\n+\tgit-svn fetch'\n+\n+test_expect_success 'enable auto-props config' '\n+\tcd \"$gittestrepo\" &&\n+\tmkdir user &&\n+\tgenerate_auto_props yes > user/config\n+\t'\n+\n+test_expect_success 'add files matching auto-props' '\n+\tcd \"$gittestrepo\" &&\n+\techo \"#!/bin/sh\" > exec1.sh &&\n+\tchmod +x exec1.sh &&\n+\techo \"hello\" > hello.txt &&\n+\techo bar > bar &&\n+\tgit add exec1.sh hello.txt bar &&\n+\tgit commit -m \"files for enabled auto-props\" &&\n+\tgit svn dcommit --config-dir=user\n+\t'\n+\n+test_expect_success 'disable auto-props config' '\n+\tcd \"$gittestrepo\" &&\n+\tgenerate_auto_props no > user/config\n+\t'\n+\n+test_expect_success 'add files matching disabled auto-props' '\n+\tcd \"$gittestrepo\" &&\n+\techo \"#!/bin/sh\" > exec2.sh &&\n+\tchmod +x exec2.sh &&\n+\techo \"world\" > world.txt &&\n+\techo zot > zot &&\n+\tgit add exec2.sh world.txt zot &&\n+\tgit commit -m \"files for disabled auto-props\" &&\n+\tgit svn dcommit --config-dir=user\n+\t'\n+\n+test_expect_success 'check resulting svn repository' '\n+\tmkdir work &&\n+\tcd work &&\n+\tsvn co \"$svnrepo\" &&\n+\tcd svnrepo &&\n+\n+\t# Check properties from first commit.\n+\ttest \"x$(svn propget svn:executable exec1.sh)\" = \"x*\" &&\n+\ttest \"x$(svn propget svn:mime-type exec1.sh)\" = \\\n+\t     \"xapplication/x-shellscript\" &&\n+\ttest \"x$(svn propget svn:mime-type hello.txt)\" = \"xtext/plain\" &&\n+\ttest \"x$(svn propget svn:eol-style hello.txt)\" = \"xnative\" &&\n+\ttest \"x$(svn propget svn:mime-type bar)\" = \"x\" &&\n+\n+\t# Check properties from second commit.\n+\ttest \"x$(svn propget svn:executable exec2.sh)\" = \"x*\" &&\n+\ttest \"x$(svn propget svn:mime-type exec2.sh)\" = \"x\" &&\n+\ttest \"x$(svn propget svn:mime-type world.txt)\" = \"x\" &&\n+\ttest \"x$(svn propget svn:eol-style world.txt)\" = \"x\" &&\n+\ttest \"x$(svn propget svn:mime-type zot)\" = \"x\"\n+\t'\n+\n+test_done\n\n\n"},{"id":"85015","messageId":"20080726054547.GA20494@untitled","threadId":"14581","inReplyTo":"4889F215.9020804@kitware.com","subject":"Re: [PATCH] git-svn: teach dcommit about svn auto-props","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-07-26T05:45:47Z","receivedAt":"2008-07-26T05:45:47Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Brad King <brad.king@kitware.com> wrote:\n> \n> Subversion repositories often require files to have properties such as\n> svn:mime-type and svn:eol-style set when they are added.  Users\n> typically set these properties automatically using the SVN auto-props\n> feature with 'svn add'.  This commit teaches dcommit to look at the user\n> SVN configuration and apply matching auto-props entries for files added\n> by a diff as it is applied to the SVN remote.\n> \n> Signed-off-by: Brad King <brad.king@kitware.com>\n\nThanks Brad,\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n> Eric Wong wrote:\n> > I like this patch.\n> \n> Thanks.\n> \n> > Can we get an automated test of this functionality?\n> \n> This patch adds a test.  I also fixed the property name/value parsing\n> to remove leading and trailing whitespace.\n> \n> > We can (and probably should) set $HOME for the test and ignore the\n> > existing ~/.subversion/config of the user.\n> \n> I used the --config-dir option.\n> \n> > Also, some minor nitpicks on whitespace/formatting inline below.\n> \n> Addressed.  I missed the wrong indentation before because my second patch\n> removed it.\n> \n> > I haven't had the chance to look at this.   Can anybody else shed more\n> > light on that bug?  It's really strange that the tests won't run because\n> > of it.  Are you unable to run some git-svn tests or all of them?\n> \n> Just that one fails.  All others (including the one in the patch below) pass.\n\nExactly which test fails for you?  Perhaps it's some setting in your\n~/.subversion/config that's causing it to fail.  Maybe we should set\n$HOME and use a clean ~/.subversion/config for git-svn tests regardless\nif that turns out to be the case...\n\n> Thanks for reviewing,\n> -Brad\n> \n>  git-svn.perl                          |   52 ++++++++++++++++++++\n>  t/t9124-git-svn-dcommit-auto-props.sh |   84 +++++++++++++++++++++++++++++++++\n>  2 files changed, 136 insertions(+), 0 deletions(-)\n>  create mode 100755 t/t9124-git-svn-dcommit-auto-props.sh\n> \n\n> diff --git a/git-svn.perl b/git-svn.perl\n> index 2e0e552..0a8e907 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -3340,6 +3340,7 @@ sub new {\n>  \t$self->{rm} = { };\n>  \t$self->{path_prefix} = length $self->{svn_path} ?\n>  \t                       \"$self->{svn_path}/\" : '';\n> +\t$self->{config} = $opts->{config};\n>  \treturn $self;\n>  }\n>  \n> @@ -3528,6 +3529,56 @@ sub ensure_path {\n>  \treturn $bat->{$c};\n>  }\n>  \n> +# Subroutine to convert a globbing pattern to a regular expression.\n> +# From perl cookbook.\n> +sub glob2pat {\n> +\tmy $globstr = shift;\n> +\tmy %patmap = ('*' => '.*', '?' => '.', '[' => '[', ']' => ']');\n> +\t$globstr =~ s{(.)} { $patmap{$1} || \"\\Q$1\" }ge;\n> +\treturn '^' . $globstr . '$';\n> +}\n> +\n> +sub check_autoprop {\n> +\tmy ($self, $pattern, $properties, $file, $fbat) = @_;\n> +\t# Convert the globbing pattern to a regular expression.\n> +\tmy $regex = glob2pat($pattern);\n> +\t# Check if the pattern matches the file name.\n> +\tif($file =~ m/($regex)/) {\n> +\t\t# Parse the list of properties to set.\n> +\t\tmy @props = split(/;/, $properties);\n> +\t\tforeach my $prop (@props) {\n> +\t\t\t# Parse 'name=value' syntax and set the property.\n> +\t\t\tif ($prop =~ /([^=]+)=(.*)/) {\n> +\t\t\t\tmy ($n,$v) = ($1,$2);\n> +\t\t\t\t$n =~ s/^\\s+//; $n =~ s/\\s+$//;\n> +\t\t\t\t$v =~ s/^\\s+//; $v =~ s/\\s+$//;\n> +\t\t\t\t$self->change_file_prop($fbat, $n, $v);\n> +\t\t\t}\n> +\t\t}\n> +\t}\n> +}\n> +\n> +sub apply_autoprops {\n> +\tmy ($self, $file, $fbat) = @_;\n> +\tmy $conf_t = ${$self->{config}}{'config'};\n> +\tno warnings 'once';\n> +\t# Check [miscellany]/enable-auto-props in svn configuration.\n> +\tif (SVN::_Core::svn_config_get_bool(\n> +\t\t$conf_t,\n> +\t\t$SVN::_Core::SVN_CONFIG_SECTION_MISCELLANY,\n> +\t\t$SVN::_Core::SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS,\n> +\t\t0)) {\n> +\t\t# Auto-props are enabled.  Enumerate them to look for matches.\n> +\t\tmy $callback = sub {\n> +\t\t\t$self->check_autoprop($_[0], $_[1], $file, $fbat);\n> +\t\t};\n> +\t\tSVN::_Core::svn_config_enumerate(\n> +\t\t\t$conf_t,\n> +\t\t\t$SVN::_Core::SVN_CONFIG_SECTION_AUTO_PROPS,\n> +\t\t\t$callback);\n> +\t}\n> +}\n> +\n>  sub A {\n>  \tmy ($self, $m) = @_;\n>  \tmy ($dir, $file) = split_path($m->{file_b});\n> @@ -3535,6 +3586,7 @@ sub A {\n>  \tmy $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,\n>  \t\t\t\t\tundef, -1);\n>  \tprint \"\\tA\\t$m->{file_b}\\n\" unless $::_q;\n> +\t$self->apply_autoprops($file, $fbat);\n>  \t$self->chg_file($fbat, $m);\n>  \t$self->close_file($fbat,undef,$self->{pool});\n>  }\n> diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh\n> new file mode 100755\n> index 0000000..beefbcc\n> --- /dev/null\n> +++ b/t/t9124-git-svn-dcommit-auto-props.sh\n> @@ -0,0 +1,84 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2008 Brad King\n> +\n> +test_description='git-svn dcommit honors auto-props'\n> +\n> +. ./lib-git-svn.sh\n> +\n> +generate_auto_props() {\n> +cat << EOF\n> +[miscellany]\n> +enable-auto-props=$1\n> +[auto-props]\n> +*.sh  = svn:mime-type=application/x-shellscript; svn:eol-style=LF\n> +*.txt = svn:mime-type=text/plain; svn:eol-style = native\n> +EOF\n> +}\n> +\n> +test_expect_success 'initialize git-svn' '\n> +\tmkdir import &&\n> +\tcd import &&\n> +\techo foo > foo &&\n> +\tsvn import -m \"import for git-svn\" . \"$svnrepo\" >/dev/null &&\n> +\tcd .. &&\n> +\trm -rf import &&\n> +\tgit-svn init \"$svnrepo\"\n> +\tgit-svn fetch'\n> +\n> +test_expect_success 'enable auto-props config' '\n> +\tcd \"$gittestrepo\" &&\n> +\tmkdir user &&\n> +\tgenerate_auto_props yes > user/config\n> +\t'\n> +\n> +test_expect_success 'add files matching auto-props' '\n> +\tcd \"$gittestrepo\" &&\n> +\techo \"#!/bin/sh\" > exec1.sh &&\n> +\tchmod +x exec1.sh &&\n> +\techo \"hello\" > hello.txt &&\n> +\techo bar > bar &&\n> +\tgit add exec1.sh hello.txt bar &&\n> +\tgit commit -m \"files for enabled auto-props\" &&\n> +\tgit svn dcommit --config-dir=user\n> +\t'\n> +\n> +test_expect_success 'disable auto-props config' '\n> +\tcd \"$gittestrepo\" &&\n> +\tgenerate_auto_props no > user/config\n> +\t'\n> +\n> +test_expect_success 'add files matching disabled auto-props' '\n> +\tcd \"$gittestrepo\" &&\n> +\techo \"#!/bin/sh\" > exec2.sh &&\n> +\tchmod +x exec2.sh &&\n> +\techo \"world\" > world.txt &&\n> +\techo zot > zot &&\n> +\tgit add exec2.sh world.txt zot &&\n> +\tgit commit -m \"files for disabled auto-props\" &&\n> +\tgit svn dcommit --config-dir=user\n> +\t'\n> +\n> +test_expect_success 'check resulting svn repository' '\n> +\tmkdir work &&\n> +\tcd work &&\n> +\tsvn co \"$svnrepo\" &&\n> +\tcd svnrepo &&\n> +\n> +\t# Check properties from first commit.\n> +\ttest \"x$(svn propget svn:executable exec1.sh)\" = \"x*\" &&\n> +\ttest \"x$(svn propget svn:mime-type exec1.sh)\" = \\\n> +\t     \"xapplication/x-shellscript\" &&\n> +\ttest \"x$(svn propget svn:mime-type hello.txt)\" = \"xtext/plain\" &&\n> +\ttest \"x$(svn propget svn:eol-style hello.txt)\" = \"xnative\" &&\n> +\ttest \"x$(svn propget svn:mime-type bar)\" = \"x\" &&\n> +\n> +\t# Check properties from second commit.\n> +\ttest \"x$(svn propget svn:executable exec2.sh)\" = \"x*\" &&\n> +\ttest \"x$(svn propget svn:mime-type exec2.sh)\" = \"x\" &&\n> +\ttest \"x$(svn propget svn:mime-type world.txt)\" = \"x\" &&\n> +\ttest \"x$(svn propget svn:eol-style world.txt)\" = \"x\" &&\n> +\ttest \"x$(svn propget svn:mime-type zot)\" = \"x\"\n> +\t'\n> +\n> +test_done\n\n-- \nEric Wong\n"},{"id":"85057","messageId":"488B2FC5.4080801@kitware.com","threadId":"14581","inReplyTo":"20080726054547.GA20494@untitled","subject":"Re: [PATCH] git-svn: teach dcommit about svn auto-props","fromName":"Brad King","fromEmail":"brad.king@kitware.com","sentAt":"2008-07-26T14:08:05Z","receivedAt":"2008-07-26T14:08:05Z","isPatch":true,"sender":{"key":"brad.king@kitware.com","avatar":"https://avatars.githubusercontent.com/u/87268?v=4"},"body":"Eric Wong wrote:\n> Brad King <brad.king@kitware.com> wrote:\n>> Signed-off-by: Brad King <brad.king@kitware.com>\n> \n> Acked-by: Eric Wong <normalperson@yhbt.net>\n\nGreat, thanks!\n\n>> ---\n>> Eric Wong wrote:\n>>> I haven't had the chance to look at this.   Can anybody else shed more\n>>> light on that bug?  It's really strange that the tests won't run because\n>>> of it.  Are you unable to run some git-svn tests or all of them?\n>> Just that one fails.  All others (including the one in the patch below) pass.\n> \n> Exactly which test fails for you?  Perhaps it's some setting in your\n> ~/.subversion/config that's causing it to fail.  Maybe we should set\n> $HOME and use a clean ~/.subversion/config for git-svn tests regardless\n> if that turns out to be the case...\n\n$ cd $gitsrc/t\n$ export SVNSERVE_PORT=5432\n$ ./t9113-git-svn-dcommit-new-file.sh\n*   ok 1: start tracking an empty repo\n* FAIL 2: create files in new directory with dcommit\n\n                mkdir git-new-dir &&\n                echo hello > git-new-dir/world &&\n                git update-index --add git-new-dir/world &&\n                git commit -m hello &&\n                start_svnserve &&\n                git svn dcommit\n\n* failed 1 among 2 test(s)\n\nI hacked the test script to log the dcommit output to a file, and I see\nthis:\n\nCommitting to svn://127.0.0.1:5432 ...\nUse of uninitialized value in concatenation (.) or string at\n/usr/lib/perl5/SVN/Core.pm line 584.\nAuthorization failed:  at $gitsrc/t/../git-svn line 3329\n\n(I replaced my git source dir full path with $gitsrc).\n\nThe version of libsvn-perl is:  1.5.0dfsg1-4\n\nPlease let me know if you need more info.\n\nI tried moving my ~/.subversion/config out of the way but it makes no\ndifference.  However, I agree we should block the user's home svn config\nwhen running other dcommit tests now that we have auto-props.  Perhaps\njust using the --config-dir option with an empty directory would be enough.\n\n-Brad\n"},{"id":"86113","messageId":"20080803220251.GB3006@untitled","threadId":"14581","inReplyTo":"488B2FC5.4080801@kitware.com","subject":"[RFH] - git-svn auth bug (possibly SVN 1.5.0-related)","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-03T22:02:51Z","receivedAt":"2008-08-03T22:02:51Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Brad King <brad.king@kitware.com> wrote:\n> Eric Wong wrote:\n> > Brad King <brad.king@kitware.com> wrote:\n> >> Eric Wong wrote:\n> >>> I haven't had the chance to look at this.   Can anybody else shed more\n> >>> light on that bug?  It's really strange that the tests won't run because\n> >>> of it.  Are you unable to run some git-svn tests or all of them?\n> >> Just that one fails.  All others (including the one in the patch below) pass.\n> > \n> > Exactly which test fails for you?  Perhaps it's some setting in your\n> > ~/.subversion/config that's causing it to fail.  Maybe we should set\n> > $HOME and use a clean ~/.subversion/config for git-svn tests regardless\n> > if that turns out to be the case...\n> \n> $ cd $gitsrc/t\n> $ export SVNSERVE_PORT=5432\n> $ ./t9113-git-svn-dcommit-new-file.sh\n> *   ok 1: start tracking an empty repo\n> * FAIL 2: create files in new directory with dcommit\n> \n>                 mkdir git-new-dir &&\n>                 echo hello > git-new-dir/world &&\n>                 git update-index --add git-new-dir/world &&\n>                 git commit -m hello &&\n>                 start_svnserve &&\n>                 git svn dcommit\n> \n> * failed 1 among 2 test(s)\n> \n> I hacked the test script to log the dcommit output to a file, and I see\n> this:\n> \n> Committing to svn://127.0.0.1:5432 ...\n> Use of uninitialized value in concatenation (.) or string at\n> /usr/lib/perl5/SVN/Core.pm line 584.\n> Authorization failed:  at $gitsrc/t/../git-svn line 3329\n> \n> (I replaced my git source dir full path with $gitsrc).\n> \n> The version of libsvn-perl is:  1.5.0dfsg1-4\n\nIt could be another incompatibility introduced in SVN 1.5.0.\n\nI'll try to dist-upgrade a machine to Lenny sometime in the next two\nweeks so I can test; I'm pretty busy these days but if anybody else\nwants to figure this out in the meantime, please do :)\n\n> Please let me know if you need more info.\n> \n> I tried moving my ~/.subversion/config out of the way but it makes no\n> difference.  However, I agree we should block the user's home svn config\n> when running other dcommit tests now that we have auto-props.  Perhaps\n> just using the --config-dir option with an empty directory would be enough.\n\nThanks for the additional info!\n\n-- \nEric Wong\n"},{"id":"86192","messageId":"20080804141820.GT7008@dpotapov.dyndns.org","threadId":"14581","inReplyTo":"20080803220251.GB3006@untitled","subject":"Re: [RFH] - git-svn auth bug (possibly SVN 1.5.0-related)","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-08-04T14:18:20Z","receivedAt":"2008-08-04T14:18:20Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sun, Aug 03, 2008 at 03:02:51PM -0700, Eric Wong wrote:\n> \n> It could be another incompatibility introduced in SVN 1.5.0.\n> \n> I'll try to dist-upgrade a machine to Lenny sometime in the next two\n> weeks so I can test; I'm pretty busy these days but if anybody else\n> wants to figure this out in the meantime, please do :)\n\nThe problem happens only if you use FS format 3 regardless what version\nof SVN perl binding you use. Also, there is no problem with using SVN\n1.5 (I tried 1.5.1) as long as you use FS format 2 (I tested git-svn\nwith libsvn-perl 1.4.2 and 1.5.1 works fine) but if your repository is\ninitialized to use FS format 3 (which is the default in SVN 1.5) then\nthis problem happens with all versions of SVN perl binding, and it\nhappens exactly in the same place:\n\n /home/dpotapov/git/git-svn:3333:    my @ce  = $opts->{ra}->get_commit_editor($opts->{log},\nsub get_commit_editor {\n /home/dpotapov/git/git-svn:3909:    my ($self, $log, $cb, $pool) = @_;\n /home/dpotapov/git/git-svn:3910:    my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef, 0) : ();\n /home/dpotapov/git/git-svn:3911:    $self->SUPER::get_commit_editor($log, $cb, @lock, $pool);\nsub AUTOLOAD {\n /usr/lib/perl5/SVN/Ra.pm:74:     my $class = ref($_[0]);\n /usr/lib/perl5/SVN/Ra.pm:75:     my $method = $AUTOLOAD;\n /usr/lib/perl5/SVN/Ra.pm:76:     $method =~ s/.*:://;\n /usr/lib/perl5/SVN/Ra.pm:77:     return unless $method =~ m/[^A-Z]/;\n /usr/lib/perl5/SVN/Ra.pm:79:     my $self = shift;\n /usr/lib/perl5/SVN/Ra.pm:82:     my $func = $self->{session}->can ($method)\n /usr/lib/perl5/SVN/Ra.pm:85:     my @ret = $func->($self->{session}, @_);\n\nNumbers of lines may be different for different versions of libsvn-perl,\nbut the effect is exactly the same. Instead of going to the next line\nand completing AUTOLOAD, if you use FS format 3 then you end up in\ncroak_on_error(), which uses some uninitialized value in string\nconcatenation (which produces an additional warning) and then calls\ncroak(). End of the story :(\n\n\nDmitry\n"},{"id":"86203","messageId":"20080804151424.GU7008@dpotapov.dyndns.org","threadId":"14581","inReplyTo":"20080804141820.GT7008@dpotapov.dyndns.org","subject":"Re: [RFH] - git-svn auth bug (possibly SVN 1.5.0-related)","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-08-04T15:14:24Z","receivedAt":"2008-08-04T15:14:24Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Mon, Aug 04, 2008 at 06:18:20PM +0400, Dmitry Potapov wrote:\n> Numbers of lines may be different for different versions of libsvn-perl,\n> but the effect is exactly the same. Instead of going to the next line\n> and completing AUTOLOAD, if you use FS format 3 then you end up in\n> croak_on_error(), which uses some uninitialized value in string\n> concatenation (which produces an additional warning) and then calls\n> croak(). End of the story :(\n\nI think I have figured out that is wrong. It is a bug in initialization\nof SVN database. Before, there was only one [general] section in the\nconf/svnserve.conf file and the procedure of initialization apparently\ncopied a template and added the following string to the end of file:\n\nanon-access = write\n\nbut now there are two sections: [general] and [sasl]\n\nas result \"anon-access = write\" is added to the wrong section,\nand there is no anonymous access anymore. So, the test fails.\n\n\nDmitry\n"},{"id":"86206","messageId":"20080804153024.GV7008@dpotapov.dyndns.org","threadId":"14581","inReplyTo":"20080804151424.GU7008@dpotapov.dyndns.org","subject":"[PATCH] correct access right for git-svn-dcommit test","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-08-04T15:30:24Z","receivedAt":"2008-08-04T15:30:24Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"The tests requires anonymous write access. Therefore, \"anon-access =\nwrite\" is added to conf/svnserve.conf. But because it was added to\nthe end of the file, it is impossible to guarantee in what section\nit will be located. It turned out that on SVN 1.5, it was placed in\nthe wrong section and as result the test failed.\n\nSigned-off-by: Dmitry Potapov <dpotapov@gmail.com>\n---\n t/t9113-git-svn-dcommit-new-file.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh\nindex 8da8ce5..ae78e33 100755\n--- a/t/t9113-git-svn-dcommit-new-file.sh\n+++ b/t/t9113-git-svn-dcommit-new-file.sh\n@@ -28,6 +28,7 @@ start_svnserve () {\n \n test_expect_success 'start tracking an empty repo' '\n \tsvn mkdir -m \"empty dir\" \"$svnrepo\"/empty-dir &&\n+\techo \"[general]\" > \"$rawsvnrepo\"/conf/svnserve.conf &&\n \techo anon-access = write >> \"$rawsvnrepo\"/conf/svnserve.conf &&\n \tstart_svnserve &&\n \tgit svn init svn://127.0.0.1:$SVNSERVE_PORT &&\n-- \n1.6.0.rc1.74.g1e94\n"},{"id":"86208","messageId":"489723C6.7060806@kitware.com","threadId":"14581","inReplyTo":"20080804153024.GV7008@dpotapov.dyndns.org","subject":"Re: [PATCH] correct access right for git-svn-dcommit test","fromName":"Brad King","fromEmail":"brad.king@kitware.com","sentAt":"2008-08-04T15:44:06Z","receivedAt":"2008-08-04T15:44:06Z","isPatch":true,"sender":{"key":"brad.king@kitware.com","avatar":"https://avatars.githubusercontent.com/u/87268?v=4"},"body":"Dmitry Potapov wrote:\n> The tests requires anonymous write access. Therefore, \"anon-access =\n> write\" is added to conf/svnserve.conf. But because it was added to\n> the end of the file, it is impossible to guarantee in what section\n> it will be located. It turned out that on SVN 1.5, it was placed in\n> the wrong section and as result the test failed.\n> \n> Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>\n> ---\n>  t/t9113-git-svn-dcommit-new-file.sh |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh\n> index 8da8ce5..ae78e33 100755\n> --- a/t/t9113-git-svn-dcommit-new-file.sh\n> +++ b/t/t9113-git-svn-dcommit-new-file.sh\n> @@ -28,6 +28,7 @@ start_svnserve () {\n>  \n>  test_expect_success 'start tracking an empty repo' '\n>  \tsvn mkdir -m \"empty dir\" \"$svnrepo\"/empty-dir &&\n> +\techo \"[general]\" > \"$rawsvnrepo\"/conf/svnserve.conf &&\n>  \techo anon-access = write >> \"$rawsvnrepo\"/conf/svnserve.conf &&\n>  \tstart_svnserve &&\n>  \tgit svn init svn://127.0.0.1:$SVNSERVE_PORT &&\n\nI just tried this patch and it does fix the test on my system.\n\nThanks,\n-Brad\n"},{"id":"86250","messageId":"20080805031816.GA9505@yp-box.dyndns.org","threadId":"14581","inReplyTo":"20080804153024.GV7008@dpotapov.dyndns.org","subject":"Re: [PATCH] correct access right for git-svn-dcommit test","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-05T03:18:16Z","receivedAt":"2008-08-05T03:18:16Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Dmitry Potapov <dpotapov@gmail.com> wrote:\n> The tests requires anonymous write access. Therefore, \"anon-access =\n> write\" is added to conf/svnserve.conf. But because it was added to\n> the end of the file, it is impossible to guarantee in what section\n> it will be located. It turned out that on SVN 1.5, it was placed in\n> the wrong section and as result the test failed.\n> \n> Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>\n\nBrad and Dmitry: Thank you both very much.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n>  t/t9113-git-svn-dcommit-new-file.sh |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh\n> index 8da8ce5..ae78e33 100755\n> --- a/t/t9113-git-svn-dcommit-new-file.sh\n> +++ b/t/t9113-git-svn-dcommit-new-file.sh\n> @@ -28,6 +28,7 @@ start_svnserve () {\n>  \n>  test_expect_success 'start tracking an empty repo' '\n>  \tsvn mkdir -m \"empty dir\" \"$svnrepo\"/empty-dir &&\n> +\techo \"[general]\" > \"$rawsvnrepo\"/conf/svnserve.conf &&\n>  \techo anon-access = write >> \"$rawsvnrepo\"/conf/svnserve.conf &&\n>  \tstart_svnserve &&\n>  \tgit svn init svn://127.0.0.1:$SVNSERVE_PORT &&\n> -- \n> 1.6.0.rc1.74.g1e94\n"}]}