Subject: Re: bug#37679: Local git configuration interferes with testsuite

From: Ludovic Courtès <[email-masked]>
Date: Tue, 07 Jan 2020 10:11:32 +0100

Hello!

Gábor Boskovits <[email-masked]> skribis:

> From abf20477ea139bfaf1f2e21f09c2420fe618c9ca Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <[email-masked]>
> Date: Tue, 8 Oct 2019 22:41:20 +0200
> Subject: [PATCH] tests: Isolate git from external configuration.
>
> * Makefile.am(AM_TESTS_ENVIRONMENT): Add environment variables to
> make git ignore the user and system configuration files.
> * tests/fake-home/.gitconfig: New file. Provide minimal git
> configuration for tests.
> ---
>  Makefile.am                |  9 ++++++++-
>  tests/fake-home/.gitconfig | 21 +++++++++++++++++++++
>  2 files changed, 29 insertions(+), 1 deletion(-)
>  create mode 100644 tests/fake-home/.gitconfig
>
> diff --git a/Makefile.am b/Makefile.am
> index 36767c2f47..e7bf819a6b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -14,6 +14,7 @@
>  # Copyright © 2018 Oleg Pykhalov <[email-masked]>
>  # Copyright © 2018 Alex Vong <[email-masked]>
>  # Copyright © 2019 Efraim Flashner <[email-masked]>
> +# Copyright © 2019 Gábor Boskovits <[email-masked]>
>  #
>  # This file is part of GNU Guix.
>  #
> @@ -472,7 +473,13 @@ SH_TESTS =					\
>  
>  TESTS = $(SCM_TESTS) $(SH_TESTS)
>  
> -AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" GUILE_AUTO_COMPILE=0
> +AM_TESTS_ENVIRONMENT = 				\
> +  abs_top_srcdir="$(abs_top_srcdir)" 		\
> +  GUILE_AUTO_COMPILE=0				\
> +  GIT_CONFIG_NOSYSTEM=1				\
> +  GIT_ATTR_NOSYSTEM=1				\
> +  HOME="$(abs_top_srcdir)/tests/fake-home"	\
> +  XDG_CONFIG_HOME="$(abs_top_srcdir)/tests/fake-xgd-config-home"

Ooh, good catch.  This change fixes issues with ‘tests/git.scm’, is that
correct?

The ‘GIT_’ environment variables are honored by Git itself, not by
libgit2/Guile-Git, right?

Can we avoid setting HOME and XDG_CONFIG_HOME?

Perhaps these variables should all be set in ‘test-env’ along with their
friends, for consistency?

Last, if we end up keeping ‘tests/fake-home’, make sure to also add it
to ‘EXTRA_DIST’ in ‘Makefile.am’.

Could you send an updated patch?

Thanks for addressing it, and sorry for the loooong delay!

Ludo’.