Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
git.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include <string>
5
#include <string_view>
6
#include <optional>
7
8
#include "
nix/util/types.hh
"
9
#include "
nix/util/serialise.hh
"
10
#include "
nix/util/hash.hh
"
11
#include "
nix/util/source-path.hh
"
12
#include "
nix/util/fs-sink.hh
"
13
#include "
nix/util/merkle-files.hh
"
14
15
namespace
nix::git {
16
17
enum struct
ObjectType {
18
Blob,
19
Tree
,
20
// Commit,
21
// Tag,
22
};
23
24
// Backwards compatibility aliases
25
using
merkle::Mode;
26
using
merkle::TreeEntry;
27
using
nix::RawMode;
28
35
using
Tree
= std::map<std::string, TreeEntry>;
36
37
inline
std::optional<Mode> decodeMode(RawMode m)
38
{
39
return
merkle::decodeMode(m);
40
}
41
47
ObjectType parseObjectType(
Source
& source);
48
55
uint64_t parseBlob(
Source
& source);
56
60
void
parseTree(
merkle::DirectorySink
& sink,
Source
& source, HashAlgorithm hashAlgo);
61
65
std::optional<Mode> convertMode(
SourceAccessor::Type
type);
66
70
void
dumpBlobPrefix(uint64_t size,
Sink
& sink);
71
75
void
dumpTree(
const
Tree & entries,
Sink
& sink);
76
86
using
DumpHook
=
TreeEntry
(
const
SourcePath
& path);
87
88
Mode
dump(
const
SourcePath
& path,
Sink
& sink,
fun<DumpHook>
hook,
PathFilter
& filter = defaultPathFilter);
89
95
TreeEntry
dumpHash(HashAlgorithm ha,
const
SourcePath
& path,
PathFilter
& filter = defaultPathFilter);
96
116
struct
LsRemoteRefLine
117
{
118
enum struct
Kind { Symbolic, Object };
119
Kind kind;
120
std::string target;
121
std::optional<std::string> reference;
122
};
123
127
std::optional<LsRemoteRefLine> parseLsRemoteLine(std::string_view line);
128
129
}
// namespace nix::git
nix::fun
Definition
fun.hh:19
nix::PathFilter
fun< bool(const std::string &path)> PathFilter
Definition
file-system.hh:494
fs-sink.hh
nix::git::Tree
std::map< std::string, TreeEntry > Tree
Definition
git.hh:35
nix::git::DumpHook
TreeEntry(const SourcePath &path) DumpHook
Definition
git.hh:86
hash.hh
merkle-files.hh
nix::merkle::Mode
Mode
Definition
merkle-files.hh:20
serialise.hh
source-path.hh
SourcePath.
nix::Sink
Definition
serialise.hh:18
nix::SourceAccessor::Type
Type
Definition
source-accessor.hh:99
nix::SourcePath
Definition
source-path.hh:22
nix::Source
Definition
serialise.hh:95
nix::git::LsRemoteRefLine
Definition
git.hh:117
nix::merkle::DirectorySink
Definition
merkle-files.hh:57
nix::merkle::TreeEntry
Definition
merkle-files.hh:44
types.hh
libutil
include
nix
util
git.hh
Generated by
1.18.0