forked from lix-project/lix
fetchGit: Drop unnecessary localRef
This commit is contained in:
parent
3f4de91d80
commit
4aee93d5ce
|
@ -85,6 +85,8 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
|
||||||
if (rev != "" && !std::regex_match(rev, revRegex))
|
if (rev != "" && !std::regex_match(rev, revRegex))
|
||||||
throw Error("invalid Git revision '%s'", rev);
|
throw Error("invalid Git revision '%s'", rev);
|
||||||
|
|
||||||
|
deletePath(getCacheDir() + "/nix/git");
|
||||||
|
|
||||||
Path cacheDir = getCacheDir() + "/nix/gitv2/" + hashString(htSHA256, uri).to_string(Base32, false);
|
Path cacheDir = getCacheDir() + "/nix/gitv2/" + hashString(htSHA256, uri).to_string(Base32, false);
|
||||||
|
|
||||||
if (!pathExists(cacheDir)) {
|
if (!pathExists(cacheDir)) {
|
||||||
|
@ -92,9 +94,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
|
||||||
runProgram("git", true, { "init", "--bare", cacheDir });
|
runProgram("git", true, { "init", "--bare", cacheDir });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string localRef = hashString(htSHA256, fmt("%s-%s", uri, *ref)).to_string(Base32, false);
|
Path localRefFile = cacheDir + "/refs/heads/" + *ref;
|
||||||
|
|
||||||
Path localRefFile = cacheDir + "/refs/heads/" + localRef;
|
|
||||||
|
|
||||||
bool doFetch;
|
bool doFetch;
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
|
@ -124,7 +124,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
|
||||||
|
|
||||||
// FIXME: git stderr messes up our progress indicator, so
|
// FIXME: git stderr messes up our progress indicator, so
|
||||||
// we're using --quiet for now. Should process its stderr.
|
// we're using --quiet for now. Should process its stderr.
|
||||||
runProgram("git", true, { "-C", cacheDir, "fetch", "--quiet", "--force", "--", uri, *ref + ":" + localRef });
|
runProgram("git", true, { "-C", cacheDir, "fetch", "--quiet", "--force", "--", uri, fmt("%s:%s", *ref, *ref) });
|
||||||
|
|
||||||
struct timeval times[2];
|
struct timeval times[2];
|
||||||
times[0].tv_sec = now;
|
times[0].tv_sec = now;
|
||||||
|
|
Loading…
Reference in a new issue