{"thread":{"id":"42886","subject":"[RFC] git-svn: allow --version to work anywhere","startedAt":"2016-07-20T00:47:41Z","lastAt":"2016-07-28T22:07:29Z","messageCount":6,"participants":["Eric Wong","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"291783","messageId":"20160720004734.GA19635@whir","threadId":"42886","inReplyTo":null,"subject":"[RFC] git-svn: allow --version to work anywhere","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2016-07-20T00:47:34Z","receivedAt":"2016-07-20T00:47:41Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Checking the version of the installed SVN libraries should not\nrequire a git repository at all.  This matches the behavior of\n\"git --version\".\n\nAdd a test for \"git svn help\" for the same behavior while we're\nat it, too.\n\nSigned-off-by: Eric Wong <e@80x24.org>\n---\n  I'm hoping \"cd /\" in the test will always succeed;\n  but I suppose non-*nix systems might fail, here.\n\n  And maybe a BOFH did \"chmod 700 /\"\t:(\n\n  Anyways this is sitting in master of git://bogomips.org/git-svn.git\n\n git-svn.perl             | 4 ++--\n t/t9100-git-svn-basic.sh | 8 ++++++++\n 2 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex f609e54..4d41d22 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -339,7 +339,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n \t\t\tdie \"failed to open $ENV{GIT_DIR}: $!\\n\";\n \t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n \t}\n-} else {\n+} elsif ($cmd) {\n \tmy ($git_dir, $cdup);\n \tgit_cmd_try {\n \t\t$git_dir = command_oneline([qw/rev-parse --git-dir/]);\n@@ -356,7 +356,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n \n my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n \n-read_git_config(\\%opts);\n+read_git_config(\\%opts) if $ENV{GIT_DIR};\n if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n \tGetopt::Long::Configure('pass_through');\n }\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex 28082b1..10408d0 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -19,6 +19,14 @@ case \"$GIT_SVN_LC_ALL\" in\n \t;;\n esac\n \n+test_expect_success 'git svn --version works anywhere' '\n+\t( cd / || exit 0; git svn --version )\n+'\n+\n+test_expect_success 'git svn help works anywhere' '\n+\t( cd / || exit 0; git svn help )\n+'\n+\n test_expect_success \\\n     'initialize git svn' '\n \tmkdir import &&\n-- \nEW\n"},{"id":"291979","messageId":"xmqqeg6lbnow.fsf@gitster.mtv.corp.google.com","threadId":"42886","inReplyTo":"20160720004734.GA19635@whir","subject":"Re: [RFC] git-svn: allow --version to work anywhere","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-22T17:13:51Z","receivedAt":"2016-07-22T17:14:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <e@80x24.org> writes:\n\n> Checking the version of the installed SVN libraries should not\n> require a git repository at all.  This matches the behavior of\n> \"git --version\".\n>\n> Add a test for \"git svn help\" for the same behavior while we're\n> at it, too.\n>\n> Signed-off-by: Eric Wong <e@80x24.org>\n> ---\n>   I'm hoping \"cd /\" in the test will always succeed;\n>   but I suppose non-*nix systems might fail, here.\n\nHow about digging a few levels of directory hierarchy, exporting\nGIT_CEILING_DIRECTORIES so that we won't find any repository and\ngoing there to run these tests?\n\n>   And maybe a BOFH did \"chmod 700 /\"\t:(\n>\n>   Anyways this is sitting in master of git://bogomips.org/git-svn.git\n>\n>  git-svn.perl             | 4 ++--\n>  t/t9100-git-svn-basic.sh | 8 ++++++++\n>  2 files changed, 10 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-svn.perl b/git-svn.perl\n> index f609e54..4d41d22 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -339,7 +339,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n>  \t\t\tdie \"failed to open $ENV{GIT_DIR}: $!\\n\";\n>  \t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n>  \t}\n> -} else {\n> +} elsif ($cmd) {\n>  \tmy ($git_dir, $cdup);\n>  \tgit_cmd_try {\n>  \t\t$git_dir = command_oneline([qw/rev-parse --git-dir/]);\n> @@ -356,7 +356,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n>  \n>  my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n>  \n> -read_git_config(\\%opts);\n> +read_git_config(\\%opts) if $ENV{GIT_DIR};\n>  if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n>  \tGetopt::Long::Configure('pass_through');\n>  }\n> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\n> index 28082b1..10408d0 100755\n> --- a/t/t9100-git-svn-basic.sh\n> +++ b/t/t9100-git-svn-basic.sh\n> @@ -19,6 +19,14 @@ case \"$GIT_SVN_LC_ALL\" in\n>  \t;;\n>  esac\n>  \n> +test_expect_success 'git svn --version works anywhere' '\n> +\t( cd / || exit 0; git svn --version )\n> +'\n> +\n> +test_expect_success 'git svn help works anywhere' '\n> +\t( cd / || exit 0; git svn help )\n> +'\n> +\n>  test_expect_success \\\n>      'initialize git svn' '\n>  \tmkdir import &&\n"},{"id":"292017","messageId":"20160722204610.GA20896@whir","threadId":"42886","inReplyTo":"xmqqeg6lbnow.fsf@gitster.mtv.corp.google.com","subject":"[PATCH] git-svn: allow --version to work anywhere","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2016-07-22T20:46:10Z","receivedAt":"2016-07-22T20:46:15Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <e@80x24.org> writes:\n> >   I'm hoping \"cd /\" in the test will always succeed;\n> >   but I suppose non-*nix systems might fail, here.\n> \n> How about digging a few levels of directory hierarchy, exporting\n> GIT_CEILING_DIRECTORIES so that we won't find any repository and\n> going there to run these tests?\n\nAh, thanks; I missed that.\n\nRepushed my master in case it's a convenient time to pull.\n\nThe following changes since commit 29493589e97a2de0c4c1c314f61ccafaee3b5caf:\n\n  archive-tar: huge offset and future timestamps would not work on 32-bit (2016-07-15 10:51:55 -0700)\n\nare available in the git repository at:\n\n  git://bogomips.org/git-svn.git master\n\nfor you to fetch changes up to c0071ae5dc1c610ab3791ece7ccf7d4772fde151:\n\n  git-svn: allow --version to work anywhere (2016-07-22 20:38:11 +0000)\n\n----------------------------------------------------------------\nEric Wong (2):\n      git-svn: document svn.authorsProg in config\n      git-svn: allow --version to work anywhere\n\n Documentation/git-svn.txt |  3 +++\n git-svn.perl              |  4 ++--\n t/t9100-git-svn-basic.sh  | 19 +++++++++++++++++++\n 3 files changed, 24 insertions(+), 2 deletions(-)\n\n-----8<-----\nSubject: [PATCH] git-svn: allow --version to work anywhere\n\nChecking the version of the installed SVN libraries should not\nrequire a git repository at all.  This matches the behavior of\n\"git --version\".\n\nAdd a test for \"git svn help\" for the same behavior while we're\nat it, too.\n\nSigned-off-by: Eric Wong <e@80x24.org>\n---\n git-svn.perl             |  4 ++--\n t/t9100-git-svn-basic.sh | 19 +++++++++++++++++++\n 2 files changed, 21 insertions(+), 2 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex f609e54..4d41d22 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -339,7 +339,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n \t\t\tdie \"failed to open $ENV{GIT_DIR}: $!\\n\";\n \t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n \t}\n-} else {\n+} elsif ($cmd) {\n \tmy ($git_dir, $cdup);\n \tgit_cmd_try {\n \t\t$git_dir = command_oneline([qw/rev-parse --git-dir/]);\n@@ -356,7 +356,7 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n \n my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);\n \n-read_git_config(\\%opts);\n+read_git_config(\\%opts) if $ENV{GIT_DIR};\n if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {\n \tGetopt::Long::Configure('pass_through');\n }\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex 28082b1..ab6593b 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -19,6 +19,25 @@ case \"$GIT_SVN_LC_ALL\" in\n \t;;\n esac\n \n+deepdir=nothing-above\n+ceiling=$PWD\n+\n+test_expect_success 'git svn --version works anywhere' '\n+\tmkdir -p \"$deepdir\" && (\n+\t\texport GIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\tcd \"$deepdir\" &&\n+\t\tgit svn --version\n+\t)\n+'\n+\n+test_expect_success 'git svn help works anywhere' '\n+\tmkdir -p \"$deepdir\" && (\n+\t\texport GIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\tcd \"$deepdir\" &&\n+\t\tgit svn help\n+\t)\n+'\n+\n test_expect_success \\\n     'initialize git svn' '\n \tmkdir import &&\n-- \nEW\n"},{"id":"292448","messageId":"xmqqtwf9r013.fsf@gitster.mtv.corp.google.com","threadId":"42886","inReplyTo":"20160722204610.GA20896@whir","subject":"Re: [PATCH] git-svn: allow --version to work anywhere","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-28T20:16:24Z","receivedAt":"2016-07-28T20:16:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <e@80x24.org> writes:\n\n> Repushed my master in case it's a convenient time to pull.\n>\n> The following changes since commit 29493589e97a2de0c4c1c314f61ccafaee3b5caf:\n>\n>   archive-tar: huge offset and future timestamps would not work on 32-bit (2016-07-15 10:51:55 -0700)\n>\n> are available in the git repository at:\n>\n>   git://bogomips.org/git-svn.git master\n>\n> for you to fetch changes up to c0071ae5dc1c610ab3791ece7ccf7d4772fde151:\n>\n>   git-svn: allow --version to work anywhere (2016-07-22 20:38:11 +0000)\n\nThanks, pulled.\n\n"},{"id":"292455","messageId":"xmqqd1lxqwxf.fsf@gitster.mtv.corp.google.com","threadId":"42886","inReplyTo":"xmqqtwf9r013.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] git-svn: allow --version to work anywhere","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-28T21:23:24Z","receivedAt":"2016-07-28T21:23:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Eric Wong <e@80x24.org> writes:\n>\n>> Repushed my master in case it's a convenient time to pull.\n>>\n>> The following changes since commit 29493589e97a2de0c4c1c314f61ccafaee3b5caf:\n>>\n>>   archive-tar: huge offset and future timestamps would not work on 32-bit (2016-07-15 10:51:55 -0700)\n>>\n>> are available in the git repository at:\n>>\n>>   git://bogomips.org/git-svn.git master\n>>\n>> for you to fetch changes up to c0071ae5dc1c610ab3791ece7ccf7d4772fde151:\n>>\n>>   git-svn: allow --version to work anywhere (2016-07-22 20:38:11 +0000)\n>\n> Thanks, pulled.\n\nI was too deep in today's integration cycle to waste half-day's\nwork, so I added this hotfix after the merge, directly on 'master'.\n\n-- >8 --\nSubject: [PATCH] t9100: portability fix\n\nDo not say \"export VAR=VAL\"; \"VAR=VAL && export VAR\" is always more\nportable.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t9100-git-svn-basic.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex ab6593b..d29f601 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -24,7 +24,8 @@ ceiling=$PWD\n \n test_expect_success 'git svn --version works anywhere' '\n \tmkdir -p \"$deepdir\" && (\n-\t\texport GIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\tGIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\texport GIT_CEILING_DIRECTORIES &&\n \t\tcd \"$deepdir\" &&\n \t\tgit svn --version\n \t)\n@@ -32,7 +33,8 @@ test_expect_success 'git svn --version works anywhere' '\n \n test_expect_success 'git svn help works anywhere' '\n \tmkdir -p \"$deepdir\" && (\n-\t\texport GIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\tGIT_CEILING_DIRECTORIES=\"$ceiling\" &&\n+\t\texport GIT_CEILING_DIRECTORIES &&\n \t\tcd \"$deepdir\" &&\n \t\tgit svn help\n \t)\n-- \n2.9.2-662-gbb82c05\n\n"},{"id":"292459","messageId":"20160728220723.GB13110@dcvr","threadId":"42886","inReplyTo":"xmqqd1lxqwxf.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] git-svn: allow --version to work anywhere","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2016-07-28T22:07:23Z","receivedAt":"2016-07-28T22:07:29Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Subject: [PATCH] t9100: portability fix\n> \n> Do not say \"export VAR=VAL\"; \"VAR=VAL && export VAR\" is always more\n> portable.\n\nOops, sorry I should've caught that :x\n"}]}