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

Re: [PATCH 1/1] tests: fix gzip with exported GZIP variable in environment

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 3, 2013, 09:49 UTC
Message-ID
<CAPig+cQqKQdVEojYF+-+ZE2hQjxsH4WrgPymj8g7P6pSQzfVpw@mail.gmail.com>
In-Reply-To
<1386061054-30796-1-git-send-email-mail@eworm.de>
[cc'ing Peff, the author of these tests]
On Tue, Dec 3, 2013 at 3:57 AM, Christian Hesse <mail@eworm.de> wrote:
Show 8 quoted lines
> In t/t5000-tar-tree.sh the variable GZIP is used for the command name.
> From man gzip:
>
>> The environment variable GZIP can hold a set of default options for
>> gzip. These options are interpreted first and can be overwritten by
>> explicit command line parameters.
>
> So using any other variable name fixes this.
Missing Signed-off-by: <you>
Show 25 quoted lines
> ---
>  t/t5000-tar-tree.sh | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> index c2023b1..01b0ed9 100755
> --- a/t/t5000-tar-tree.sh
> +++ b/t/t5000-tar-tree.sh
> @@ -25,7 +25,7 @@ commit id embedding:
>  '
>
>  . ./test-lib.sh
> -GZIP=${GZIP:-gzip}
> +GZIPCMD=${GZIPCMD:-gzip}
>  GUNZIP=${GUNZIP:-gzip -d}
>
>  SUBSTFORMAT=%H%n
> @@ -275,27 +275,27 @@ test_expect_success 'only enabled filters are available remotely' '
>         test_cmp remote.bar config.bar
>  '
>
> -if $GZIP --version >/dev/null 2>&1; then
> -       test_set_prereq GZIP
> +if $GZIPCMD --version >/dev/null 2>&1; then
> +       test_set_prereq GZIPCMD

test_set_prereq is not actually operating on an environment variable. Its argument is just a generic tag, which is uppercase by convention, but not otherwise related to a variable which may share the same name, and which does not pollute the environment. Consequently, it should not be necessary to rename the argument to test_set_prereq, thus all changes following this one become superfluous (since they are checking for presence of tag GZIP, not referencing environment variable GZIP or GZIPCMD). Thus, the patch becomes much smaller.

In fact, the GZIP command does not appear to be used at all by the tests, so a simpler solution might be to remove the variable altogether, and perhaps the prerequisite. Peff?

Show 54 quoted lines
>  else
>         say "Skipping some tar.gz tests because gzip not found"
>  fi
>
> -test_expect_success GZIP 'git archive --format=tgz' '
> +test_expect_success GZIPCMD 'git archive --format=tgz' '
>         git archive --format=tgz HEAD >j.tgz
>  '
>
> -test_expect_success GZIP 'git archive --format=tar.gz' '
> +test_expect_success GZIPCMD 'git archive --format=tar.gz' '
>         git archive --format=tar.gz HEAD >j1.tar.gz &&
>         test_cmp j.tgz j1.tar.gz
>  '
>
> -test_expect_success GZIP 'infer tgz from .tgz filename' '
> +test_expect_success GZIPCMD 'infer tgz from .tgz filename' '
>         git archive --output=j2.tgz HEAD &&
>         test_cmp j.tgz j2.tgz
>  '
>
> -test_expect_success GZIP 'infer tgz from .tar.gz filename' '
> +test_expect_success GZIPCMD 'infer tgz from .tar.gz filename' '
>         git archive --output=j3.tar.gz HEAD &&
>         test_cmp j.tgz j3.tar.gz
>  '
> @@ -306,17 +306,17 @@ else
>         say "Skipping some tar.gz tests because gunzip was not found"
>  fi
>
> -test_expect_success GZIP,GUNZIP 'extract tgz file' '
> +test_expect_success GZIPCMD,GUNZIP 'extract tgz file' '
>         $GUNZIP -c <j.tgz >j.tar &&
>         test_cmp b.tar j.tar
>  '
>
> -test_expect_success GZIP 'remote tar.gz is allowed by default' '
> +test_expect_success GZIPCMD 'remote tar.gz is allowed by default' '
>         git archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&
>         test_cmp j.tgz remote.tar.gz
>  '
>
> -test_expect_success GZIP 'remote tar.gz can be disabled' '
> +test_expect_success GZIPCMD 'remote tar.gz can be disabled' '
>         git config tar.tar.gz.remote false &&
>         test_must_fail git archive --remote=. --format=tar.gz HEAD \
>                 >remote.tar.gz
> --
> 1.8.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Christian HesseNext: Jeff King
Message 2 of 7 in “tests: fix gzip with exported GZIP variable in environment”
  1. 1/1 tests: fix gzip with exported GZIP variable in environmentChristian Hesse, Dec 3, 2013
  2. Eric SunshineDec 3, 2013
  3. Jeff KingDec 3, 2013
  4. t5000: simplify gzip prerequisite checksJeff King, Dec 3, 2013
  5. Junio C HamanoDec 3, 2013
  6. Jeff KingDec 4, 2013
  7. Junio C HamanoDec 4, 2013

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.