aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-01 14:57:59 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-01 14:57:59 +0200
commit7d554f295ca0a8947042f367adb4f198730696be (patch)
tree427ca3acd0f570d6fdf19e546a5e24e1f36c50ee /src/libexpr/flake
parent26cf0c674f543ec86a5ccb7e05a4773559bb8f8a (diff)
Support building flakes from a shallow Git repo
Fixes #3756.
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/flakeref.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index 615269218..701546671 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -142,6 +142,9 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
parsedURL.query.insert_or_assign("dir", subdir);
}
+ if (pathExists(flakeRoot + "/.git/shallow"))
+ parsedURL.query.insert_or_assign("shallow", "1");
+
return std::make_pair(
FlakeRef(Input::fromURL(parsedURL), get(parsedURL.query, "dir").value_or("")),
fragment);