diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-10-16 12:01:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-16 12:01:54 +0000 |
commit | de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4 (patch) | |
tree | 2c2532a9142db7cbc2dda2f6891a55a927334cbc /pkgs/build-support | |
parent | ae77d35744934bc6aa3591f39de8b492a0d5502e (diff) | |
parent | cb4734193d340444dcfba7081e23bf4bb56776e5 (diff) | |
download | nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar.gz nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar.bz2 nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar.lz nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar.xz nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.tar.zst nixpkgs-de49fc16bcff09e7c42f4ae9a0f571ffa019ebf4.zip |
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-x | pkgs/build-support/fetchgit/nix-prefetch-git | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 018cf692b88..feb6c9e3053 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -257,9 +257,15 @@ make_deterministic_repo(){ cd "$repo" # Remove files that contain timestamps or otherwise have non-deterministic # properties. - rm -rf .git/logs/ .git/hooks/ .git/index .git/FETCH_HEAD .git/ORIG_HEAD \ - .git/refs/remotes/origin/HEAD .git/config - + if [ -f .git ]; then + local dotgit_content=$(<.git) + local dotgit_dir="${dotgit_content#gitdir: }" + else + local dotgit_dir=".git" + fi + pushd "$dotgit_dir" + rm -rf logs/ hooks/ index FETCH_HEAD ORIG_HEAD refs/remotes/origin/HEAD config + popd # Remove all remote branches. git branch -r | while read -r branch; do clean_git branch -rD "$branch" @@ -277,7 +283,7 @@ make_deterministic_repo(){ # Do a full repack. Must run single-threaded, or else we lose determinism. clean_git config pack.threads 1 clean_git repack -A -d -f - rm -f .git/config + rm -f "$dotgit_dir/config" # Garbage collect unreferenced objects. # Note: --keep-largest-pack prevents non-deterministic ordering of packs @@ -323,7 +329,7 @@ clone_user_rev() { find "$dir" -name .git -print0 | xargs -0 rm -rf else find "$dir" -name .git | while read -r gitdir; do - make_deterministic_repo "$(readlink -f "$gitdir/..")" + make_deterministic_repo "$(readlink -f "$(dirname "$gitdir")")" done fi } |