nix-prefetch-git: Name FETCHED_HEAD "$ref" only for refs/tags/*

This commit is contained in:
Yueh-Shun Li
2025-12-23 04:50:05 +08:00
committed by GitHub
parent 532a0e9708
commit 62b2dbef68
+2 -2
View File
@@ -287,9 +287,9 @@ clone(){
clean_git fetch origin 'refs/tags/*:refs/tags/*' || echo "warning: failed to fetch some tags" >&2
fi
# Name "$ref" to make `git describe` work reproducibly in `NIX_PREFETCH_GIT_CHECKOUT_HOOK`.
# Name tag "$ref" to make `git describe` work reproducibly in `NIX_PREFETCH_GIT_CHECKOUT_HOOK`.
# Name only when not leaving `.git` for compatibility purposes.
if [[ -n "$ref" ]] && [[ -z "$leaveDotGit" ]]; then
if [[ "$ref" =~ ^refs/tags/ ]] && [[ -z "$leaveDotGit" ]]; then
echo "refer to FETCH_HEAD as its original name $ref"
clean_git update-ref "$ref" FETCH_HEAD
fi