git-svn: respect Subversion's [auth] section configuration values
authorEygene Ryabinkin <rea-git@codelabs.ru>
Sat, 6 Oct 2007 18:57:19 +0000 (22:57 +0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 16 Oct 2007 01:28:48 +0000 (21:28 -0400)
Parameters 'store-passwords' and 'store-auth-creds' from Subversion's
configuration (~/.subversion/config) were not respected.  This was
fixed: the default values for these parameters are set to 'yes' to
follow Subversion behaviour.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-svn.perl

index 777e4361f050c6dcd0d0c4bf30404eee42d82ee4..2c8a1580f8495b0f158802f8513a5df50aca3a02 100755 (executable)
@@ -3065,6 +3065,29 @@ sub new {
        my ($baton, $callbacks) = SVN::Core::auth_open_helper(_auth_providers);
        my $config = SVN::Core::config_get_config($config_dir);
        $RA = undef;
+       my $dont_store_passwords = 1;
+       my $conf_t = ${$config}{'config'};
+       {
+               # The usage of $SVN::_Core::SVN_CONFIG_* variables
+               # produces warnings that variables are used only once.
+               # I had not found the better way to shut them up, so
+               # warnings are disabled in this block.
+               no warnings;
+               if (SVN::_Core::svn_config_get_bool($conf_t,
+                   $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+                   $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS,
+                   1) == 0) {
+                       SVN::_Core::svn_auth_set_parameter($baton,
+                           $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
+                           bless (\$dont_store_passwords, "_p_void"));
+               }
+               if (SVN::_Core::svn_config_get_bool($conf_t,
+                   $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+                   $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS,
+                   1) == 0) {
+                       $Git::SVN::Prompt::_no_auth_cache = 1;
+               }
+       }
        my $self = SVN::Ra->new(url => $url, auth => $baton,
                              config => $config,
                              pool => SVN::Pool->new,