aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-14 13:07:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-14 13:07:41 +0200
commit74b1b8228d3e5916a838f5399211bf49e93b5a2c (patch)
tree55b44b043bf0e2436419c1da7bf77ae650612280
parent988cc6b8056e215c9751fbebd6df4eeccf087328 (diff)
Search for .git in directories outer to src_root
Failed that we can't handle multi-package projects.
-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 ();
}