summaryrefslogtreecommitdiffstats
path: root/pkg/gui/services/custom_commands/models.go
blob: 261bace45acf67128ef2e3127cdc7b5d0afc03dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package custom_commands

import (
	"github.com/jesseduffield/lazygit/pkg/commands/models"
	"github.com/stefanhaller/git-todo-parser/todo"
)

// We create shims for all the model classes in order to get a more stable API
// for custom commands. At the moment these are almost identical to the model
// classes, but this allows us to add "private" fields to the model classes that
// we don't want to expose to custom commands, or rename a model field to a
// better name without breaking people's custom commands. In such a case we add
// the new, better name to the shim but keep the old one for backwards
// compatibility. We already did this for Commit.Sha, which was renamed to Hash.

type Commit struct {
	Hash          string // deprecated: use Sha
	Sha           string
	Name          string
	Status        models.CommitStatus
	Action        todo.TodoCommand
	Tags          []string
	ExtraInfo     string
	AuthorName    string
	AuthorEmail   string
	UnixTimestamp int64
	Divergence    models.Divergence
	Parents       []string
}

type File struct {
	Name                    string
	PreviousName            string
	HasStagedChanges        bool
	HasUnstagedChanges      bool
	Tracked                 bool
	Added                   bool
	Deleted                 bool
	HasMergeConflicts       bool
	HasInlineMergeConflicts bool
	DisplayString           string
	ShortStatus             string
	IsWorktree              bool
}

type Branch struct {
	Name           string
	DisplayName    string
	Recency        string
	Pushables      string // deprecated: use AheadForPull
	Pullables      string // deprecated: use BehindForPull
	AheadForPull   string
	BehindForPull  string
	AheadForPush   string
	BehindForPush  string
	UpstreamGone   bool
	Head           bool
	DetachedHead   bool
	UpstreamRemote string
	UpstreamBranch string
	Subject        string
	CommitHash     string
}

type RemoteBranch struct {
	Name       string
	RemoteName string
}

type Remote struct {
	Name     string
	Urls     []string
	Branches []*RemoteBranch
}

type Tag struct {
	Name    string
	Message string
}

type StashEntry struct {
	Index   int
	Recency string
	Name    string
}

type CommitFile struct {
	Name         string
	ChangeStatus string
}

type Worktree struct {
	IsMain        bool
	IsCurrent     bool
	Path          string
	IsPathMissing bool
	GitDir        string
	Branch        string
	Name          string
}