{"thread":{"id":"36196","subject":"[BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set","startedAt":"2014-03-17T12:58:00Z","lastAt":"2014-03-17T20:56:17Z","messageCount":5,"participants":["Gilles Filippini","Jeff King","Eric Sunshine","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"236879","messageId":"5326F158.4050402@free.fr","threadId":"36196","inReplyTo":null,"subject":"[BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set","fromName":"Gilles Filippini","fromEmail":"gilles.filippini@free.fr","sentAt":"2014-03-17T12:58:00Z","receivedAt":"2014-03-17T12:58:00Z","isPatch":false,"sender":{"key":"gilles.filippini@free.fr","avatar":"https://gravatar.com/avatar/a7b88473c00f8109c69668ee09082dcfc2da292237b2184850ec66a252627aab?d=mp&s=160"},"body":"Hi,\n\nTest 21 from contrib/subtree/t/t7900-subtree.sh fails when an\nenvironment variable 'prefix' is set. For instance here is what happens\nwhen prefix=/usr:\n\nexpecting success:\n        echo \"You must provide the --prefix option.\" > expected &&\n        test_must_fail git subtree split > actual 2>&1 &&\n\ttest_debug \"printf 'expected: '\" &&\n        test_debug \"cat expected\" &&\n\ttest_debug \"printf 'actual: '\" &&\n        test_debug \"cat actual\" &&\n        test_cmp expected actual &&\n        rm -f expected actual\n\n--- expected\t2014-03-17 10:39:34.907594853 +0000\n+++ actual\t2014-03-17 10:39:34.979595322 +0000\n@@ -1 +1,9 @@\n-You must provide the --prefix option.\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\nfatal: /usr: '/usr' is outside repository\n+No new revisions were found\nnot ok 21 - Check that prefix argument is required for split\n\n\nThanks,\n\n_g.\n"},{"id":"236908","messageId":"20140317195946.GA29839@sigill.intra.peff.net","threadId":"36196","inReplyTo":"5326F158.4050402@free.fr","subject":"[PATCH] subtree: initialize \"prefix\" variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-17T19:59:47Z","receivedAt":"2014-03-17T19:59:47Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:\n\n> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an\n> environment variable 'prefix' is set. For instance here is what happens\n> when prefix=/usr:\n\nI think it just needs the patch below.\n\n-- >8 --\nWe parse the \"--prefix\" command-line option into the\n\"$prefix\" shell variable. However, if we do not see such an\noption, the variable is left with whatever value it had in\nthe environment. We should initialize it to a known value,\nlike we do for other variables.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI checked, and this looks like the only variable in this situation.\n\n contrib/subtree/git-subtree.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex dc59a91..db925ca 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -46,6 +46,7 @@ ignore_joins=\n annotate=\n squash=\n message=\n+prefix=\n \n debug()\n {\n-- \n1.9.0.532.gc4c322d\n"},{"id":"236909","messageId":"CAPig+cSbi7X1z+u8EzXhdMb6_ENbLcTiHyXG0erfpCR=a5BEYQ@mail.gmail.com","threadId":"36196","inReplyTo":"20140317195946.GA29839@sigill.intra.peff.net","subject":"Re: [PATCH] subtree: initialize \"prefix\" variable","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-03-17T20:08:50Z","receivedAt":"2014-03-17T20:08:50Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Mar 17, 2014 at 3:59 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:\n>\n>> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an\n>> environment variable 'prefix' is set. For instance here is what happens\n>> when prefix=/usr:\n>\n> I think it just needs the patch below.\n\nGilles submitted this same patch [1] a couple weeks ago but it appears\nto have been lost in the noise. Your commit message is a bit nicer.\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/243103/\n\n> -- >8 --\n> We parse the \"--prefix\" command-line option into the\n> \"$prefix\" shell variable. However, if we do not see such an\n> option, the variable is left with whatever value it had in\n> the environment. We should initialize it to a known value,\n> like we do for other variables.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> I checked, and this looks like the only variable in this situation.\n>\n>  contrib/subtree/git-subtree.sh | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index dc59a91..db925ca 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -46,6 +46,7 @@ ignore_joins=\n>  annotate=\n>  squash=\n>  message=\n> +prefix=\n>\n>  debug()\n>  {\n> --\n> 1.9.0.532.gc4c322d\n"},{"id":"236913","messageId":"xmqqiorcd088.fsf@gitster.dls.corp.google.com","threadId":"36196","inReplyTo":"5326F158.4050402@free.fr","subject":"Re: [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-17T20:44:07Z","receivedAt":"2014-03-17T20:44:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gilles Filippini <gilles.filippini@free.fr> writes:\n\n> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an\n> environment variable 'prefix' is set. For instance here is what happens\n> when prefix=/usr:\n>\n> expecting success:\n>         echo \"You must provide the --prefix option.\" > expected &&\n>         test_must_fail git subtree split > actual 2>&1 &&\n> \ttest_debug \"printf 'expected: '\" &&\n>         test_debug \"cat expected\" &&\n> \ttest_debug \"printf 'actual: '\" &&\n>         test_debug \"cat actual\" &&\n>         test_cmp expected actual &&\n>         rm -f expected actual\n>\n> --- expected\t2014-03-17 10:39:34.907594853 +0000\n> +++ actual\t2014-03-17 10:39:34.979595322 +0000\n> @@ -1 +1,9 @@\n> -You must provide the --prefix option.\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> fatal: /usr: '/usr' is outside repository\n> +No new revisions were found\n> not ok 21 - Check that prefix argument is required for split\n\nThanks.  Although I do not use nor touch git-subtree, I am\nreasonably confident that this patch should fix it.\n\n-- >8 --\nSubject: subtree: initialise all variables to known state\n\nParsing the command line options may set prefix to the given value\nwith --prefix=value or an empty string with --no-prefix, but the\nscript forgets to protect against a stray environment variable.\n\nMake sure all the variables that can be assigned in the command line\nparsing are initialized to empty.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/subtree/git-subtree.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 7d7af03..90e0b7e 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -46,6 +46,7 @@ ignore_joins=\n annotate=\n squash=\n message=\n+prefix=\n \n debug()\n {\n"},{"id":"236914","messageId":"20140317205616.GA18629@sigill.intra.peff.net","threadId":"36196","inReplyTo":"CAPig+cSbi7X1z+u8EzXhdMb6_ENbLcTiHyXG0erfpCR=a5BEYQ@mail.gmail.com","subject":"Re: [PATCH] subtree: initialize \"prefix\" variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-17T20:56:17Z","receivedAt":"2014-03-17T20:56:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 17, 2014 at 04:08:50PM -0400, Eric Sunshine wrote:\n\n> On Mon, Mar 17, 2014 at 3:59 PM, Jeff King <peff@peff.net> wrote:\n> > On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:\n> >\n> >> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an\n> >> environment variable 'prefix' is set. For instance here is what happens\n> >> when prefix=/usr:\n> >\n> > I think it just needs the patch below.\n> \n> Gilles submitted this same patch [1] a couple weeks ago but it appears\n> to have been lost in the noise. Your commit message is a bit nicer.\n> \n> [1]: http://thread.gmane.org/gmane.comp.version-control.git/243103/\n\nAh, sorry Gilles, I completely missed that. Junio, if you pick this up,\nplease feel free to use text from my commit message as you see fit, but\nmark Gilles as the author.\n\nThanks, Eric, for pointing it out.\n\n-Peff\n"}]}