aboutsummaryrefslogtreecommitdiff
path: root/libbutl/git.mxx
blob: 3f003beee13c6242ee129c3abbd14a1a31b7d942 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// file      : libbutl/git.mxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#ifndef __cpp_modules_ts
#pragma once
#endif

// C includes.

#ifndef __cpp_lib_modules_ts
#include <string>
#endif

// Other includes.

#ifdef __cpp_modules_ts
export module butl.git;
#ifdef __cpp_lib_modules_ts
import std.core;
#endif
import butl.path;
import butl.optional;
import butl.semantic_version;
#else
#include <libbutl/path.mxx>
#include <libbutl/optional.mxx>
#include <libbutl/semantic-version.mxx>
#endif

#include <libbutl/export.hxx>

LIBBUTL_MODEXPORT namespace butl
{
  // Return true if the specified directory is a git repository root (contains
  // the .git filesystem entry).
  //
  LIBBUTL_SYMEXPORT bool
  git_repository (const dir_path&);

  // Try to parse the line printed by the 'git --version' command. Return git
  // version if succeed, nullopt otherwise.
  //
  LIBBUTL_SYMEXPORT optional<semantic_version>
  git_version (const std::string&);
}