aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/fetchGit.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-23 23:38:40 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-05-23 23:38:40 +0200
commit6e984431dd27326681a7cbb56404665c353c834a (patch)
tree665fe310dfe009bb337539c6a8f054c336e0d60c /src/libexpr/primops/fetchGit.cc
parent013f4928c8a6dd21685531ceb631fbcff85cefef (diff)
fetchGit: Don't barf if we can't update our Git clone
Instead print a warning that we're continuing with the most recently fetched version.
Diffstat (limited to 'src/libexpr/primops/fetchGit.cc')
-rw-r--r--src/libexpr/primops/fetchGit.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index 00bbeb6d8..f6b096c4a 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -139,7 +139,12 @@ GitInfo exportGit(ref<Store> store, std::string uri,
// FIXME: git stderr messes up our progress indicator, so
// we're using --quiet for now. Should process its stderr.
- runProgram("git", true, { "-C", repoDir, "fetch", "--quiet", "--force", "--", uri, fmt("%s:%s", *ref, *ref) });
+ try {
+ runProgram("git", true, { "-C", repoDir, "fetch", "--quiet", "--force", "--", uri, fmt("%s:%s", *ref, *ref) });
+ } catch (Error & e) {
+ if (!pathExists(localRefFile)) throw;
+ warn("could not update local clone of Git repository '%s'; continuing with the most recent version", uri);
+ }
struct timeval times[2];
times[0].tv_sec = now;