Subject: [PATCH 2/2] git-svn: make use of svn auto-props optional

From: Brad King <[email-masked]>
Date: Mon, 21 Jul 2008 17:40:29 -0400

In order to preserve existing default behavior, dcommit should use svn
auto-props only if instructed to do so.  This commit creates a config
option 'svn.autoprops' to enable the behavior.

Signed-off-by: Brad King <[email-masked]>
---
Topics for discussion:

Should we instead call this option 'useAutoProps' or some other name?

Does a 'svn-remote.<name>.autoprops' version make sense?
(I'll need help with this one because I'm learning perl just for this).

Should we still honor/require the svn config option 'enable-auto-props',
or treat that as an option specific to 'svn add' and let this git-specific
one take over here?

 Documentation/git-svn.txt |    7 +++++++
 git-svn.perl              |    7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index e7c0f1c..300a9e0 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -448,6 +448,13 @@ svn-remote.<name>.rewriteRoot::
 	the repository with a public http:// or svn:// URL in the
 	metadata so users of it will see the public URL.
 
+svn.autoprops::
+
+	Tells 'dcommit' to use '[auto-props]' entries from the user
+	SVN configuration to set properties on added files.  The
+	'enable-auto-props' option in the user SVN configuration must
+	also be enabled.
+
 --
 
 Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
diff --git a/git-svn.perl b/git-svn.perl
index 1975b62..9e8799d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -73,6 +73,7 @@ my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
                     'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache );
 my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
 		'authors-file|A=s' => \$_authors,
+		'autoprops' => \$Git::SVN::_auto_props,
 		'repack:i' => \$Git::SVN::_repack,
 		'noMetadata' => \$Git::SVN::_no_metadata,
 		'useSvmProps' => \$Git::SVN::_use_svm_props,
@@ -1273,7 +1274,7 @@ use constant rev_map_fmt => 'NH40';
 use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
             $_repack $_repack_flags $_use_svm_props $_head
             $_use_svnsync_props $no_reuse_existing $_minimize_url
-	    $_use_log_author $_add_author_from/;
+	    $_use_log_author $_add_author_from $_auto_props/;
 use Carp qw/croak/;
 use File::Path qw/mkpath/;
 use File::Copy qw/copy/;
@@ -3581,7 +3582,9 @@ sub A {
 	my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
 					undef, -1);
 	print "\tA\t$m->{file_b}\n" unless $::_q;
-        $self->apply_autoprops($file, $fbat);
+	if ($Git::SVN::_auto_props) {
+		$self->apply_autoprops($file, $fbat);
+	}
 	$self->chg_file($fbat, $m);
 	$self->close_file($fbat,undef,$self->{pool});
 }