diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-12-13 12:43:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-12-13 12:43:27 +0200 |
commit | 884b16c882863f1eb5144a4bf7d1739bdf99a271 (patch) | |
tree | 8d5aeb8b318cfdc99e2315168e0cd9d232a92c78 /bdep/git.hxx | |
parent | 213a905803f069b7d3148cac8591f4046325bad0 (diff) |
Factor git-status code from bdep-ci to git_status()
Diffstat (limited to 'bdep/git.hxx')
-rw-r--r-- | bdep/git.hxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bdep/git.hxx b/bdep/git.hxx index 8ef9397..91a9fd9 100644 --- a/bdep/git.hxx +++ b/bdep/git.hxx @@ -71,6 +71,28 @@ namespace bdep const char* opt = nullptr, const char* what = "remote repository URL", const char* cfg = nullptr); + + // Repository status. + // + struct git_repository_status + { + string commit; // Current commit or empty if initial. + string branch; // Local branch or empty if detached. + string upstream; // Upstream in <remote>/<branch> form or empty if not set. + + // Note that unmerged and untracked entries are considered as unstaged. + // + bool staged = false; // Repository has staged changes. + bool unstaged = false; // Repository has unstaged changes. + + // Note that we can be both ahead and behind. + // + bool ahead = false; // Local branch is ahead of upstream. + bool behind = false; // Local branch is behind of upstream. + }; + + git_repository_status + git_status (const dir_path& repo); } #include <bdep/git.ixx> |