threads / bug / 21567

Bug: "git svn clone" does not honor svn.authorsfile setting

Subject: Bug: "git svn clone" does not honor svn.authorsfile setting

## tl;dr

8 messages between Nov 10, 2009 and Nov 14, 2009.

replies: 7people: 5as markdown or json

Curt Sampson· Nov 10, 2009, 13:09 UTC · lore

[Note that I've set Reply-to to both myself and this list, as I am not subscribed to the list. Broken list software and MUAs sometimes don't honor this. Check to whom you're replying!]

When using "git svn fetch" or "git svn clone", the --authors-file command line parameter does what it claims in the docs. Additionally, for "git svn fetch", an svn.authorsfile configuration parameter in ~/.gitconfig is used, if no command line argument is specified. However, svn.authorsfile is ignored by "git svn clone", though the documentation claims that clone "runs init and fetch."

I have confirmed this bug is present in git versions 1.6.0.4 and 1.6.5.1.
cjs
-- 
Curt Sampson       <cjs@starling-software.com>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
Sverre Rabbelier· Nov 10, 2009, 13:24 UTC · re: Curt Sampson · lore

Re: Bug: "git svn clone" does not honor svn.authorsfile setting

Heya,
On Tue, Nov 10, 2009 at 14:09, Curt Sampson <cjs@cynic.net> wrote:
> [Note that I've set Reply-to to both myself and this list, as I am not
> subscribed to the list. Broken list software and MUAs sometimes don't
> honor this. Check to whom you're replying!]

Please don't. It is custom on the git list to always keep those who are involved in the conversation cc-ed, adding a Reply-to makes this difficult.

-- 
Cheers,

Sverre Rabbelier
Junio C Hamano· Nov 10, 2009, 20:18 UTC · re: Sverre Rabbelier · lore

Re: Bug: "git svn clone" does not honor svn.authorsfile setting

Sverre Rabbelier <srabbelier@gmail.com> writes:
Show 8 quoted lines
> On Tue, Nov 10, 2009 at 14:09, Curt Sampson <cjs@cynic.net> wrote:
>> [Note that I've set Reply-to to both myself and this list, as I am not
>> subscribed to the list. Broken list software and MUAs sometimes don't
>> honor this. Check to whom you're replying!]
>
> Please don't. It is custom on the git list to always keep those who
> are involved in the conversation cc-ed, adding a Reply-to makes this
> difficult.

I've seen people use Mail-Followup-To to cause grumbles, but Reply-To seems worse in a sense. If I wanted to respond _privately_ to Curt, and said "Reply", the message would have been broadcast to the public, and I am using a MUA that is *not* broken and honors this setting.

Not good.
Curt Sampson· Nov 13, 2009, 14:02 UTC · re: Sverre Rabbelier · lore

Re: Bug: "git svn clone" does not honor svn.authorsfile setting

On 2009-11-10 14:24 +0100 (Tue), Sverre Rabbelier wrote:
> Please don't. It is custom on the git list to always keep those who
> are involved in the conversation cc-ed, adding a Reply-to makes this
> difficult.

If you're running your list without munging Reply-to, congratulations to you. I'll avoid it from now on on this list. However, it's the case that for many, many lists out there, if I did not include myself in a Reply-to, the list would set the Reply-to to the list, and most MUAs would automatically exclude me from the reply.

cjs
-- 
Curt Sampson       <cjs@starling-software.com>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
Sam Vilain· Nov 11, 2009, 04:26 UTC · re: Curt Sampson · lore

Re: Bug: "git svn clone" does not honor svn.authorsfile setting

Curt Sampson wrote:
Show 9 quoted lines
> When using "git svn fetch" or "git svn clone", the --authors-file
> command line parameter does what it claims in the docs. Additionally,
> for "git svn fetch", an svn.authorsfile configuration parameter in
> ~/.gitconfig is used, if no command line argument is specified. However,
> svn.authorsfile is ignored by "git svn clone", though the documentation
> claims that clone "runs init and fetch."
>
> I have confirmed this bug is present in git versions 1.6.0.4 and 1.6.5.1.
>   
Does moving the line:
command_oneline('config', 'svn.authorsfile', $_authors) if $_authors;

Immediately prior to the "fetch_all" line before it fix the problem? It looks strange for it to set it afterwards...

Sam
Curt Sampson· Nov 13, 2009, 14:06 UTC · re: Sam Vilain · lore

Re: Bug: "git svn clone" does not honor svn.authorsfile setting

On 2009-11-11 17:26 +1300 (Wed), Sam Vilain wrote:
Show 6 quoted lines
> Does moving the line:
> 
> command_oneline('config', 'svn.authorsfile', $_authors) if $_authors;
> 
> Immediately prior to the "fetch_all" line before it fix the problem? It
> looks strange for it to set it afterwards...

That looks plausible to me, having had a quick look at the source, but keep in mind I've already spent about 45 minutes debugging this problem and figuring out how to file a bug report. I don't really have the time at the moment to learn how to build and test new versions of git, unless someone wants to walk me through it. I expect it would take rather less time for someone in the know just to do the test.

cjs
-- 
Curt Sampson       <cjs@starling-software.com>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
Eric Wong· Nov 14, 2009, 22:39 UTC · re: Curt Sampson · lore

[PATCH] git svn: read global+system config for clone+init

Curt Sampson <cjs@cynic.net> wrote:
Show 8 quoted lines
> When using "git svn fetch" or "git svn clone", the --authors-file
> command line parameter does what it claims in the docs. Additionally,
> for "git svn fetch", an svn.authorsfile configuration parameter in
> ~/.gitconfig is used, if no command line argument is specified. However,
> svn.authorsfile is ignored by "git svn clone", though the documentation
> claims that clone "runs init and fetch."
> 
> I have confirmed this bug is present in git versions 1.6.0.4 and 1.6.5.1.
Hi Curt,

Thanks for the bug report, the following patch should fix the bug. Also pullable from git://git.bogomips.org/git-svn

>From 1a30582b43e137e16b3486d83bb86b0eb090e13d Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sat, 14 Nov 2009 14:25:11 -0800
Subject: [PATCH] git svn: read global+system config for clone+init

Since $GIT_DIR does not exist when initializing new repositories, we can follow back to the global and system config files for git.

The logic for this was originally introduced when $GIT_DIR/config was the only config file git could read (back when "git config" was "git repo-config"), so the function is renamed to "read_git_config" instead of "read_repo_config".

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 27fbe30..ea922ac 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -274,7 +274,7 @@ unless ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
 
 my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
 
-read_repo_config(\%opts);
+read_git_config(\%opts);
 if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {
 	Getopt::Long::Configure('pass_through');
 }
@@ -1390,8 +1390,7 @@ sub load_authors {
 }
 
 # convert GetOpt::Long specs for use by git-config
-sub read_repo_config {
-	return unless -d $ENV{GIT_DIR};
+sub read_git_config {
 	my $opts = shift;
 	my @config_only;
 	foreach my $o (keys %$opts) {
-- 
Eric Wong
Eric Wong· Nov 14, 2009, 22:50 UTC · re: Eric Wong · lore

Re: [PATCH] git svn: read global+system config for clone+init

Eric Wong <normalperson@yhbt.net> wrote:
> Hi Curt,
> 
> Thanks for the bug report, the following patch should fix
> the bug.  Also pullable from git://git.bogomips.org/git-svn

It took me a while (possibly due to low caffeine levels) to make a failing (automated) test case, but I've also pushed this out as well.

>From e2f8617b266e320fd58ab584cae2ebe9906daaac Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sat, 14 Nov 2009 14:43:20 -0800
Subject: [PATCH] git svn: add authorsfile test case for ~/.gitconfig
The commit for:
    git svn: read global+system config for clone+init

Initially lacked a test case because the author was unable to reproduce it under his test environment, this adds it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/t9130-git-svn-authors-file.sh |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index f5abdb3..134411e 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -91,4 +91,27 @@ test_expect_success 'fetch continues after authors-file is fixed' '
 	)
 	'
 
+test_expect_success 'fresh clone with svn.authors-file in config' '
+	(
+		rm -r "$GIT_DIR" &&
+		test x = x"$(git config svn.authorsfile)" &&
+		HOME="`pwd`" &&
+		export HOME &&
+		test_config="$HOME"/.gitconfig &&
+		unset GIT_CONFIG_NOGLOBAL &&
+		unset GIT_DIR &&
+		unset GIT_CONFIG &&
+		git config --global \
+		  svn.authorsfile "$HOME"/svn-authors &&
+		test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
+		git svn clone "$svnrepo" gitconfig.clone &&
+		cd gitconfig.clone &&
+		nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
+		nr_rev=$(git rev-list HEAD | wc -l) &&
+		test $nr_rev -eq $nr_ex
+	)
+'
+
+test_debug 'GIT_DIR=gitconfig.clone/.git git log'
+
 test_done
-- 
Eric Wong

← back to recent threads