diff options
Diffstat (limited to 'src/libexpr/primops/fetchgit.cc')
-rw-r--r-- | src/libexpr/primops/fetchgit.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libexpr/primops/fetchgit.cc b/src/libexpr/primops/fetchgit.cc index 1d8f55bcd518..baa48f6422b7 100644 --- a/src/libexpr/primops/fetchgit.cc +++ b/src/libexpr/primops/fetchgit.cc @@ -44,11 +44,15 @@ GitInfo exportGit(ref<Store> store, const std::string & uri, PathFilter filter = [&](const Path & p) -> bool { assert(hasPrefix(p, uri)); - auto st = lstat(p); std::string file(p, uri.size() + 1); - if (file == ".git") return false; - // FIXME: filter out directories with no tracked files. - if (S_ISDIR(st.st_mode)) return true; + + auto st = lstat(p); + + if (S_ISDIR(st.st_mode)) { + auto i = files.lower_bound(file); + return i != files.end() && hasPrefix(*i, file); + } + return files.count(file); }; |