# [PATCH] test-lib.sh: unset XDG_CACHE_HOME

2 messages from 2018-02-16 to 2018-02-16. Participants: Genki Sky, Jeff King.
Thread: https://gitlist.dev/t/47859

## Genki Sky, 2018-02-16 02:46

Subject: [PATCH] test-lib.sh: unset XDG_CACHE_HOME
Message-ID: <6f102a37a06940f6feeeb0c8807ac98a850b7a3b.1518748907.git.sky@genki.is>
URL: https://gitlist.dev/e/6f102a37a06940f6feeeb0c8807ac98a850b7a3b.1518748907.git.sky%40genki.is

```
git respects XDG_CACHE_HOME for the credential cache. So, we should
unset XDG_CACHE_HOME for the test environment, lest a user's custom one
cause failure in the test.

For example, t/t0301-credential-cache.sh expects a default directory
to be used if it hasn't explicitly set XDG_CACHE_HOME.

Signed-off-by: Genki Sky <sky@genki.is>
---

Notes:

  This is the XDG_CACHE_HOME version of 5adf84ebb ("test-lib.sh: unset
  XDG_CONFIG_HOME", 2012-07-24).

 t/test-lib.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9af19055b..001ef6b64 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -116,6 +116,7 @@ unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
 	my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
 	print join("\n", @vars);
 ')
+unset XDG_CACHE_HOME
 unset XDG_CONFIG_HOME
 unset GITPERLLIB
 GIT_AUTHOR_EMAIL=author@example.com
--
2.16.1.195.g373da842b


```

## Jeff King, 2018-02-16 18:35

Subject: Re: [PATCH] test-lib.sh: unset XDG_CACHE_HOME
Message-ID: <20180216183523.GA22021@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20180216183523.GA22021%40sigill.intra.peff.net
In-Reply-To: <6f102a37a06940f6feeeb0c8807ac98a850b7a3b.1518748907.git.sky@genki.is>

```
On Thu, Feb 15, 2018 at 09:46:04PM -0500, Genki Sky wrote:

> git respects XDG_CACHE_HOME for the credential cache. So, we should
> unset XDG_CACHE_HOME for the test environment, lest a user's custom one
> cause failure in the test.
> 
> For example, t/t0301-credential-cache.sh expects a default directory
> to be used if it hasn't explicitly set XDG_CACHE_HOME.

Yep, this makes perfect sense. I can't believe it took almost a year for
somebody to trigger this. I guess most people don't set XDG_CACHE_HOME.

Thanks.

-Peff

```
