Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-svn: allow --version to work anywhere
author
Eric Wong
<e@80x24.org>
Fri, 22 Jul 2016 20:17:31 +0000
(20:17 +0000)
committer
Eric Wong
<e@80x24.org>
Fri, 22 Jul 2016 20:38:11 +0000
(20:38 +0000)
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>
git-svn.perl
patch
|
blob
|
history
t/t9100-git-svn-basic.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
cec9264
)
diff --git
a/git-svn.perl
b/git-svn.perl
index f609e54ce3b3d5a0f004de6d40390a9fdae4f6a9..4d41d220a0da3a2357d63dbb6ba59514bb3f0462 100755
(executable)
--- a/
git-svn.perl
+++ b/
git-svn.perl
@@
-339,7
+339,7
@@
sub term_init {
die "failed to open $ENV{GIT_DIR}: $!\n";
$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
}
die "failed to open $ENV{GIT_DIR}: $!\n";
$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
}
-} els
e
{
+} els
if ($cmd)
{
my ($git_dir, $cdup);
git_cmd_try {
$git_dir = command_oneline([qw/rev-parse --git-dir/]);
my ($git_dir, $cdup);
git_cmd_try {
$git_dir = command_oneline([qw/rev-parse --git-dir/]);
@@
-356,7
+356,7
@@
sub term_init {
my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
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');
}
if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {
Getopt::Long::Configure('pass_through');
}
diff --git
a/t/t9100-git-svn-basic.sh
b/t/t9100-git-svn-basic.sh
index 28082b134fd54aafa38a4ac2964fd4c367e19fa2..ab6593b910f171cd5b9b1f8cb3243c965e606e30 100755
(executable)
--- a/
t/t9100-git-svn-basic.sh
+++ b/
t/t9100-git-svn-basic.sh
@@
-19,6
+19,25
@@
case "$GIT_SVN_LC_ALL" in
;;
esac
;;
esac
+deepdir=nothing-above
+ceiling=$PWD
+
+test_expect_success 'git svn --version works anywhere' '
+ mkdir -p "$deepdir" && (
+ export GIT_CEILING_DIRECTORIES="$ceiling" &&
+ cd "$deepdir" &&
+ git svn --version
+ )
+'
+
+test_expect_success 'git svn help works anywhere' '
+ mkdir -p "$deepdir" && (
+ export GIT_CEILING_DIRECTORIES="$ceiling" &&
+ cd "$deepdir" &&
+ git svn help
+ )
+'
+
test_expect_success \
'initialize git svn' '
mkdir import &&
test_expect_success \
'initialize git svn' '
mkdir import &&