1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-02 09:21:40 +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"
"strings"
"github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@ -19,7 +20,7 @@ func convertToInt(s string) int {
return i
}
func (c *GitCommand) GetTags() ([]*Tag, error) {
func (c *GitCommand) GetTags() ([]*models.Tag, error) {
// get remote branches
remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(`git tag --list`)
if err != nil {
@ -34,10 +35,10 @@ func (c *GitCommand) GetTags() ([]*Tag, error) {
split := strings.Split(content, "\n")
// 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 {
tags[i] = &Tag{
tags[i] = &models.Tag{
Name: tagName,
}
}

View File

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

View File

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

View File

@ -1,12 +1,12 @@
package presentation
import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/models"
"github.com/jesseduffield/lazygit/pkg/theme"
"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))
for i := range tags {
@ -18,7 +18,7 @@ func GetTagListDisplayStrings(tags []*commands.Tag, diffName string) [][]string
}
// 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
if diffed {
attr = theme.DiffTerminalColor

View File

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

View File

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