mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
builtins.fetchgit: Use proper refs locally
This commit is contained in:
parent
6d7de7f3de
commit
69deca194e
1 changed files with 3 additions and 4 deletions
|
@ -20,15 +20,14 @@ Path exportGit(ref<Store> store, const std::string & uri, const std::string & re
|
|||
|
||||
//Activity act(*logger, lvlInfo, format("fetching Git repository ‘%s’") % uri);
|
||||
|
||||
std::string localRef = "pid-" + std::to_string(getpid());
|
||||
std::string localRef = hashString(htSHA256, fmt("%s-%s", uri, rev)).to_string(Base32, false);
|
||||
|
||||
Path localRefFile = cacheDir + "/refs/heads/" + localRef;
|
||||
|
||||
runProgram("git", true, { "-C", cacheDir, "fetch", uri, rev + ":" + localRef });
|
||||
runProgram("git", true, { "-C", cacheDir, "fetch", "--force", uri, rev + ":" + localRef });
|
||||
|
||||
std::string commitHash = chomp(readFile(localRefFile));
|
||||
|
||||
unlink(localRefFile.c_str());
|
||||
|
||||
printTalkative("using revision %s of repo ‘%s’", uri, commitHash);
|
||||
|
||||
Path storeLink = cacheDir + "/" + commitHash + ".link";
|
||||
|
|
Loading…
Reference in a new issue