1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Add "Show divergence from upstream" entry to Upstream menu in branches panel

This commit is contained in:
Stefan Haller
2023-08-05 12:06:37 +02:00
parent e8fac6ca73
commit 572d1b5920
8 changed files with 116 additions and 17 deletions

View File

@ -1,5 +1,7 @@
package models
import "fmt"
// Branch : A git branch
// duplicating this for now
type Branch struct {
@ -43,6 +45,22 @@ func (b *Branch) ParentRefName() string {
return b.RefName() + "^"
}
func (b *Branch) FullUpstreamRefName() string {
if b.UpstreamRemote == "" || b.UpstreamBranch == "" {
return ""
}
return fmt.Sprintf("refs/remotes/%s/%s", b.UpstreamRemote, b.UpstreamBranch)
}
func (b *Branch) ShortUpstreamRefName() string {
if b.UpstreamRemote == "" || b.UpstreamBranch == "" {
return ""
}
return fmt.Sprintf("%s/%s", b.UpstreamRemote, b.UpstreamBranch)
}
func (b *Branch) ID() string {
return b.RefName()
}