threads / patch / 21911

patch, 2 partsgit-svn: Move setting of svn.authorsfile in clone to between init and fetch

Subject: [PATCH 2/2] git-svn: Move setting of svn.authorsfile in clone to between init and fetch

## tl;dr

3 messages between Dec 8, 2009 and Dec 9, 2009. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Alex Vandiver· Dec 8, 2009, 20:54 UTC · lore

[PATCH 1/2] git-svn: Set svn.authorsfile to an absolute path when cloning

If --authors-file is passed a relative path, cloning will work, but future `git svn fetch`es will fail to locate the authors file correctly. Thus, use File::Spec->rel2abs to determine an absolute path for the authors file before setting it.

Signed-off-by: Alex Vandiver <alex@chmrr.net>
---
 git-svn.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to git-svn.perl +3 −1
diff --git a/git-svn.perl b/git-svn.perl
index 957d44e..cf5e75e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -392,9 +392,11 @@ sub cmd_clone {
 		$path = $url;
 	}
 	$path = basename($url) if !defined $path || !length $path;
+	my $authors_absolute = $_authors ? File::Spec->rel2abs($_authors) : "";
 	cmd_init($url, $path);
 	Git::SVN::fetch_all($Git::SVN::default_repo_id);
-	command_oneline('config', 'svn.authorsfile', $_authors) if $_authors;
+	command_oneline('config', 'svn.authorsfile', $authors_absolute)
+	    if $_authors;
 }
 
 sub cmd_init {
-- 
1.6.6.rc0.360.gc408
Alex Vandiver· Dec 8, 2009, 20:54 UTC · re: Alex Vandiver · lore

If a clone errors out because of a missing author, or user interrupt, this allows `git svn fetch` to resume seamlessly, rather than forcing the user to re-provide the path to the authors file.

Signed-off-by: Alex Vandiver <alex@chmrr.net>
---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-svn.perl +1 −1
diff --git a/git-svn.perl b/git-svn.perl
index cf5e75e..3c3e0e0 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -394,9 +394,9 @@ sub cmd_clone {
 	$path = basename($url) if !defined $path || !length $path;
 	my $authors_absolute = $_authors ? File::Spec->rel2abs($_authors) : "";
 	cmd_init($url, $path);
-	Git::SVN::fetch_all($Git::SVN::default_repo_id);
 	command_oneline('config', 'svn.authorsfile', $authors_absolute)
 	    if $_authors;
+	Git::SVN::fetch_all($Git::SVN::default_repo_id);
 }
 
 sub cmd_init {
-- 
1.6.6.rc0.360.gc408
Eric Wong· Dec 9, 2009, 04:44 UTC · re: Alex Vandiver · lore

Re: [PATCH 2/2] git-svn: Move setting of svn.authorsfile in clone to between init and fetch

Alex Vandiver <alex@chmrr.net> wrote:
> If a clone errors out because of a missing author, or user interrupt,
> this allows `git svn fetch` to resume seamlessly, rather than forcing
> the user to re-provide the path to the authors file.
Thanks Alex,

I shortened the subject on this one, acked the series and pushed to git://git.bogomips.org/git-svn

Alex Vandiver (2):
      git-svn: Set svn.authorsfile to an absolute path when cloning
      git-svn: set svn.authorsfile earlier when cloning
-- 
Eric Wong

← back to recent threads