Skip to content

Commit

Permalink
fixup: sync -> flush
Browse files Browse the repository at this point in the history
The latter is not used for memory synchronization things.
  • Loading branch information
roberth committed Aug 26, 2024
1 parent 7caf3ab commit 412d871
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/libfetchers/git-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1064,7 +1069,7 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
git_tree_entry_filemode(entry));
}

Hash sync() override
Hash flush() override
{
updateBuilders({});

Expand Down
6 changes: 5 additions & 1 deletion src/libfetchers/git-utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libfetchers/github.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/libfetchers/tarball.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 412d871

Please sign in to comment.