Files
nixpkgs/pkgs/build-support/fetchgit/builder.sh
Alexander Bantyev 296399ec68 fetchgit: add a gitConfigFile argument
Passing a `gitConfigFile` argument as a string allows setting a custom
git config (as `$GIT_CONFIG_GLOBAL`). The most obvious use is to
override URLs with custom mirrors, but others are possible too.
2025-09-29 22:34:11 +02:00

28 lines
817 B
Bash

# tested so far with:
# - no revision specified and remote has a HEAD which is used
# - revision specified and remote has a HEAD
# - revision specified and remote without HEAD
#
echo "exporting $url (rev $rev) into $out"
runHook preFetch
if [ -n "$gitConfigFile" ]; then
echo "using GIT_CONFIG_GLOBAL=$gitConfigFile"
export GIT_CONFIG_GLOBAL="$gitConfigFile"
fi
$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" --name "$name" \
${leaveDotGit:+--leave-dotGit} \
${fetchLFS:+--fetch-lfs} \
${deepClone:+--deepClone} \
${fetchSubmodules:+--fetch-submodules} \
${fetchTags:+--fetch-tags} \
${sparseCheckout:+--sparse-checkout "$sparseCheckout"} \
${nonConeMode:+--non-cone-mode} \
${branchName:+--branch-name "$branchName"} \
${rootDir:+--root-dir "$rootDir"}
runHook postFetch