git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-svn now reads settings even if called in subdirectory
@ 2007-11-24 13:47 Gustaf Hendeby
  2007-11-29  7:41 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Gustaf Hendeby @ 2007-11-24 13:47 UTC (permalink / raw
  To: git; +Cc: gitster, Gustaf Hendeby

Previously, git-svn first read the .git/config file for settings as if
current working directory was the repository top-directory, and after
that made sure to cd into top-directory.  The result was a silent
failur to read configuration settings.  This patch changes the order
these two things are done.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>

---

This fix seems a bit too obvious, which makes me think I missed
something conceptual here.  However, the patch passes "make test" and
"make full-svn-test", and the problems I had with the svn.authorsfile
setting not being honored while fetching from a subdirectory are gone.

 git-svn.perl |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 43e1591..640a45a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -193,23 +193,6 @@ for (my $i = 0; $i < @ARGV; $i++) {
 	}
 };
 
-my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
-
-read_repo_config(\%opts);
-Getopt::Long::Configure('pass_through') if ($cmd && $cmd eq 'log');
-my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
-                    'minimize-connections' => \$Git::SVN::Migration::_minimize,
-                    'id|i=s' => \$Git::SVN::default_ref_id,
-                    'svn-remote|remote|R=s' => sub {
-                       $Git::SVN::no_reuse_existing = 1;
-                       $Git::SVN::default_repo_id = $_[1] });
-exit 1 if (!$rv && $cmd && $cmd ne 'log');
-
-usage(0) if $_help;
-version() if $_version;
-usage(1) unless defined $cmd;
-load_authors() if $_authors;
-
 # make sure we're always running
 unless ($cmd =~ /(?:clone|init|multi-init)$/) {
 	unless (-d $ENV{GIT_DIR}) {
@@ -231,6 +214,24 @@ unless ($cmd =~ /(?:clone|init|multi-init)$/) {
 		$ENV{GIT_DIR} = $git_dir;
 	}
 }
+
+my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
+
+read_repo_config(\%opts);
+Getopt::Long::Configure('pass_through') if ($cmd && $cmd eq 'log');
+my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
+                    'minimize-connections' => \$Git::SVN::Migration::_minimize,
+                    'id|i=s' => \$Git::SVN::default_ref_id,
+                    'svn-remote|remote|R=s' => sub {
+                       $Git::SVN::no_reuse_existing = 1;
+                       $Git::SVN::default_repo_id = $_[1] });
+exit 1 if (!$rv && $cmd && $cmd ne 'log');
+
+usage(0) if $_help;
+version() if $_version;
+usage(1) unless defined $cmd;
+load_authors() if $_authors;
+
 unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
 	Git::SVN::Migration::migration_check();
 }
-- 
1.5.3.6.1992.g3d0f

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-svn now reads settings even if called in subdirectory
  2007-11-24 13:47 [PATCH] git-svn now reads settings even if called in subdirectory Gustaf Hendeby
@ 2007-11-29  7:41 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2007-11-29  7:41 UTC (permalink / raw
  To: Gustaf Hendeby; +Cc: git, gitster

Gustaf Hendeby <hendeby@isy.liu.se> wrote:
> Previously, git-svn first read the .git/config file for settings as if
> current working directory was the repository top-directory, and after
> that made sure to cd into top-directory.  The result was a silent
> failur to read configuration settings.  This patch changes the order
> these two things are done.
> 
> Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
> 
> ---
> 
> This fix seems a bit too obvious, which makes me think I missed
> something conceptual here.  However, the patch passes "make test" and
> "make full-svn-test", and the problems I had with the svn.authorsfile
> setting not being honored while fetching from a subdirectory are gone.

Thanks Gustaf,

Seems right to me (note: I never use the authors file feature myself).

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

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-29  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-24 13:47 [PATCH] git-svn now reads settings even if called in subdirectory Gustaf Hendeby
2007-11-29  7:41 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).