Subject: bug#37679: [PATCH 1/2] tests: Isolate git from user configuration.

From: Gábor Boskovits <[email-masked]>
Date: Sun, 29 Mar 2020 15:18:09 +0200

* tests/fake-home/.gitconfig: New file. Provide minimal git
configuration for tests.
* build-aux/test-env.in: Set HOME to the fake home.
* Makefile.am(EXTRA_DIST): Add fake-home/.gitconfig.
---
 Makefile.am                |  2 ++
 build-aux/test-env.in      |  4 ++++
 tests/fake-home/.gitconfig | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 tests/fake-home/.gitconfig

diff --git a/Makefile.am b/Makefile.am
index 344ecdbc42..5eb918d599 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 © 2020 Gábor Boskovits <[email-masked]>
 #
 # This file is part of GNU Guix.
 #
@@ -560,6 +561,7 @@ EXTRA_DIST +=						\
   build-aux/update-NEWS.scm				\
   d3.v3.js						\
   graph.js						\
+  tests/fake-home/.gitconfig				\
   tests/test.drv					\
   tests/signing-key.pub					\
   tests/signing-key.sec					\
diff --git a/build-aux/test-env.in b/build-aux/test-env.in
index 59ab58cc94..1121570fbc 100644
--- a/build-aux/test-env.in
+++ b/build-aux/test-env.in
@@ -2,6 +2,7 @@
 
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <[email-masked]>
+# Copyright © 2020 Gábor Boskovits <[email-masked]>
 #
 # This file is part of GNU Guix.
 #
@@ -151,6 +152,9 @@ export GUIX_BUILD_OPTIONS
 # Ignore user settings.
 unset GUIX_PACKAGE_PATH
 
+# Provide fake home for tests using git
+HOME="@abs_top_srcdir@/tests/fake-home"
+
 storedir="@storedir@"
 prefix="@prefix@"
 datarootdir="@datarootdir@"
diff --git a/tests/fake-home/.gitconfig b/tests/fake-home/.gitconfig
new file mode 100644
index 0000000000..c32de560e7
--- /dev/null
+++ b/tests/fake-home/.gitconfig
@@ -0,0 +1,21 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2020 Gábor Boskovits <[email-masked]>
+#
+# This file is part of GNU Guix.
+#
+# GNU Guix is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Guix is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+[user]
+  email = [email-masked]
+  name = Alice
-- 
2.25.0