1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 06:11:46 +02:00

Merge pull request #9948 from obsidiansystems/no-canon-path-from-cwd

Get rid of `CanonPath::fromCwd`
This commit is contained in:
Eelco Dolstra 2024-02-12 14:04:01 +01:00 committed by GitHub
commit ec6ca6e42c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 152 additions and 135 deletions

View file

@ -176,12 +176,11 @@ static void opAdd(Strings opFlags, Strings opArgs)
{
if (!opFlags.empty()) throw UsageError("unknown flag");
PosixSourceAccessor accessor;
for (auto & i : opArgs)
for (auto & i : opArgs) {
auto [accessor, canonPath] = PosixSourceAccessor::createAtRoot(i);
cout << fmt("%s\n", store->printStorePath(store->addToStore(
std::string(baseNameOf(i)),
accessor,
CanonPath::fromCwd(i))));
std::string(baseNameOf(i)), accessor, canonPath)));
}
}
@ -201,14 +200,15 @@ static void opAddFixed(Strings opFlags, Strings opArgs)
HashAlgorithm hashAlgo = parseHashAlgo(opArgs.front());
opArgs.pop_front();
PosixSourceAccessor accessor;
for (auto & i : opArgs)
for (auto & i : opArgs) {
auto [accessor, canonPath] = PosixSourceAccessor::createAtRoot(i);
std::cout << fmt("%s\n", store->printStorePath(store->addToStoreSlow(
baseNameOf(i),
accessor,
CanonPath::fromCwd(i),
canonPath,
method,
hashAlgo).path));
}
}