@@ -811,6 +811,9 @@ ${@buildhistory_get_metadata_revs(d)}
END
( cd ${BUILDHISTORY_DIR}/
+ # Ignore system git config for local operations so host hooks or
+ # helpers absent from HOSTTOOLS cannot break buildhistory.
+ export GIT_CONFIG_NOSYSTEM=1
# Initialise the repo if necessary
if [ ! -e .git ] ; then
git init -q
@@ -833,10 +836,12 @@ END
buildhistory_single_commit "$CMDLINE" "$HOSTNAME" dummy
else
buildhistory_single_commit "$CMDLINE" "$HOSTNAME"
- fi
- if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
- git push -q ${BUILDHISTORY_PUSH_REPO}
fi) || true
+ if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
+ # Keep system git config enabled for push (proxies, CAs, credentials).
+ ( cd ${BUILDHISTORY_DIR}/
+ git push -q ${BUILDHISTORY_PUSH_REPO} ) || true
+ fi
}
python buildhistory_eventhandler() {
BitBake restricts PATH to HOSTTOOLS_DIR rather than the host's /usr/bin, but git still reads /etc/gitconfig. When the system git config enables hooks or helpers backed by host binaries outside HOSTTOOLS (for example, config-based hooks invoking git-secrets), git commit fails with: git: 'secrets' is not a git command. See 'git --help'. Because buildhistory_commit() runs inside `(...) || true`, the failure is silently ignored and no buildhistory commit is created. Neither --no-verify (which does not skip prepare-commit-msg) nor `-c core.hooksPath=/dev/null` (which does not disable config-based `[hook "..."]` entries) prevents the failure. Export GIT_CONFIG_NOSYSTEM=1 for the local repository operations in buildhistory_commit() -- including check_git_config so it does not rely on user.name/user.email from /etc/gitconfig that git commit would then ignore -- and run git push in a separate subshell so BUILDHISTORY_PUSH_REPO can still use system proxy, CA, or credential settings. Tested under /bin/sh -e with a minimal PATH (without git-secrets) across initial and no-change runs with BUILDHISTORY_PUSH_REPO set, verifying GIT_CONFIG_NOSYSTEM=1 on all local git calls and unset on git push. AI-Generated: Uses Gemini Signed-off-by: André Draszik <andre.draszik@linaro.org> --- meta/classes/buildhistory.bbclass | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)