All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: buildroot@buildroot.org
Cc: John Keeping <john@metanate.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>
Subject: [Buildroot] [PATCH] support/download/git: disable global & system config
Date: Thu, 11 Aug 2022 14:45:33 +0100	[thread overview]
Message-ID: <20220811134533.508348-1-john@metanate.com> (raw)

The build environment should be isolated from the host system as much as
possible to keep the build reproducible.  Git's global config (usually
~/.gitconfig) and system config (/etc/gitconfig) can affect the
behaviour of all Git operations, so should be disabled.

An example of this is that `git lfs install` will add the LFS smudge
filter to the global config and thus always checkout LFS files ignoring
the value of $(PKG)_GIT_LFS.  This may mask a bug in the package when
the initial developer's machine has LFS installed globally.

Signed-off-by: John Keeping <john@metanate.com>
---
 support/download/git | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/support/download/git b/support/download/git
index 1a1c315f73..b0a677c3a3 100755
--- a/support/download/git
+++ b/support/download/git
@@ -82,13 +82,17 @@ trap _on_error ERR
 # being expanded a second time (in case there are spaces in them)
 _git() {
     if [ -z "${quiet}" ]; then
-        printf '%s ' GIT_DIR="${git_cache}/.git" ${GIT} "${@}"; printf '\n'
+        printf '%s ' GIT_CONFIG_GLOBAL=/dev/null \
+            GIT_CONFIG_SYSTEM=/dev/null \
+            GIT_DIR="${git_cache}/.git" ${GIT} "${@}"
+        printf '\n'
     fi
     _plain_git "$@"
 }
 # Note: please keep command below aligned with what is printed above
 _plain_git() {
-    eval GIT_DIR="${git_cache}/.git" ${GIT} "${@}"
+    eval GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null \
+        GIT_DIR="${git_cache}/.git" ${GIT} "${@}"
 }
 
 # Create a warning file, that the user should not use the git cache.
-- 
2.37.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2022-08-11 13:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 13:45 John Keeping [this message]
2022-08-13 22:11 ` [Buildroot] [PATCH] support/download/git: disable global & system config Yann E. MORIN
2022-08-15 10:46   ` John Keeping
2022-08-15 11:41     ` Yann E. MORIN
2022-08-15 14:24       ` John Keeping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220811134533.508348-1-john@metanate.com \
    --to=john@metanate.com \
    --cc=buildroot@buildroot.org \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.