nix-prefetch-git: disable maintenance mode via environment variables
The commit 011471c7f2 ("fetchgit: disable git maintenance") disabled
git's maintenance mode, but that does not affect git repositories with
submodules.
Switch to using the GIT_CONFIG_* environment variables. This is done in
a way to make the approach more generic, but also kinda not the best
("insane") so that it works with any future change, even with
`impureEnvVars`.
Maybe `git -c maintenance.auto=false` can work but I cannot figure out
how to use that here. I would prefer disabling maintenance mode in Git's
derivation itself but did not find any build-time knob to toggle that.
This commit is contained in:
@@ -123,10 +123,6 @@ fi
|
|||||||
init_remote(){
|
init_remote(){
|
||||||
local url=$1
|
local url=$1
|
||||||
clean_git init --initial-branch=master
|
clean_git init --initial-branch=master
|
||||||
# Disable maintenance: it's not useful for a short-lived clone, and
|
|
||||||
# background maintenance causes non-deterministic builds.
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/524215
|
|
||||||
clean_git config maintenance.auto false
|
|
||||||
clean_git remote add origin "$url"
|
clean_git remote add origin "$url"
|
||||||
if [ -n "$sparseCheckout" ]; then
|
if [ -n "$sparseCheckout" ]; then
|
||||||
git config remote.origin.partialclonefilter "blob:none"
|
git config remote.origin.partialclonefilter "blob:none"
|
||||||
@@ -518,6 +514,15 @@ HOME="$tmpHomePath"
|
|||||||
unset XDG_CONFIG_HOME
|
unset XDG_CONFIG_HOME
|
||||||
export GIT_CONFIG_NOSYSTEM=1
|
export GIT_CONFIG_NOSYSTEM=1
|
||||||
|
|
||||||
|
|
||||||
|
# Disable maintenance: it's not useful for a short-lived clone, and
|
||||||
|
# background maintenance causes non-deterministic builds.
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/524215
|
||||||
|
export GIT_CONFIG_COUNT=$(( ${GIT_CONFIG_COUNT:-0} + 1 ))
|
||||||
|
# Not the best but generic enough that it will work with `impureEnvVars`
|
||||||
|
export "GIT_CONFIG_KEY_$(( GIT_CONFIG_COUNT - 1 ))=maintenance.auto"
|
||||||
|
export "GIT_CONFIG_VALUE_$(( GIT_CONFIG_COUNT - 1 ))=false"
|
||||||
|
|
||||||
if test -n "$builder"; then
|
if test -n "$builder"; then
|
||||||
test -n "$out" -a -n "$url" -a -n "$rev" || usage
|
test -n "$out" -a -n "$url" -a -n "$rev" || usage
|
||||||
if test -n "$rootDir"; then
|
if test -n "$rootDir"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user