Skip to content

Commit

Permalink
Bisecting status
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Oct 26, 2024
1 parent 8aabb90 commit 40c3a21
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom-prompt/custom-prompt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class GitRepository
std::filesystem::path gitdir;
std::string ref;
bool detached;
bool cherrypicking, merging, rebasing, reverting;
bool bisecting, cherrypicking, merging, rebasing, reverting;

public:
GitRepository(void);
Expand All @@ -187,19 +187,22 @@ class GitRepository
/******************************************************************************
* Read the current Git repository.
*****************************************************************************/
GitRepository::GitRepository(void) : cherrypicking(false), merging(false), rebasing(false), reverting(false)
GitRepository::GitRepository(void) :
bisecting(false), cherrypicking(false), merging(false), rebasing(false), reverting(false)
{
C::git_libgit2_init();
if (C::git_repository_open_ext(&this->repo, ".", 0, nullptr) != 0)
{
LOG_DEBUG("Failed to open.");
return;
}
this->gitdir = C::git_repository_path(this->repo);
this->ref = this->reference();
this->detached = C::git_repository_head_detached(this->repo);
switch (C::git_repository_state(this->repo))
{
case C::GIT_REPOSITORY_STATE_BISECT:
this->bisecting = true;
break;
case C::GIT_REPOSITORY_STATE_CHERRYPICK:
case C::GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE:
this->cherrypicking = true;
Expand Down Expand Up @@ -248,6 +251,7 @@ std::string GitRepository::info(void)
{
LOG_DEBUG("ref=%s", this->ref.data());
LOG_DEBUG("detached=%d", this->detached);
LOG_DEBUG("bisecting=%d", this->bisecting);
LOG_DEBUG("cherrypicking=%d", this->cherrypicking);
LOG_DEBUG("merging=%d", this->merging);
LOG_DEBUG("rebasing=%d", this->rebasing);
Expand Down

0 comments on commit 40c3a21

Please sign in to comment.