1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Merge pull request #10655 from edolstra/use-source-path

Use `SourcePath` in more places
This commit is contained in:
John Ericson 2024-05-06 14:57:01 -04:00 committed by GitHub
commit 1ad7b5451d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 112 additions and 119 deletions

View file

@ -154,8 +154,8 @@ TEST_F(GitTest, tree_write) {
TEST_F(GitTest, both_roundrip) {
using File = MemorySourceAccessor::File;
MemorySourceAccessor files;
files.root = File::Directory {
auto files = make_ref<MemorySourceAccessor>();
files->root = File::Directory {
.contents {
{
"foo",
@ -189,12 +189,12 @@ TEST_F(GitTest, both_roundrip) {
std::map<Hash, std::string> cas;
std::function<DumpHook> dumpHook;
dumpHook = [&](const CanonPath & path) {
dumpHook = [&](const SourcePath & path) {
StringSink s;
HashSink hashSink { HashAlgorithm::SHA1 };
TeeSink s2 { s, hashSink };
auto mode = dump(
files, path, s2, dumpHook,
path, s2, dumpHook,
defaultPathFilter, mockXpSettings);
auto hash = hashSink.finish().first;
cas.insert_or_assign(hash, std::move(s.s));
@ -204,11 +204,11 @@ TEST_F(GitTest, both_roundrip) {
};
};
auto root = dumpHook(CanonPath::root);
auto root = dumpHook({files});
MemorySourceAccessor files2;
auto files2 = make_ref<MemorySourceAccessor>();
MemorySink sinkFiles2 { files2 };
MemorySink sinkFiles2 { *files2 };
std::function<void(const Path, const Hash &, BlobMode)> mkSinkHook;
mkSinkHook = [&](auto prefix, auto & hash, auto blobMode) {
@ -229,7 +229,7 @@ TEST_F(GitTest, both_roundrip) {
mkSinkHook("", root.hash, BlobMode::Regular);
ASSERT_EQ(files, files2);
ASSERT_EQ(*files, *files2);
}
TEST(GitLsRemote, parseSymrefLineWithReference) {