@matheusbsbs / matheus-bagliano / commits / f4dd334bff
Fork 0

git-svn now reads settings even if called in subdirectory

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> Acked-by: Eric Wong <normalperson@yhbt.net>

Gustaf Hendeby committed Nov 24, 2007 at 14:47 UTC f4dd334bff85a203f71b3dfd086d8fd523db41ec
1 file changed +18 -17
git-svn.perl
+18 -17
@@ -193,23 +193,6 @@ for (my $i = 0; $i < @ARGV; $i++) {
193 }
194 };
195
196 -my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
197 -
198 -read_repo_config(\%opts);
199 -Getopt::Long::Configure('pass_through') if ($cmd && $cmd eq 'log');
200 -my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
201 - 'minimize-connections' => \$Git::SVN::Migration::_minimize,
202 - 'id|i=s' => \$Git::SVN::default_ref_id,
203 - 'svn-remote|remote|R=s' => sub {
204 - $Git::SVN::no_reuse_existing = 1;
205 - $Git::SVN::default_repo_id = $_[1] });
206 -exit 1 if (!$rv && $cmd && $cmd ne 'log');
207 -
208 -usage(0) if $_help;
209 -version() if $_version;
210 -usage(1) unless defined $cmd;
211 -load_authors() if $_authors;
212 -
196 # make sure we're always running
197 unless ($cmd =~ /(?:clone|init|multi-init)$/) {
198 unless (-d $ENV{GIT_DIR}) {
@@ -231,6 +214,24 @@ unless ($cmd =~ /(?:clone|init|multi-init)$/) {
214 $ENV{GIT_DIR} = $git_dir;
215 }
216 }
217 +
218 +my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
219 +
220 +read_repo_config(\%opts);
221 +Getopt::Long::Configure('pass_through') if ($cmd && $cmd eq 'log');
222 +my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
223 + 'minimize-connections' => \$Git::SVN::Migration::_minimize,
224 + 'id|i=s' => \$Git::SVN::default_ref_id,
225 + 'svn-remote|remote|R=s' => sub {
226 + $Git::SVN::no_reuse_existing = 1;
227 + $Git::SVN::default_repo_id = $_[1] });
228 +exit 1 if (!$rv && $cmd && $cmd ne 'log');
229 +
230 +usage(0) if $_help;
231 +version() if $_version;
232 +usage(1) unless defined $cmd;
233 +load_authors() if $_authors;
234 +
235 unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
236 Git::SVN::Migration::migration_check();
237 }