mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
MountedInputAccessor, FilteringInputAccessor: Respect the path display prefix/suffix
This was causing Git paths not to be rendered correctly.
This commit is contained in:
parent
6df58a0891
commit
79363b2273
@ -38,7 +38,7 @@ std::string FilteringInputAccessor::readLink(const CanonPath & path)
|
||||
|
||||
std::string FilteringInputAccessor::showPath(const CanonPath & path)
|
||||
{
|
||||
return next->showPath(prefix / path);
|
||||
return displayPrefix + next->showPath(prefix / path) + displaySuffix;
|
||||
}
|
||||
|
||||
void FilteringInputAccessor::checkAccess(const CanonPath & path)
|
||||
|
@ -27,7 +27,9 @@ struct FilteringInputAccessor : InputAccessor
|
||||
: next(src.accessor)
|
||||
, prefix(src.path)
|
||||
, makeNotAllowedError(std::move(makeNotAllowedError))
|
||||
{ }
|
||||
{
|
||||
displayPrefix.clear();
|
||||
}
|
||||
|
||||
std::string readFile(const CanonPath & path) override;
|
||||
|
||||
|
@ -9,6 +9,8 @@ struct MountedInputAccessor : InputAccessor
|
||||
MountedInputAccessor(std::map<CanonPath, ref<InputAccessor>> _mounts)
|
||||
: mounts(std::move(_mounts))
|
||||
{
|
||||
displayPrefix.clear();
|
||||
|
||||
// Currently we require a root filesystem. This could be relaxed.
|
||||
assert(mounts.contains(CanonPath::root));
|
||||
|
||||
@ -48,7 +50,7 @@ struct MountedInputAccessor : InputAccessor
|
||||
std::string showPath(const CanonPath & path) override
|
||||
{
|
||||
auto [accessor, subpath] = resolve(path);
|
||||
return accessor->showPath(subpath);
|
||||
return displayPrefix + accessor->showPath(subpath) + displaySuffix;
|
||||
}
|
||||
|
||||
std::pair<ref<InputAccessor>, CanonPath> resolve(CanonPath path)
|
||||
|
Loading…
Reference in New Issue
Block a user