Merge pull request #235898 from panicgh/fetchgit-sparse-checkout-failhard

fetchgit: require sparseCheckout be a list of strings

authored by Rick van Schijndel and committed by GitHub 6cdf7259 d929ec33

+6 -6
+5 -5
pkgs/build-support/fetchgit/default.nix
··· 54 54 */ 55 55 56 56 assert deepClone -> leaveDotGit; 57 - assert nonConeMode -> !(sparseCheckout == "" || sparseCheckout == []); 57 + assert nonConeMode -> (sparseCheckout != []); 58 58 59 59 if md5 != "" then 60 60 throw "fetchgit does not support md5 anymore, please use sha256" 61 61 else if hash != "" && sha256 != "" then 62 62 throw "Only one of sha256 or hash can be set" 63 + else if builtins.isString sparseCheckout then 64 + # Changed to throw on 2023-06-04 65 + throw "Please provide directories/patterns for sparse checkout as a list of strings. Passing a (multi-line) string is not supported any more." 63 66 else 64 - # Added 2022-11-12 65 - lib.warnIf (builtins.isString sparseCheckout) 66 - "Please provide directories/patterns for sparse checkout as a list of strings. Support for passing a (multi-line) string is deprecated and will be removed in the next release." 67 67 stdenvNoCC.mkDerivation { 68 68 inherit name; 69 69 builder = ./builder.sh; ··· 84 84 # git-sparse-checkout(1) says: 85 85 # > When the --stdin option is provided, the directories or patterns are read 86 86 # > from standard in as a newline-delimited list instead of from the arguments. 87 - sparseCheckout = if builtins.isString sparseCheckout then sparseCheckout else builtins.concatStringsSep "\n" sparseCheckout; 87 + sparseCheckout = builtins.concatStringsSep "\n" sparseCheckout; 88 88 89 89 inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch; 90 90
+1 -1
pkgs/build-support/fetchgithub/default.nix
··· 25 25 }; 26 26 passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; 27 27 varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_"; 28 - useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || !(sparseCheckout == "" || sparseCheckout == []); 28 + useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != []); 29 29 # We prefer fetchzip in cases we don't need submodules as the hash 30 30 # is more stable in that case. 31 31 fetcher = if useFetchGit then fetchgit else fetchzip;