git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] git-svn: allow --version to work anywhere

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 22, 2016, 17:13 UTC
Message-ID
<xmqqeg6lbnow.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160720004734.GA19635@whir>
Eric Wong <e@80x24.org> writes:
Show 11 quoted lines
> 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?

Show 49 quoted lines
>   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 &&
Previous: Eric WongNext: Eric Wong
Message 2 of 6 in “[RFC] git-svn: allow --version to work anywhere”
  1. Eric WongJul 20, 2016
  2. Junio C HamanoJul 22, 2016
  3. git-svn: allow --version to work anywhereEric Wong, Jul 22, 2016
  4. Junio C HamanoJul 28, 2016
  5. Junio C HamanoJul 28, 2016
  6. Eric WongJul 28, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.