Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::GitRepoImpl Struct Reference
Inheritance diagram for nix::GitRepoImpl:
nix::GitRepo

Public Member Functions

void readPackDirOnlyOnce ()
 GitRepoImpl (std::filesystem::path _path, Options _options)
 operator git_repository * ()
void flush () override
std::unique_ptr< merkle::DirectorySinkWithFinalize > makeDirectorySink () override
std::unique_ptr< merkle::RegularFileSinkWithFinalize > makeRegularFileSink () override
uint64_t getLastModified (const Hash &rev) override
bool isShallow () override
void setRemote (const std::string &name, const std::string &url) override
Hash resolveRef (std::string ref) override
std::vector< Submodule > parseSubmodules (const std::filesystem::path &configFile)
WorkdirInfo getWorkdirInfo () override
std::optional< std::string > getWorkdirRef () override
std::vector< std::tuple< Submodule, Hash > > getSubmodules (const Hash &rev, bool exportIgnore) override
std::string resolveSubmoduleUrl (const std::string &url) override
bool hasObject (const Hash &oid_) override
ref< GitSourceAccessor > getRawAccessor (const Hash &rev, const GitAccessorOptions &options)
ref< SourceAccessor > getAccessor (const Hash &rev, const GitAccessorOptions &options, std::string displayPrefix) override
ref< SourceAccessor > getAccessor (const WorkdirInfo &wd, const GitAccessorOptions &options, MakeNotAllowedError e) override
void fetch (const std::string &url, const std::string &refspec, bool shallow) override
void verifyCommit (const Hash &rev, const std::vector< fetchers::PublicKey > &publicKeys) override
Hash treeHashToNarHash (const fetchers::Settings &settings, const Hash &treeHash) override
Hash dereferenceSingletonDirectory (const Hash &oid_) override

Static Public Member Functions

static int statusCallbackTrampoline (const char *path, unsigned int statusFlags, void *payload)
Static Public Member Functions inherited from nix::GitRepo
static ref< GitRepo > openRepo (const std::filesystem::path &path, Options options)
static WorkdirInfo getCachedWorkdirInfo (const std::filesystem::path &path)
static void invalidateWorkdirInfoCache ()

Public Attributes

std::filesystem::path path
Options options
Repository repo
git_odb_backend * mempackBackend = nullptr
git_odb_backend * packBackend = nullptr

Member Function Documentation

◆ dereferenceSingletonDirectory()

Hash nix::GitRepoImpl::dereferenceSingletonDirectory ( const Hash & oid)
inlineoverridevirtual

If the specified Git object is a directory with a single entry that is a directory, return the ID of that object. Otherwise, return the passed ID unchanged.

Implements nix::GitRepo.

◆ fetch()

void nix::GitRepoImpl::fetch ( const std::string & url,
const std::string & refspec,
bool shallow )
inlineoverridevirtual

Implements nix::GitRepo.

◆ flush()

void nix::GitRepoImpl::flush ( )
inlineoverridevirtual

Implements nix::GitRepo.

◆ getAccessor() [1/2]

ref< SourceAccessor > nix::GitRepoImpl::getAccessor ( const Hash & rev,
const GitAccessorOptions & options,
std::string displayPrefix )
overridevirtual

Implements nix::GitRepo.

◆ getAccessor() [2/2]

ref< SourceAccessor > nix::GitRepoImpl::getAccessor ( const WorkdirInfo & wd,
const GitAccessorOptions & options,
MakeNotAllowedError e )
overridevirtual

Implements nix::GitRepo.

◆ getLastModified()

uint64_t nix::GitRepoImpl::getLastModified ( const Hash & rev)
inlineoverridevirtual

Implements nix::GitRepo.

◆ getRawAccessor()

ref< GitSourceAccessor > nix::GitRepoImpl::getRawAccessor ( const Hash & rev,
const GitAccessorOptions & options )

A 'GitSourceAccessor' with no regard for export-ignore.

◆ getSubmodules()

std::vector< std::tuple< GitRepoImpl::Submodule, Hash > > nix::GitRepoImpl::getSubmodules ( const Hash & rev,
bool exportIgnore )
overridevirtual

Return the submodules of this repo at the indicated revision, along with the revision of each submodule.

Implements nix::GitRepo.

◆ getWorkdirInfo()

WorkdirInfo nix::GitRepoImpl::getWorkdirInfo ( )
inlineoverridevirtual

Implements nix::GitRepo.

◆ getWorkdirRef()

std::optional< std::string > nix::GitRepoImpl::getWorkdirRef ( )
inlineoverridevirtual

Implements nix::GitRepo.

◆ hasObject()

bool nix::GitRepoImpl::hasObject ( const Hash & oid_)
inlineoverridevirtual

Implements nix::GitRepo.

◆ isShallow()

bool nix::GitRepoImpl::isShallow ( )
inlineoverridevirtual

Implements nix::GitRepo.

◆ makeDirectorySink()

std::unique_ptr< merkle::DirectorySinkWithFinalize > nix::GitRepoImpl::makeDirectorySink ( )
overridevirtual

Implements nix::GitRepo.

◆ makeRegularFileSink()

std::unique_ptr< merkle::RegularFileSinkWithFinalize > nix::GitRepoImpl::makeRegularFileSink ( )
overridevirtual

Implements nix::GitRepo.

◆ readPackDirOnlyOnce()

void nix::GitRepoImpl::readPackDirOnlyOnce ( )
inline

Read the pack directory only the once, when this repo was created (git_odb_backend_pack does that), rather than re-scanning it whenever an object is not found — which costs about six syscalls per miss.

Done by nulling out the backend's refresh callback; the vtable is semi-public interface in libgit2.

See also
GitRepoPoolImpl for when this is safe.

◆ resolveRef()

Hash nix::GitRepoImpl::resolveRef ( std::string ref)
inlineoverridevirtual

Implements nix::GitRepo.

◆ resolveSubmoduleUrl()

std::string nix::GitRepoImpl::resolveSubmoduleUrl ( const std::string & url)
inlineoverridevirtual

Implements nix::GitRepo.

◆ setRemote()

void nix::GitRepoImpl::setRemote ( const std::string & name,
const std::string & url )
inlineoverridevirtual

Implements nix::GitRepo.

◆ treeHashToNarHash()

Hash nix::GitRepoImpl::treeHashToNarHash ( const fetchers::Settings & settings,
const Hash & treeHash )
inlineoverridevirtual

Given a Git tree hash, compute the hash of its NAR serialisation. This is memoised on-disk.

Implements nix::GitRepo.

◆ verifyCommit()

void nix::GitRepoImpl::verifyCommit ( const Hash & rev,
const std::vector< fetchers::PublicKey > & publicKeys )
inlineoverridevirtual

Verify that commit rev is signed by one of the keys in publicKeys. Throw an error if it isn't.

Implements nix::GitRepo.

Member Data Documentation

◆ mempackBackend

git_odb_backend* nix::GitRepoImpl::mempackBackend = nullptr

In-memory object store for efficient batched writing to packfiles. Owned by repo.

◆ packBackend

git_odb_backend* nix::GitRepoImpl::packBackend = nullptr

On-disk packfile object store. Owned by repo.

◆ path

std::filesystem::path nix::GitRepoImpl::path

Location of the repository on disk.

◆ repo

Repository nix::GitRepoImpl::repo

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 flush() on the various merkle file interfaces.


The documentation for this struct was generated from the following file:
  • libfetchers/git-utils.cc