11package  controllers
22
33import  (
4+ 	"fmt" 
5+ 	"strings" 
6+ 
47	"github.com/jesseduffield/gocui" 
58	"github.com/jesseduffield/lazygit/pkg/commands/models" 
69	"github.com/jesseduffield/lazygit/pkg/gui/context" 
10+ 	"github.com/jesseduffield/lazygit/pkg/gui/style" 
711	"github.com/jesseduffield/lazygit/pkg/gui/types" 
812	"github.com/jesseduffield/lazygit/pkg/utils" 
13+ 	"github.com/samber/lo" 
914)
1015
1116type  TagsController  struct  {
@@ -96,7 +101,8 @@ func (self *TagsController) GetOnRenderToMain() func() {
96101				task  =  types .NewRenderStringTask ("No tags" )
97102			} else  {
98103				cmdObj  :=  self .c .Git ().Branch .GetGraphCmdObj (tag .FullRefName ())
99- 				task  =  types .NewRunCommandTask (cmdObj .GetCmd ())
104+ 				prefix  :=  self .getTagInfo (tag ) +  "\n \n ---\n \n " 
105+ 				task  =  types .NewRunCommandTaskWithPrefix (cmdObj .GetCmd (), prefix )
100106			}
101107
102108			self .c .RenderToMainViews (types.RefreshMainOpts {
@@ -110,6 +116,35 @@ func (self *TagsController) GetOnRenderToMain() func() {
110116	}
111117}
112118
119+ func  (self  * TagsController ) getTagInfo (tag  * models.Tag ) string  {
120+ 	if  tag .IsAnnotated  {
121+ 		info  :=  fmt .Sprintf ("%s: %s" , self .c .Tr .AnnotatedTag , style .AttrBold .Sprint (style .FgYellow .Sprint (tag .Name )))
122+ 		output , err  :=  self .c .Git ().Tag .ShowAnnotationInfo (tag .Name )
123+ 		if  err  ==  nil  {
124+ 			info  +=  "\n \n "  +  strings .TrimRight (filterOutPgpSignature (output ), "\n " )
125+ 		}
126+ 		return  info 
127+ 	}
128+ 
129+ 	return  fmt .Sprintf ("%s: %s" , self .c .Tr .LightweightTag , style .AttrBold .Sprint (style .FgYellow .Sprint (tag .Name )))
130+ }
131+ 
132+ func  filterOutPgpSignature (output  string ) string  {
133+ 	lines  :=  strings .Split (output , "\n " )
134+ 	inPgpSignature  :=  false 
135+ 	filteredLines  :=  lo .Filter (lines , func (line  string , _  int ) bool  {
136+ 		if  line  ==  "-----END PGP SIGNATURE-----"  {
137+ 			inPgpSignature  =  false 
138+ 			return  false 
139+ 		}
140+ 		if  line  ==  "-----BEGIN PGP SIGNATURE-----"  {
141+ 			inPgpSignature  =  true 
142+ 		}
143+ 		return  ! inPgpSignature 
144+ 	})
145+ 	return  strings .Join (filteredLines , "\n " )
146+ }
147+ 
113148func  (self  * TagsController ) checkout (tag  * models.Tag ) error  {
114149	self .c .LogAction (self .c .Tr .Actions .CheckoutTag )
115150	if  err  :=  self .c .Helpers ().Refs .CheckoutRef (tag .FullRefName (), types.CheckoutRefOptions {}); err  !=  nil  {
0 commit comments