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.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/build2/version/snapshot.cxx b/build2/version/snapshot.cxx
new file mode 100644
index 0000000..be6c147
--- /dev/null
+++ b/build2/version/snapshot.cxx
@@ -0,0 +1,31 @@
+// file : build2/version/snapshot.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <build2/version/snapshot>
+
+#include <build2/filesystem>
+
+using namespace std;
+
+namespace build2
+{
+ namespace version
+ {
+ snapshot
+ extract_snapshot_git (const dir_path&);
+
+ static const dir_path git (".git");
+
+ snapshot
+ extract_snapshot (const scope& rs)
+ {
+ const dir_path& src_root (rs.src_path ());
+
+ if (exists (src_root / git))
+ return extract_snapshot_git (src_root);
+
+ return snapshot ();
+ }
+ }
+}