mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Use a different way to check if a tag is annotated
Storing it in the Tag struct makes loading tags a lot slower when there is a very large number of tags; so determine it on the fly instead. On my machine, the additional call takes under 5ms, so it seems we can afford it.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package git_commands
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
)
|
||||
@ -74,3 +76,13 @@ func (self *TagCommands) ShowAnnotationInfo(tagName string) (string, error) {
|
||||
|
||||
return self.cmd.New(cmdArgs).RunWithOutput()
|
||||
}
|
||||
|
||||
func (self *TagCommands) IsTagAnnotated(tagName string) (bool, error) {
|
||||
cmdArgs := NewGitCmd("cat-file").
|
||||
Arg("-t").
|
||||
Arg("refs/tags/" + tagName).
|
||||
ToArgv()
|
||||
|
||||
output, err := self.cmd.New(cmdArgs).RunWithOutput()
|
||||
return strings.TrimSpace(output) == "tag", err
|
||||
}
|
||||
|
Reference in New Issue
Block a user