aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-20 14:29:49 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-09-20 14:29:49 +0200
commit68e0f23edc7622290809c81f5071c9f99aded459 (patch)
tree68902cc74a9cfa740a2831ba02d361f576e6fc9a /src/libexpr/primops
parent99e8e58f2de9941353b47ed14fbe4ed76d635519 (diff)
Add flags to disallow dirty Git trees and to turn off warnings
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchGit.cc6
-rw-r--r--src/libexpr/primops/fetchMercurial.cc6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index 48d84c4a1..1b55b6f32 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -47,7 +47,11 @@ GitInfo exportGit(ref<Store> store, std::string uri,
/* This is an unclean working tree. So copy all tracked
files. */
- warn("Git tree '%s' is dirty", uri);
+ if (!evalSettings.allowDirty)
+ throw Error("Git tree '%s' is dirty", uri);
+
+ if (evalSettings.warnDirty)
+ warn("Git tree '%s' is dirty", uri);
GitInfo gitInfo;
gitInfo.ref = "HEAD";
diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc
index c791443c3..40082894f 100644
--- a/src/libexpr/primops/fetchMercurial.cc
+++ b/src/libexpr/primops/fetchMercurial.cc
@@ -36,7 +36,11 @@ HgInfo exportMercurial(ref<Store> store, const std::string & uri,
/* This is an unclean working tree. So copy all tracked
files. */
- printTalkative("copying unclean Mercurial working tree '%s'", uri);
+ if (!evalSettings.allowDirty)
+ throw Error("Mercurial tree '%s' is unclean", uri);
+
+ if (evalSettings.warnDirty)
+ warn("Mercurial tree '%s' is unclean", uri);
HgInfo hgInfo;
hgInfo.rev = "0000000000000000000000000000000000000000";