From: Junio C Hamano <gitster@pobox.com>
To: Eric Wong <e@80x24.org>
Cc: git@vger.kernel.org
Subject: Re: [RFC] git-svn: allow --version to work anywhere
Date: Fri, 22 Jul 2016 10:13:51 -0700 [thread overview]
Message-ID: <xmqqeg6lbnow.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160720004734.GA19635@whir> (Eric Wong's message of "Wed, 20 Jul 2016 00:47:34 +0000")
Eric Wong <e@80x24.org> writes:
> 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>
> ---
> I'm hoping "cd /" in the test will always succeed;
> but I suppose non-*nix systems might fail, here.
How about digging a few levels of directory hierarchy, exporting
GIT_CEILING_DIRECTORIES so that we won't find any repository and
going there to run these tests?
> And maybe a BOFH did "chmod 700 /" :(
>
> Anyways this is sitting in master of git://bogomips.org/git-svn.git
>
> git-svn.perl | 4 ++--
> t/t9100-git-svn-basic.sh | 8 ++++++++
> 2 files changed, 10 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');
> }
> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
> index 28082b1..10408d0 100755
> --- a/t/t9100-git-svn-basic.sh
> +++ b/t/t9100-git-svn-basic.sh
> @@ -19,6 +19,14 @@ case "$GIT_SVN_LC_ALL" in
> ;;
> esac
>
> +test_expect_success 'git svn --version works anywhere' '
> + ( cd / || exit 0; git svn --version )
> +'
> +
> +test_expect_success 'git svn help works anywhere' '
> + ( cd / || exit 0; git svn help )
> +'
> +
> test_expect_success \
> 'initialize git svn' '
> mkdir import &&
next prev parent reply other threads:[~2016-07-22 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 0:47 [RFC] git-svn: allow --version to work anywhere Eric Wong
2016-07-22 17:13 ` Junio C Hamano [this message]
2016-07-22 20:46 ` [PATCH] " Eric Wong
2016-07-28 20:16 ` Junio C Hamano
2016-07-28 21:23 ` Junio C Hamano
2016-07-28 22:07 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqeg6lbnow.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=e@80x24.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).