mirror of
https://github.com/NixOS/nix
synced 2025-06-25 19:01:16 +02:00
parent
8703e9d89e
commit
b4813a1b55
1 changed files with 11 additions and 15 deletions
|
@ -532,24 +532,20 @@ struct GitInputScheme : InputScheme
|
||||||
return *head;
|
return *head;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MakeNotAllowedError makeNotAllowedError(std::string url)
|
static MakeNotAllowedError makeNotAllowedError(std::filesystem::path repoPath)
|
||||||
{
|
{
|
||||||
return [url{std::move(url)}](const CanonPath & path) -> RestrictedPathError {
|
return [repoPath{std::move(repoPath)}](const CanonPath & path) -> RestrictedPathError {
|
||||||
if (nix::pathExists(url + "/" + path.abs())) {
|
if (nix::pathExists(repoPath / path.rel()))
|
||||||
auto relativePath = path.rel(); // .makeRelative(CanonPath("/"));
|
|
||||||
|
|
||||||
return RestrictedPathError(
|
return RestrictedPathError(
|
||||||
"'%s' is not tracked by Git.\n"
|
"File '%1%' in the repository %2% is not tracked by Git.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"To use '%s', stage it in the Git repository at '%s':\n"
|
"To make it visible to Nix, run:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"git add %s",
|
"git -C %2% add \"%1%\"",
|
||||||
relativePath,
|
path.rel(),
|
||||||
relativePath,
|
repoPath);
|
||||||
url,
|
else
|
||||||
relativePath);
|
return RestrictedPathError("path '%s' does not exist in Git repository %s", path, repoPath);
|
||||||
} else
|
|
||||||
return RestrictedPathError("path '%s' does not exist in Git repository '%s'", path, url);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +753,7 @@ struct GitInputScheme : InputScheme
|
||||||
ref<SourceAccessor> accessor =
|
ref<SourceAccessor> accessor =
|
||||||
repo->getAccessor(repoInfo.workdirInfo,
|
repo->getAccessor(repoInfo.workdirInfo,
|
||||||
exportIgnore,
|
exportIgnore,
|
||||||
makeNotAllowedError(repoInfo.locationToArg()));
|
makeNotAllowedError(repoPath));
|
||||||
|
|
||||||
/* If the repo has submodules, return a mounted input accessor
|
/* If the repo has submodules, return a mounted input accessor
|
||||||
consisting of the accessor for the top-level repo and the
|
consisting of the accessor for the top-level repo and the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue