mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-28 08:36:15 +02:00
Show a sensible error when a file exists but is not under git control
Example: error: access to path '/home/eelco/Dev/patchelf/foo.nix' is forbidden because it is not under Git control; maybe you should 'git add' it to the repository '/home/eelco/Dev/patchelf'? Fixes #4507.
This commit is contained in:
parent
1970d6db12
commit
593798b2a0
1 changed files with 9 additions and 1 deletions
|
@ -715,7 +715,15 @@ struct GitInputScheme : InputScheme
|
|||
|
||||
// FIXME: return updated input.
|
||||
|
||||
return {makeFSInputAccessor(CanonPath(repoInfo.url), listFiles(repoInfo)), input};
|
||||
auto makeNotAllowedError = [url{repoInfo.url}](const CanonPath & path) -> RestrictedPathError
|
||||
{
|
||||
if (nix::pathExists(path.abs()))
|
||||
return RestrictedPathError("access to path '%s' is forbidden because it is not under Git control; maybe you should 'git add' it to the repository '%s'?", path, url);
|
||||
else
|
||||
return RestrictedPathError("path '%s' does not exist in Git reposity '%s'", path, url);
|
||||
};
|
||||
|
||||
return {makeFSInputAccessor(CanonPath(repoInfo.url), listFiles(repoInfo), std::move(makeNotAllowedError)), input};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue