lix/src/libexpr/primops/fetchGit.hh
Eelco Dolstra 0ab64729e9 Improve GitHub caching
In particular, when building a flake lock file, inputs like 'nixpkgs'
are now downloaded only once. Previously, it would fetch
https://api.github.com/repos/<owner>/<repo>/tarball/<ref> and then
later https://api.github.com/repos/<owner>/<repo>/tarball/<rev>, even
though they produce the same result.

Git and GitHub now also share a cache that maps revs to a store path
and other info.
2019-10-16 00:20:51 +02:00

33 lines
569 B
C++

#pragma once
#include "store-api.hh"
#include <regex>
namespace nix {
struct GitInfo
{
Path storePath;
std::optional<std::string> ref;
Hash rev{htSHA1};
std::optional<uint64_t> revCount;
time_t lastModified;
};
GitInfo exportGit(
ref<Store> store,
std::string uri,
std::optional<std::string> ref,
std::optional<Hash> rev,
const std::string & name);
GitInfo exportGitHub(
ref<Store> store,
const std::string & owner,
const std::string & repo,
std::optional<std::string> ref,
std::optional<Hash> rev);
}