summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchgit
diff options
context:
space:
mode:
authorYueh-Shun Li <shamrocklee@posteo.net>2025-11-16 01:03:28 +0800
committerYueh-Shun Li <shamrocklee@posteo.net>2025-11-17 02:09:55 +0800
commit9fe4e65f3cbf46dbdf575b63a04df96acf27874a (patch)
treee7c495bf5046ac76b7ea2d89edc4f74b2f944ab1 /pkgs/build-support/fetchgit
parentfetchgit: move assertions down to argument values (diff)
downloadnixpkgs-9fe4e65f3cbf46dbdf575b63a04df96acf27874a.tar.gz
fetchgit: default argument leaveDotGit to null
Diffstat (limited to 'pkgs/build-support/fetchgit')
-rw-r--r--pkgs/build-support/fetchgit/default.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix
index 4d0c2c7af8b1..ef2c2cd43093 100644
--- a/pkgs/build-support/fetchgit/default.nix
+++ b/pkgs/build-support/fetchgit/default.nix
@@ -66,7 +66,8 @@ lib.makeOverridable (
# when rootDir is specified, avoid invalidating the result when rev changes
append = if rootDir != "" then "-${lib.strings.sanitizeDerivationName rootDir}" else "";
},
- leaveDotGit ? deepClone || fetchTags,
+ # When null, will default to: `deepClone || fetchTags`
+ leaveDotGit ? null,
outputHash ? lib.fakeHash,
outputHashAlgo ? null,
fetchSubmodules ? true,
@@ -171,9 +172,12 @@ lib.makeOverridable (
gitConfigFile
;
leaveDotGit =
- assert fetchTags -> leaveDotGit;
- assert rootDir != "" -> !leaveDotGit;
- leaveDotGit;
+ if leaveDotGit != null then
+ assert fetchTags -> leaveDotGit;
+ assert rootDir != "" -> !leaveDotGit;
+ leaveDotGit
+ else
+ deepClone || fetchTags;
inherit tag;
revCustom = rev;
rev = getRevWithTag {