* [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set
@ 2014-03-17 12:58 Gilles Filippini
2014-03-17 19:59 ` [PATCH] subtree: initialize "prefix" variable Jeff King
2014-03-17 20:44 ` [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Gilles Filippini @ 2014-03-17 12:58 UTC (permalink / raw)
To: git
Hi,
Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an
environment variable 'prefix' is set. For instance here is what happens
when prefix=/usr:
expecting success:
echo "You must provide the --prefix option." > expected &&
test_must_fail git subtree split > actual 2>&1 &&
test_debug "printf 'expected: '" &&
test_debug "cat expected" &&
test_debug "printf 'actual: '" &&
test_debug "cat actual" &&
test_cmp expected actual &&
rm -f expected actual
--- expected 2014-03-17 10:39:34.907594853 +0000
+++ actual 2014-03-17 10:39:34.979595322 +0000
@@ -1 +1,9 @@
-You must provide the --prefix option.
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
fatal: /usr: '/usr' is outside repository
+No new revisions were found
not ok 21 - Check that prefix argument is required for split
Thanks,
_g.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] subtree: initialize "prefix" variable
2014-03-17 12:58 [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Gilles Filippini
@ 2014-03-17 19:59 ` Jeff King
2014-03-17 20:08 ` Eric Sunshine
2014-03-17 20:44 ` [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2014-03-17 19:59 UTC (permalink / raw)
To: Gilles Filippini; +Cc: Junio C Hamano, git
On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:
> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an
> environment variable 'prefix' is set. For instance here is what happens
> when prefix=/usr:
I think it just needs the patch below.
-- >8 --
We parse the "--prefix" command-line option into the
"$prefix" shell variable. However, if we do not see such an
option, the variable is left with whatever value it had in
the environment. We should initialize it to a known value,
like we do for other variables.
Signed-off-by: Jeff King <peff@peff.net>
---
I checked, and this looks like the only variable in this situation.
contrib/subtree/git-subtree.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index dc59a91..db925ca 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -46,6 +46,7 @@ ignore_joins=
annotate=
squash=
message=
+prefix=
debug()
{
--
1.9.0.532.gc4c322d
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] subtree: initialize "prefix" variable
2014-03-17 19:59 ` [PATCH] subtree: initialize "prefix" variable Jeff King
@ 2014-03-17 20:08 ` Eric Sunshine
2014-03-17 20:56 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Eric Sunshine @ 2014-03-17 20:08 UTC (permalink / raw)
To: Jeff King; +Cc: Gilles Filippini, Junio C Hamano, Git List
On Mon, Mar 17, 2014 at 3:59 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:
>
>> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an
>> environment variable 'prefix' is set. For instance here is what happens
>> when prefix=/usr:
>
> I think it just needs the patch below.
Gilles submitted this same patch [1] a couple weeks ago but it appears
to have been lost in the noise. Your commit message is a bit nicer.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/243103/
> -- >8 --
> We parse the "--prefix" command-line option into the
> "$prefix" shell variable. However, if we do not see such an
> option, the variable is left with whatever value it had in
> the environment. We should initialize it to a known value,
> like we do for other variables.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I checked, and this looks like the only variable in this situation.
>
> contrib/subtree/git-subtree.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index dc59a91..db925ca 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -46,6 +46,7 @@ ignore_joins=
> annotate=
> squash=
> message=
> +prefix=
>
> debug()
> {
> --
> 1.9.0.532.gc4c322d
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set
2014-03-17 12:58 [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Gilles Filippini
2014-03-17 19:59 ` [PATCH] subtree: initialize "prefix" variable Jeff King
@ 2014-03-17 20:44 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2014-03-17 20:44 UTC (permalink / raw)
To: Gilles Filippini; +Cc: git, David A. Greene
Gilles Filippini <gilles.filippini@free.fr> writes:
> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an
> environment variable 'prefix' is set. For instance here is what happens
> when prefix=/usr:
>
> expecting success:
> echo "You must provide the --prefix option." > expected &&
> test_must_fail git subtree split > actual 2>&1 &&
> test_debug "printf 'expected: '" &&
> test_debug "cat expected" &&
> test_debug "printf 'actual: '" &&
> test_debug "cat actual" &&
> test_cmp expected actual &&
> rm -f expected actual
>
> --- expected 2014-03-17 10:39:34.907594853 +0000
> +++ actual 2014-03-17 10:39:34.979595322 +0000
> @@ -1 +1,9 @@
> -You must provide the --prefix option.
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> fatal: /usr: '/usr' is outside repository
> +No new revisions were found
> not ok 21 - Check that prefix argument is required for split
Thanks. Although I do not use nor touch git-subtree, I am
reasonably confident that this patch should fix it.
-- >8 --
Subject: subtree: initialise all variables to known state
Parsing the command line options may set prefix to the given value
with --prefix=value or an empty string with --no-prefix, but the
script forgets to protect against a stray environment variable.
Make sure all the variables that can be assigned in the command line
parsing are initialized to empty.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
contrib/subtree/git-subtree.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 7d7af03..90e0b7e 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -46,6 +46,7 @@ ignore_joins=
annotate=
squash=
message=
+prefix=
debug()
{
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] subtree: initialize "prefix" variable
2014-03-17 20:08 ` Eric Sunshine
@ 2014-03-17 20:56 ` Jeff King
0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2014-03-17 20:56 UTC (permalink / raw)
To: Eric Sunshine; +Cc: Gilles Filippini, Junio C Hamano, Git List
On Mon, Mar 17, 2014 at 04:08:50PM -0400, Eric Sunshine wrote:
> On Mon, Mar 17, 2014 at 3:59 PM, Jeff King <peff@peff.net> wrote:
> > On Mon, Mar 17, 2014 at 01:58:00PM +0100, Gilles Filippini wrote:
> >
> >> Test 21 from contrib/subtree/t/t7900-subtree.sh fails when an
> >> environment variable 'prefix' is set. For instance here is what happens
> >> when prefix=/usr:
> >
> > I think it just needs the patch below.
>
> Gilles submitted this same patch [1] a couple weeks ago but it appears
> to have been lost in the noise. Your commit message is a bit nicer.
>
> [1]: http://thread.gmane.org/gmane.comp.version-control.git/243103/
Ah, sorry Gilles, I completely missed that. Junio, if you pick this up,
please feel free to use text from my commit message as you see fit, but
mark Gilles as the author.
Thanks, Eric, for pointing it out.
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-17 20:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17 12:58 [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Gilles Filippini
2014-03-17 19:59 ` [PATCH] subtree: initialize "prefix" variable Jeff King
2014-03-17 20:08 ` Eric Sunshine
2014-03-17 20:56 ` Jeff King
2014-03-17 20:44 ` [BUG] contrib/subtree: t/t7900-subtree.sh: test 21 fails when environment variable 'prefix' is set Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.