1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

fixup: sync -> flush

The latter is not used for memory synchronization things.
This commit is contained in:
Robert Hensing 2024-08-26 15:04:47 +02:00
parent 97ff2ed455
commit fb8d3ed150
5 changed files with 14 additions and 5 deletions

View file

@ -170,6 +170,11 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
{
/** Location of the repository on disk. */
std::filesystem::path path;
/**
* libgit2 repository. Note that new objects are not written to disk,
* because we are using a mempack backend. For writing to disk, see
* `flush()`, which is also called by `GitFileSystemObjectSink::sync()`.
*/
Repository repo;
/**
* In-memory object store for efficient batched writing to packfiles.
@ -1064,7 +1069,7 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
git_tree_entry_filemode(entry));
}
Hash sync() override
Hash flush() override
{
updateBuilders({});

View file

@ -7,12 +7,16 @@ namespace nix {
namespace fetchers { struct PublicKey; }
/**
* A sink that writes into a Git repository. Note that nothing may be written
* until `flush()` is called.
*/
struct GitFileSystemObjectSink : ExtendedFileSystemObjectSink
{
/**
* Flush builder and return a final Git hash.
*/
virtual Hash sync() = 0;
virtual Hash flush() = 0;
};
struct GitRepo

View file

@ -261,7 +261,7 @@ struct GitArchiveInputScheme : InputScheme
auto tarballCache = getTarballCache();
auto parseSink = tarballCache->getFileSystemObjectSink();
auto lastModified = unpackTarfileToSink(archive, *parseSink);
auto tree = parseSink->sync();
auto tree = parseSink->flush();
act.reset();

View file

@ -170,7 +170,7 @@ static DownloadTarballResult downloadTarball_(
auto tarballCache = getTarballCache();
auto parseSink = tarballCache->getFileSystemObjectSink();
auto lastModified = unpackTarfileToSink(archive, *parseSink);
auto tree = parseSink->sync();
auto tree = parseSink->flush();
act.reset();

View file

@ -77,7 +77,7 @@ TEST_F(GitUtilsTest, sink_basic)
// sink->createHardlink("foo-1.1/links/foo-2", CanonPath("foo-1.1/hello"));
auto result = repo->dereferenceSingletonDirectory(sink->sync());
auto result = repo->dereferenceSingletonDirectory(sink->flush());
auto accessor = repo->getAccessor(result, false);
auto entries = accessor->readDirectory(CanonPath::root);
ASSERT_EQ(entries.size(), 5);