aboutsummaryrefslogtreecommitdiff
path: root/build2/version/snapshot.cxx
blob: be6c147b585eece500adf8c9c65f6da4fdac49eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 ();
    }
  }
}