Skip to contentSkip to conversation

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

PATCH In review Curt Sampson 5 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

[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

Signature · 3 lines
Curt Sampson       <[email protected]>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
#1 lore raw
Quoted 9 lines · Curt Sampson

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

#2 lore raw
Quoted 6 lines · Sam Vilain

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

Signature · 3 lines
Curt Sampson       <[email protected]>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
#3 lore raw
In reply to Curt Sampson

Heya,

Quoted 3 lines · Curt Sampson

[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.

Signature · 3 lines
Cheers,

Sverre Rabbelier
#4 lore raw
Quoted 8 lines · Sverre Rabbelier
Quoted 3 lines · Curt Sampson

[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.

#5 lore raw
In reply to Sverre Rabbelier
Quoted 3 lines · Sverre Rabbelier

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

Signature · 3 lines
Curt Sampson       <[email protected]>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com
#6 lore raw

PATCH 1/1 git svn: read global+system config for clone+init

In reply to Curt Sampson
Quoted 8 lines · Curt Sampson

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

Quoted 1 line

From 1a30582b43e137e16b3486d83bb86b0eb090e13d Mon Sep 17 00:00:00 2001

From: Eric Wong <[email protected]>
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".

---
 git-svn.perl |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
git-svn.perl +2 -3
index 27fbe30..ea922ac 100755
@@ -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) {
Signature · 1 line
Eric Wong
#7 lore raw

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

Quoted 4 lines · Eric Wong

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.

Quoted 1 line

From e2f8617b266e320fd58ab584cae2ebe9906daaac Mon Sep 17 00:00:00 2001

From: Eric Wong <[email protected]>
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.

---
 t/t9130-git-svn-authors-file.sh |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
t/t9130-git-svn-authors-file.sh +23 -0
index f5abdb3..134411e 100755
@@ -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
Signature · 1 line
Eric Wong