From d1ff9a96ce28b90e7dd3e94937c7ccb9e9feef61 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 8 Nov 2021 18:46:24 +0100 Subject: [PATCH] refactor: deprecate display_branch_status --- docs/docs/segment-git.mdx | 1 - src/segment_git.go | 4 ---- src/segment_git_deprecated.go | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/docs/segment-git.mdx b/docs/docs/segment-git.mdx index c245bb1c..2134550b 100644 --- a/docs/docs/segment-git.mdx +++ b/docs/docs/segment-git.mdx @@ -60,7 +60,6 @@ properties below. Defaults to empty. As doing multiple git calls can slow down the prompt experience, we do not fetch information by default. You can set the following properties to `true` to enable fetching additional information (and populate the template). -- fetch_branch_status: `boolean` - fetch the branch status (rebase/merge/cherry-pick/...) - defaults to `true` - fetch_status: `boolean` - fetch the local changes - defaults to `false` - fetch_stash_count: `boolean` fetch stash count - defaults to `false` - fetch_worktree_count: `boolean` fetch worktree count - defaults to `false` diff --git a/src/segment_git.go b/src/segment_git.go index 5b72ac37..49732a87 100644 --- a/src/segment_git.go +++ b/src/segment_git.go @@ -87,8 +87,6 @@ type git struct { } const ( - // FetchBranchStatus show branch status or not - FetchBranchStatus Property = "fetch_branch_status" // FetchStatus shows the status of the repository FetchStatus Property = "fetch_status" // FetchStashCount show stash count or not @@ -199,8 +197,6 @@ func (g *git) string() string { if g.Repo.Upstream != "" && g.props.getBool(DisplayUpstreamIcon, false) { g.Repo.UpstreamIcon = g.getUpstreamIcon() } - if g.getBool(FetchBranchStatus, DisplayBranchStatus, true) { - g.Repo.BranchStatus = g.getBranchStatus() } // use template if available segmentTemplate := g.props.getString(SegmentTemplate, "") diff --git a/src/segment_git_deprecated.go b/src/segment_git_deprecated.go index b56b2949..29db6a00 100644 --- a/src/segment_git_deprecated.go +++ b/src/segment_git_deprecated.go @@ -63,7 +63,7 @@ func (g *git) renderDeprecatedString(statusColorsEnabled bool) string { } // branchName fmt.Fprintf(buffer, "%s", g.Repo.HEAD) - if len(g.Repo.BranchStatus) != 0 { + if g.props.getBool(DisplayBranchStatus, false) { buffer.WriteString(g.Repo.BranchStatus) } if g.Repo.Staging.Changed {