aboutsummaryrefslogtreecommitdiff
path: root/build2/version/snapshot.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/version/snapshot.cxx')
-rw-r--r--build2/version/snapshot.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/build2/version/snapshot.cxx b/build2/version/snapshot.cxx
index ee7c2f3..46db19b 100644
--- a/build2/version/snapshot.cxx
+++ b/build2/version/snapshot.cxx
@@ -20,12 +20,18 @@ namespace build2
snapshot
extract_snapshot (const scope& rs)
{
- const dir_path& src_root (rs.src_path ());
-
- // .git can be either a directory or a file in case of a submodule.
+ // Ignore errors when checking for existence since we may be iterating
+ // over directories past any reasonable project boundaries.
//
- if (build2::entry_exists (src_root / git, true /* follow_symlinks */))
- return extract_snapshot_git (src_root);
+ for (dir_path d (rs.src_path ()); !d.empty (); d = d.directory ())
+ {
+ // .git can be either a directory or a file in case of a submodule.
+ //
+ if (butl::entry_exists (d / git,
+ true /* follow_symlinks */,
+ true /* ignore_errors */))
+ return extract_snapshot_git (d);
+ }
return snapshot ();
}