# [PATCH] git-svn: respect Subversion's [auth] section configuration values

7 messages from 2007-10-06 to 2007-10-15. Participants: Eygene Ryabinkin, Eric Wong, Sam Vilain.
Thread: https://gitlist.dev/t/10171

## Eygene Ryabinkin, 2007-10-06 18:57

Subject: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071006185719.GA3943@void.codelabs.ru>
URL: https://gitlist.dev/e/20071006185719.GA3943%40void.codelabs.ru

```
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>
---
 git-svn.perl |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 484b057..f7ef421 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3051,6 +3051,29 @@ sub new {
 	  ]);
 	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,
-- 
1.5.3.2


-- 
Eygene

```

## Sam Vilain, 2007-10-07 01:24

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <4708355B.4090403@vilain.net>
URL: https://gitlist.dev/e/4708355B.4090403%40vilain.net
In-Reply-To: <20071006185719.GA3943@void.codelabs.ru>

```
Eygene Ryabinkin wrote:
> 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.
>   

I saw this in the svn api before.  It really is a strange API, requiring
the user to get things like this right.

> Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
> ---
>  git-svn.perl |   23 +++++++++++++++++++++++
>  1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 484b057..f7ef421 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -3051,6 +3051,29 @@ sub new {
>  	  ]);
>  	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;
>   

You can use no warnings 'once';

> +		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,
>   

```

## Eric Wong, 2007-10-07 03:22

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071007032241.GG14972@hand.yhbt.net>
URL: https://gitlist.dev/e/20071007032241.GG14972%40hand.yhbt.net
In-Reply-To: <20071006185719.GA3943@void.codelabs.ru>

```
Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> 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.

Thanks.

> Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
>  git-svn.perl |   23 +++++++++++++++++++++++
>  1 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 484b057..f7ef421 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -3051,6 +3051,29 @@ sub new {
>  	  ]);
>  	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,

-- 
Eric Wong

```

## Eric Wong, 2007-10-07 03:24

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071007032446.GH14972@hand.yhbt.net>
URL: https://gitlist.dev/e/20071007032446.GH14972%40hand.yhbt.net
In-Reply-To: <4708355B.4090403@vilain.net>

```
Sam Vilain <sam@vilain.net> wrote:
> Eygene Ryabinkin wrote:
> > +		# 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;
> >   
> 
> You can use no warnings 'once';

Interesting, I should use that globally in git-svn and get rid of the
$kill_stupid_warnings variable :)

-- 
Eric Wong

```

## Eygene Ryabinkin, 2007-10-07 10:14

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071007101437.GB3943@void.codelabs.ru>
URL: https://gitlist.dev/e/20071007101437.GB3943%40void.codelabs.ru
In-Reply-To: <4708355B.4090403@vilain.net>

```
Eric, Sam, good day.

Sat, Oct 06, 2007 at 08:22:41PM -0700, Eric Wong wrote:
> Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> > 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.
> 
> Thanks.

You're welcome ;))

Sun, Oct 07, 2007 at 02:24:43PM +1300, Sam Vilain wrote:
> Eygene Ryabinkin wrote:
> > 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.
> >   
> 
> I saw this in the svn api before.  It really is a strange API, requiring
> the user to get things like this right.

Yes, the need to parse the configuration and set some flags is
rather strange.  Looks like nobody cared to stuff the code like
I had added to the configuration file parsing routines.

> You can use no warnings 'once';

Great, thanks for the pointer!  Eric, do you want me to produce
another patch or you'll correct mine?
-- 
Eygene

```

## Eric Wong, 2007-10-07 21:43

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071007214334.GA7442@untitled>
URL: https://gitlist.dev/e/20071007214334.GA7442%40untitled
In-Reply-To: <20071007101437.GB3943@void.codelabs.ru>

```
Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> Eric, Sam, good day.
> Sun, Oct 07, 2007 at 02:24:43PM +1300, Sam Vilain wrote:
> > Eygene Ryabinkin wrote:
> > > 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.
> > >   
> > 
> > I saw this in the svn api before.  It really is a strange API, requiring
> > the user to get things like this right.
> 
> Yes, the need to parse the configuration and set some flags is
> rather strange.  Looks like nobody cared to stuff the code like
> I had added to the configuration file parsing routines.

I think I started to look at it a while back and forgot about it :)

> > You can use no warnings 'once';
> 
> Great, thanks for the pointer!  Eric, do you want me to produce
> another patch or you'll correct mine?

Go ahead and produce another patch.  I haven't had much time to
work on git lately.

-- 
Eric Wong

```

## Eygene Ryabinkin, 2007-10-15 07:17

Subject: Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
Message-ID: <20071015071750.GF984@void.codelabs.ru>
URL: https://gitlist.dev/e/20071015071750.GF984%40void.codelabs.ru
In-Reply-To: <20071007214334.GA7442@untitled>

```
Eric, good day.

Sun, Oct 07, 2007 at 02:43:34PM -0700, Eric Wong wrote:
> > Great, thanks for the pointer!  Eric, do you want me to produce
> > another patch or you'll correct mine?
> 
> Go ahead and produce another patch.  I haven't had much time to
> work on git lately.

OK, the patch will follow in the separate thread.  I had embedded
"no warnings 'once'" both to my new code and to your code to get
rid of the $kill_stupid_warnings.  I did it selectively to minimize
the impact of the "no warnings" pragma.
-- 
Eygene

```
