Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
git.hh File Reference
#include <string>
#include <string_view>
#include <optional>
#include "nix/util/types.hh"
#include "nix/util/serialise.hh"
#include "nix/util/hash.hh"
#include "nix/util/source-path.hh"
#include "nix/util/fs-sink.hh"
#include "nix/util/merkle-files.hh"

Go to the source code of this file.

Classes

struct  nix::git::LsRemoteRefLine
struct  nix::git::TreeEntry

Typedefs

using nix::git::Tree = std::map<std::string, TreeEntry>
using nix::git::DumpHook = TreeEntry(const SourcePath & path)
using nix::git::RawMode

Enumerations

enum struct  ObjectType { Blob , Tree }
enum struct  nix::git::Mode

Functions

std::optional< Mode > nix::git::decodeMode (RawMode m)
ObjectType nix::git::parseObjectType (Source &source)
uint64_t nix::git::parseBlob (Source &source)
void nix::git::parseTree (merkle::DirectorySink &sink, Source &source, HashAlgorithm hashAlgo)
std::optional< Mode > nix::git::convertMode (SourceAccessor::Type type)
void nix::git::dumpBlobPrefix (uint64_t size, Sink &sink)
void nix::git::dumpTree (const Tree &entries, Sink &sink)
Mode nix::git::dump (const SourcePath &path, Sink &sink, fun< DumpHook > hook, PathFilter &filter)
TreeEntry nix::git::dumpHash (HashAlgorithm ha, const SourcePath &path, PathFilter &filter)
std::optional< LsRemoteRefLine > nix::git::parseLsRemoteLine (std::string_view line)

Typedef Documentation

◆ DumpHook

using nix::git::DumpHook = TreeEntry(const SourcePath & path)

Callback for processing a child with dump

The function should return the Git hash and mode of the file at the given path in the accessor passed to dump.

Note that if the child is a directory, its child in must also be so processed in order to compute this information.

◆ Tree

using nix::git::Tree = std::map<std::string, TreeEntry>

A Git tree object, fully decoded and stored in memory.

Directory names must end in a / for sake of sorting. See https://github.com/mirage/irmin/issues/352

Enumeration Type Documentation

◆ Mode

enum struct nix::merkle::Mode : RawMode
strong

The mode of a file in a content-addressed/merkle file system. These values match the Git file modes.

Function Documentation

◆ convertMode()

std::optional< Mode > nix::git::convertMode ( SourceAccessor::Type type)

Convert a SourceAccessor::Type to a Mode.

◆ dumpBlobPrefix()

void nix::git::dumpBlobPrefix ( uint64_t size,
Sink & sink )

Dumps a single file to a sink

◆ dumpHash()

TreeEntry nix::git::dumpHash ( HashAlgorithm ha,
const SourcePath & path,
PathFilter & filter = defaultPathFilter )

Recursively dumps path, hashing as we go.

A smaller wrapper around dump.

◆ dumpTree()

void nix::git::dumpTree ( const Tree & entries,
Sink & sink )

Dumps a representation of a git tree to a sink

◆ parseBlob()

uint64_t nix::git::parseBlob ( Source & source)

Read the size of the blob

The caller should then call Source::drainInto or similar with that size.

◆ parseLsRemoteLine()

std::optional< LsRemoteRefLine > nix::git::parseLsRemoteLine ( std::string_view line)

Parse an LsRemoteRefLine

◆ parseObjectType()

ObjectType nix::git::parseObjectType ( Source & source)

Parse the "blob " or "tree " prefix.

Exceptions
ifprefix not recognized

◆ parseTree()

void nix::git::parseTree ( merkle::DirectorySink & sink,
Source & source,
HashAlgorithm hashAlgo )
Parameters
hashAlgomust be HashAlgo::SHA1 or HashAlgo::SHA256 for now.