mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #10517 from edolstra/path-display
Add missing setPathDisplay() calls
This commit is contained in:
commit
d53ad516e8
6 changed files with 20 additions and 5 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -24,7 +24,10 @@ ref<InputAccessor> makeStorePathAccessor(
|
|||
const StorePath & storePath)
|
||||
{
|
||||
// FIXME: should use `store->getFSAccessor()`
|
||||
return makeFSInputAccessor(std::filesystem::path { store->toRealPath(storePath) });
|
||||
auto root = std::filesystem::path { store->toRealPath(storePath) };
|
||||
auto accessor = makeFSInputAccessor(root);
|
||||
accessor->setPathDisplay(root);
|
||||
return accessor;
|
||||
}
|
||||
|
||||
SourcePath getUnfilteredRootPath(CanonPath path)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -645,6 +645,7 @@ struct GitInputScheme : InputScheme
|
|||
auto submoduleInput = fetchers::Input::fromAttrs(std::move(attrs));
|
||||
auto [submoduleAccessor, submoduleInput2] =
|
||||
submoduleInput.getAccessor(store);
|
||||
submoduleAccessor->setPathDisplay("«" + submoduleInput.to_string() + "»");
|
||||
mounts.insert_or_assign(submodule.path, submoduleAccessor);
|
||||
}
|
||||
|
||||
|
@ -681,6 +682,8 @@ struct GitInputScheme : InputScheme
|
|||
exportIgnore,
|
||||
makeNotAllowedError(repoInfo.url));
|
||||
|
||||
accessor->setPathDisplay(repoInfo.url);
|
||||
|
||||
/* If the repo has submodules, return a mounted input accessor
|
||||
consisting of the accessor for the top-level repo and the
|
||||
accessors for the submodule workdirs. */
|
||||
|
@ -697,6 +700,7 @@ struct GitInputScheme : InputScheme
|
|||
auto submoduleInput = fetchers::Input::fromAttrs(std::move(attrs));
|
||||
auto [submoduleAccessor, submoduleInput2] =
|
||||
submoduleInput.getAccessor(store);
|
||||
submoduleAccessor->setPathDisplay("«" + submoduleInput.to_string() + "»");
|
||||
|
||||
/* If the submodule is dirty, mark this repo dirty as
|
||||
well. */
|
||||
|
|
|
@ -352,7 +352,11 @@ struct MercurialInputScheme : InputScheme
|
|||
|
||||
auto storePath = fetchToStore(store, input);
|
||||
|
||||
return {makeStorePathAccessor(store, storePath), input};
|
||||
auto accessor = makeStorePathAccessor(store, storePath);
|
||||
|
||||
accessor->setPathDisplay("«" + input.to_string() + "»");
|
||||
|
||||
return {accessor, input};
|
||||
}
|
||||
|
||||
bool isLocked(const Input & input) const override
|
||||
|
|
Loading…
Reference in a new issue