summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-22 20:17:31 (GMT)
committerEric Wong <e@80x24.org>2016-07-22 20:38:11 (GMT)
commitc0071ae5dc1c610ab3791ece7ccf7d4772fde151 (patch)
tree9090e751ec38210b1becc2c50ce8e7d4c8fce023 /git-svn.perl
parentcec9264f17f5cb4a1bc0f41d51c7f62c6bf4784e (diff)
downloadgit-c0071ae5dc1c610ab3791ece7ccf7d4772fde151.zip
git-c0071ae5dc1c610ab3791ece7ccf7d4772fde151.tar.gz
git-c0071ae5dc1c610ab3791ece7ccf7d4772fde151.tar.bz2
git-svn: allow --version to work anywhere
Checking the version of the installed SVN libraries should not require a git repository at all. This matches the behavior of "git --version". Add a test for "git svn help" for the same behavior while we're at it, too. Signed-off-by: Eric Wong <e@80x24.org>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-svn.perl b/git-svn.perl
index f609e54..4d41d22 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -339,7 +339,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
die "failed to open $ENV{GIT_DIR}: $!\n";
$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
}
-} else {
+} elsif ($cmd) {
my ($git_dir, $cdup);
git_cmd_try {
$git_dir = command_oneline([qw/rev-parse --git-dir/]);
@@ -356,7 +356,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
-read_git_config(\%opts);
+read_git_config(\%opts) if $ENV{GIT_DIR};
if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {
Getopt::Long::Configure('pass_through');
}