From 74b1b8228d3e5916a838f5399211bf49e93b5a2c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 14 May 2018 13:07:41 +0200 Subject: Search for .git in directories outer to src_root Failed that we can't handle multi-package projects. --- build2/version/snapshot.cxx | 16 +++++++++++----- 1 file 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 (); } -- cgit v1.1