mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00

Added fetchTags feature to fetchgit, explicit and clear support for fetching all tags after the source tree fetch completes. Doing this at build-time in the fetcher is required for packages that invoke commands like 'git describe' which require tags, and since the nix store is read-only by design, it is not possible to git fetch --tags at activation- or run-time. This feature may have been possible by specifying a postFetch option including calling git fetch --tags, however doing so obfuscates the solution to this very real problem. Explicit support for fetching tags should be a first class citizen just like fetching other refs.
21 lines
650 B
Bash
21 lines
650 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
|
|
|
|
$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"}
|
|
|
|
runHook postFetch
|