Noogλe
Function of the day
Create a file set containing all Git-tracked files in a repository. The first argument allows configuration with an attribute set, while the second argument is the path to the Git working tree.
gitTrackedWithdoes not perform any filtering when the path is a Nix store path and not a repository. In this way, it accommodates the use case where the expression that makes thegitTrackedcall does not reside in an actual git repository anymore, and has presumably already been fetched in a way that excludes untracked files. Fetchers with such equivalent behavior includebuiltins.fetchGit,builtins.fetchTree(experimental), andpkgs.fetchgitwhen used withoutleaveDotGit.If you don't need the configuration, you can use
gitTrackedinstead.This is equivalent to the result of
unionson all files returned bygit ls-files(which uses--cachedby default).Currently this function is based on
builtins.fetchGitAs such, this function causes all Git-tracked files to be unnecessarily added to the Nix store, without being re-usable bytoSource.This may change in the future.
Inputs
options(attribute set)-
recurseSubmodules(optional, default:false)- Whether to recurse into Git submodules to also include their tracked files.
If
true, this is equivalent to passing the --recurse-submodules flag togit ls-files. path- The path to the working directory of a local Git repository.
This directory must contain a
.gitfile or subdirectory.
Type
gitTrackedWith :: { recurseSubmodules :: Bool ? false } -> Path -> FileSetExamples
lib.fileset.gitTrackedWithusage example# Include all files tracked by the Git repository in the current directory # and any submodules under it gitTracked { recurseSubmodules = true; } ./.