-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Create shims for all model classes in SessionStateLoader
Move them to a separate file to make it easier for users to see what fields exist.
- Loading branch information
1 parent
cb51472
commit 7ab7fae
Showing
2 changed files
with
100 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 CommitShim 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 FileShim 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 BranchShim 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 RemoteBranchShim struct { | ||
Name string | ||
RemoteName string | ||
} | ||
|
||
type RemoteShim struct { | ||
Name string | ||
Urls []string | ||
Branches []*RemoteBranchShim | ||
} | ||
|
||
type TagShim struct { | ||
Name string | ||
Message string | ||
} | ||
|
||
type StashEntryShim struct { | ||
Index int | ||
Recency string | ||
Name string | ||
} | ||
|
||
type CommitFileShim struct { | ||
Name string | ||
ChangeStatus string | ||
} | ||
|
||
type WorktreeShim struct { | ||
IsMain bool | ||
IsCurrent bool | ||
Path string | ||
IsPathMissing bool | ||
GitDir string | ||
Branch string | ||
Name string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters