-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
git-utils.hh
53 lines (35 loc) · 1.2 KB
/
git-utils.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include "input-accessor.hh"
namespace nix {
struct GitRepo
{
static ref<GitRepo> openRepo(const CanonPath & path);
virtual uint64_t getRevCount(const Hash & rev) = 0;
virtual uint64_t getLastModified(const Hash & rev) = 0;
virtual bool isShallow() = 0;
/* Return the commit hash to which a ref points. */
virtual Hash resolveRef(std::string ref) = 0;
struct WorkdirInfo
{
bool isDirty = false;
/* The checked out commit, or nullopt if there are no commits
in the repo yet. */
std::optional<Hash> headRev;
/* The ref to which HEAD points, if any. */
std::optional<std::string> ref;
/* All files in the working directory that are unchanged,
modified or added, but excluding deleted files. */
std::set<CanonPath> files;
};
virtual WorkdirInfo getWorkdirInfo() = 0;
};
ref<InputAccessor> makeGitInputAccessor(const CanonPath & path, const Hash & rev);
struct TarballInfo
{
Hash treeHash;
time_t lastModified;
};
TarballInfo importTarball(Source & source);
ref<InputAccessor> makeTarballCacheAccessor(const Hash & rev);
bool tarballCacheContains(const Hash & treeHash);
}