refactor: deprecate display_branch_status

This commit is contained in:
Jan De Dobbeleer 2021-11-08 18:46:24 +01:00 committed by Jan De Dobbeleer
parent 0fbc8910bd
commit d1ff9a96ce
3 changed files with 1 additions and 6 deletions

View file

@ -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. 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). 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_status: `boolean` - fetch the local changes - defaults to `false`
- fetch_stash_count: `boolean` fetch stash count - defaults to `false` - fetch_stash_count: `boolean` fetch stash count - defaults to `false`
- fetch_worktree_count: `boolean` fetch worktree count - defaults to `false` - fetch_worktree_count: `boolean` fetch worktree count - defaults to `false`

View file

@ -87,8 +87,6 @@ type git struct {
} }
const ( const (
// FetchBranchStatus show branch status or not
FetchBranchStatus Property = "fetch_branch_status"
// FetchStatus shows the status of the repository // FetchStatus shows the status of the repository
FetchStatus Property = "fetch_status" FetchStatus Property = "fetch_status"
// FetchStashCount show stash count or not // FetchStashCount show stash count or not
@ -199,8 +197,6 @@ func (g *git) string() string {
if g.Repo.Upstream != "" && g.props.getBool(DisplayUpstreamIcon, false) { if g.Repo.Upstream != "" && g.props.getBool(DisplayUpstreamIcon, false) {
g.Repo.UpstreamIcon = g.getUpstreamIcon() g.Repo.UpstreamIcon = g.getUpstreamIcon()
} }
if g.getBool(FetchBranchStatus, DisplayBranchStatus, true) {
g.Repo.BranchStatus = g.getBranchStatus()
} }
// use template if available // use template if available
segmentTemplate := g.props.getString(SegmentTemplate, "") segmentTemplate := g.props.getString(SegmentTemplate, "")

View file

@ -63,7 +63,7 @@ func (g *git) renderDeprecatedString(statusColorsEnabled bool) string {
} }
// branchName // branchName
fmt.Fprintf(buffer, "%s", g.Repo.HEAD) fmt.Fprintf(buffer, "%s", g.Repo.HEAD)
if len(g.Repo.BranchStatus) != 0 { if g.props.getBool(DisplayBranchStatus, false) {
buffer.WriteString(g.Repo.BranchStatus) buffer.WriteString(g.Repo.BranchStatus)
} }
if g.Repo.Staging.Changed { if g.Repo.Staging.Changed {