summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/helpers/sub_commits_helper.go
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-08-05 12:06:37 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-08-29 08:16:40 +0200
commit572d1b5920104b06b3297e3861454f14738bf71b (patch)
tree9db9d700ae648f03544e7cf6d3af4d7c5c91be15 /pkg/gui/controllers/helpers/sub_commits_helper.go
parente8fac6ca7360faf5db1c82af2b2e9c87aa5a5edc (diff)
Add "Show divergence from upstream" entry to Upstream menu in branches panel
Diffstat (limited to 'pkg/gui/controllers/helpers/sub_commits_helper.go')
-rw-r--r--pkg/gui/controllers/helpers/sub_commits_helper.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/pkg/gui/controllers/helpers/sub_commits_helper.go b/pkg/gui/controllers/helpers/sub_commits_helper.go
index 412c23f0d..74c50fd14 100644
--- a/pkg/gui/controllers/helpers/sub_commits_helper.go
+++ b/pkg/gui/controllers/helpers/sub_commits_helper.go
@@ -27,19 +27,22 @@ func NewSubCommitsHelper(
}
type ViewSubCommitsOpts struct {
- Ref types.Ref
- Context types.Context
- ShowBranchHeads bool
+ Ref types.Ref
+ RefToShowDivergenceFrom string
+ TitleRef string
+ Context types.Context
+ ShowBranchHeads bool
}
func (self *SubCommitsHelper) ViewSubCommits(opts ViewSubCommitsOpts) error {
commits, err := self.c.Git().Loaders.CommitLoader.GetCommits(
git_commands.GetCommitsOptions{
- Limit: true,
- FilterPath: self.c.Modes().Filtering.GetPath(),
- IncludeRebaseCommits: false,
- RefName: opts.Ref.FullRefName(),
- RefForPushedStatus: opts.Ref.FullRefName(),
+ Limit: true,
+ FilterPath: self.c.Modes().Filtering.GetPath(),
+ IncludeRebaseCommits: false,
+ RefName: opts.Ref.FullRefName(),
+ RefForPushedStatus: opts.Ref.FullRefName(),
+ RefToShowDivergenceFrom: opts.RefToShowDivergenceFrom,
},
)
if err != nil {
@@ -53,8 +56,9 @@ func (self *SubCommitsHelper) ViewSubCommits(opts ViewSubCommitsOpts) error {
subCommitsContext.SetSelectedLineIdx(0)
subCommitsContext.SetParentContext(opts.Context)
subCommitsContext.SetWindowName(opts.Context.GetWindowName())
- subCommitsContext.SetTitleRef(utils.TruncateWithEllipsis(opts.Ref.RefName(), 50))
+ subCommitsContext.SetTitleRef(utils.TruncateWithEllipsis(opts.TitleRef, 50))
subCommitsContext.SetRef(opts.Ref)
+ subCommitsContext.SetRefToShowDivergenceFrom(opts.RefToShowDivergenceFrom)
subCommitsContext.SetLimitCommits(true)
subCommitsContext.SetShowBranchHeads(opts.ShowBranchHeads)
subCommitsContext.ClearSearchString()