From d1275c4ff19cd51361d9474a306c85bb6b4b251e Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 17 Nov 2025 01:36:04 +0800 Subject: [PATCH] fetchgit: move sparseCheckout type check down to sparseCheckoutText --- pkgs/build-support/fetchgit/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix index 76539d213183..450103027b6b 100644 --- a/pkgs/build-support/fetchgit/default.nix +++ b/pkgs/build-support/fetchgit/default.nix @@ -131,11 +131,6 @@ lib.makeOverridable ( server admins start using the new version? */ - if builtins.isString sparseCheckout then - # Changed to throw on 2023-06-04 - throw - "Please provide directories/patterns for sparse checkout as a list of strings. Passing a (multi-line) string is not supported any more." - else derivationArgs // { inherit name; @@ -155,11 +150,15 @@ lib.makeOverridable ( sparseCheckout = lib.defaultTo (lib.optional (rootDir != "") rootDir) sparseCheckout; sparseCheckoutText = + # Changed to throw on 2023-06-04 + assert ( + lib.assertMsg (lib.isList finalAttrs.sparseCheckout) "Please provide directories/patterns for sparse checkout as a list of strings. Passing a (multi-line) string is not supported any more." + ); assert finalAttrs.nonConeMode -> (finalAttrs.sparseCheckout != [ ]); # git-sparse-checkout(1) says: # > When the --stdin option is provided, the directories or patterns are read # > from standard in as a newline-delimited list instead of from the arguments. - builtins.concatStringsSep "\n" sparseCheckout; + builtins.concatStringsSep "\n" finalAttrs.sparseCheckout; inherit url