Merge pull request #201779 from Artturin/makeinternal1

lib/sources: make commitIdFromGitRepoOrError internal and use # for c…
This commit is contained in:
Artturi 2022-11-18 18:23:46 +02:00 committed by GitHub
commit a700962b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,7 +166,7 @@ let
in type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts;
in cleanSourceWith { inherit filter src; };
pathIsGitRepo = path: (commitIdFromGitRepoOrError path)?value;
pathIsGitRepo = path: (_commitIdFromGitRepoOrError path)?value;
/*
Get the commit id of a git repo.
@ -174,17 +174,16 @@ let
Example: commitIdFromGitRepo <nixpkgs/.git>
*/
commitIdFromGitRepo = path:
let commitIdOrError = commitIdFromGitRepoOrError path;
let commitIdOrError = _commitIdFromGitRepoOrError path;
in commitIdOrError.value or (throw commitIdOrError.error);
/*
Get the commit id of a git repo.
# Get the commit id of a git repo.
Returns `{ value = commitHash }` or `{ error = "... message ..." }`.
# Returns `{ value = commitHash }` or `{ error = "... message ..." }`.
Example: commitIdFromGitRepo <nixpkgs/.git>
*/
commitIdFromGitRepoOrError =
# Example: commitIdFromGitRepo <nixpkgs/.git>
# not exported, used for commitIdFromGitRepo
_commitIdFromGitRepoOrError =
let readCommitFromFile = file: path:
let fileName = path + "/${file}";
packedRefsName = path + "/packed-refs";