fetchGit/fetchMercurial: Fix directory inclusion check

E.g. the existence of .gitignore would cause .git to be included.
This commit is contained in:
Eelco Dolstra
2017-11-21 19:34:46 +01:00
parent 6cdaa858d0
commit d7da6c9ea9
4 changed files with 12 additions and 6 deletions
+3 -2
View File
@@ -56,8 +56,9 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
auto st = lstat(p);
if (S_ISDIR(st.st_mode)) {
auto i = files.lower_bound(file);
return i != files.end() && hasPrefix(*i, file);
auto prefix = file + "/";
auto i = files.lower_bound(prefix);
return i != files.end() && hasPrefix(*i, prefix);
}
return files.count(file);
+3 -2
View File
@@ -52,8 +52,9 @@ HgInfo exportMercurial(ref<Store> store, const std::string & uri,
auto st = lstat(p);
if (S_ISDIR(st.st_mode)) {
auto i = files.lower_bound(file);
return i != files.end() && hasPrefix(*i, file);
auto prefix = file + "/";
auto i = files.lower_bound(prefix);
return i != files.end() && hasPrefix(*i, prefix);
}
return files.count(file);