1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

move tags

This commit is contained in:
Jesse Duffield 2020-09-29 18:38:56 +10:00
parent 630e446989
commit e849ca3372
6 changed files with 12 additions and 11 deletions

View File

@ -6,6 +6,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
) )
@ -19,7 +20,7 @@ func convertToInt(s string) int {
return i return i
} }
func (c *GitCommand) GetTags() ([]*Tag, error) { func (c *GitCommand) GetTags() ([]*models.Tag, error) {
// get remote branches // get remote branches
remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(`git tag --list`) remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(`git tag --list`)
if err != nil { if err != nil {
@ -34,10 +35,10 @@ func (c *GitCommand) GetTags() ([]*Tag, error) {
split := strings.Split(content, "\n") split := strings.Split(content, "\n")
// first step is to get our remotes from go-git // first step is to get our remotes from go-git
tags := make([]*Tag, len(split)) tags := make([]*models.Tag, len(split))
for i, tagName := range split { for i, tagName := range split {
tags[i] = &Tag{ tags[i] = &models.Tag{
Name: tagName, Name: tagName,
} }
} }

View File

@ -21,7 +21,7 @@ type CustomCommandObjects struct {
SelectedLocalBranch *models.Branch SelectedLocalBranch *models.Branch
SelectedRemoteBranch *commands.RemoteBranch SelectedRemoteBranch *commands.RemoteBranch
SelectedRemote *commands.Remote SelectedRemote *commands.Remote
SelectedTag *commands.Tag SelectedTag *models.Tag
SelectedStashEntry *commands.StashEntry SelectedStashEntry *commands.StashEntry
SelectedCommitFile *commands.CommitFile SelectedCommitFile *commands.CommitFile
CheckedOutBranch *models.Branch CheckedOutBranch *models.Branch

View File

@ -288,7 +288,7 @@ type guiState struct {
SubCommits []*models.Commit SubCommits []*models.Commit
Remotes []*commands.Remote Remotes []*commands.Remote
RemoteBranches []*commands.RemoteBranch RemoteBranches []*commands.RemoteBranch
Tags []*commands.Tag Tags []*models.Tag
MenuItems []*menuItem MenuItems []*menuItem
Updating bool Updating bool
Panels *panelStates Panels *panelStates

View File

@ -1,12 +1,12 @@
package presentation package presentation
import ( import (
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
) )
func GetTagListDisplayStrings(tags []*commands.Tag, diffName string) [][]string { func GetTagListDisplayStrings(tags []*models.Tag, diffName string) [][]string {
lines := make([][]string, len(tags)) lines := make([][]string, len(tags))
for i := range tags { for i := range tags {
@ -18,7 +18,7 @@ func GetTagListDisplayStrings(tags []*commands.Tag, diffName string) [][]string
} }
// getTagDisplayStrings returns the display string of branch // getTagDisplayStrings returns the display string of branch
func getTagDisplayStrings(t *commands.Tag, diffed bool) []string { func getTagDisplayStrings(t *models.Tag, diffed bool) []string {
attr := theme.DefaultTextColor attr := theme.DefaultTextColor
if diffed { if diffed {
attr = theme.DiffTerminalColor attr = theme.DiffTerminalColor

View File

@ -2,12 +2,12 @@ package gui
import ( import (
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/models"
) )
// list panel functions // list panel functions
func (gui *Gui) getSelectedTag() *commands.Tag { func (gui *Gui) getSelectedTag() *models.Tag {
selectedLine := gui.State.Panels.Tags.SelectedLineIdx selectedLine := gui.State.Panels.Tags.SelectedLineIdx
if selectedLine == -1 || len(gui.State.Tags) == 0 { if selectedLine == -1 || len(gui.State.Tags) == 0 {
return nil return nil

View File

@ -1,4 +1,4 @@
package commands package models
// Tag : A git tag // Tag : A git tag
type Tag struct { type Tag struct {