11package helpers
22
33import (
4- "github.com/jesseduffield/gocui"
4+ "github.com/jesseduffield/lazygit/pkg/commands/git_commands"
5+ "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
56 "github.com/jesseduffield/lazygit/pkg/gui/context"
67 "github.com/jesseduffield/lazygit/pkg/gui/types"
78 "github.com/jesseduffield/lazygit/pkg/utils"
@@ -10,35 +11,31 @@ import (
1011type TagsHelper struct {
1112 c * HelperCommon
1213 commitsHelper * CommitsHelper
14+ gpg * GpgHelper
1315}
1416
15- func NewTagsHelper (c * HelperCommon , commitsHelper * CommitsHelper ) * TagsHelper {
17+ func NewTagsHelper (c * HelperCommon , commitsHelper * CommitsHelper , gpg * GpgHelper ) * TagsHelper {
1618 return & TagsHelper {
1719 c : c ,
1820 commitsHelper : commitsHelper ,
21+ gpg : gpg ,
1922 }
2023}
2124
2225func (self * TagsHelper ) OpenCreateTagPrompt (ref string , onCreate func ()) error {
2326 doCreateTag := func (tagName string , description string , force bool ) error {
24- return self .c .WithWaitingStatus (self .c .Tr .CreatingTag , func (gocui.Task ) error {
25- if description != "" {
26- self .c .LogAction (self .c .Tr .Actions .CreateAnnotatedTag )
27- if err := self .c .Git ().Tag .CreateAnnotated (tagName , ref , description , force ); err != nil {
28- return err
29- }
30- } else {
31- self .c .LogAction (self .c .Tr .Actions .CreateLightweightTag )
32- if err := self .c .Git ().Tag .CreateLightweight (tagName , ref , force ); err != nil {
33- return err
34- }
35- }
27+ var command oscommands.ICmdObj
28+ if description != "" || self .c .Git ().Config .GetGpgTagSign () {
29+ self .c .LogAction (self .c .Tr .Actions .CreateAnnotatedTag )
30+ command = self .c .Git ().Tag .CreateAnnotatedObj (tagName , ref , description , force )
31+ } else {
32+ self .c .LogAction (self .c .Tr .Actions .CreateLightweightTag )
33+ command = self .c .Git ().Tag .CreateLightweightObj (tagName , ref , force )
34+ }
3635
36+ return self .gpg .WithGpgHandling (command , git_commands .TagGpgSign , self .c .Tr .CreatingTag , func () error {
3737 self .commitsHelper .OnCommitSuccess ()
38-
39- return self .c .Refresh (types.RefreshOptions {
40- Mode : types .ASYNC , Scope : []types.RefreshableView {types .COMMITS , types .TAGS },
41- })
38+ return nil
4239 })
4340 }
4441
0 commit comments