From bd15d5ce057676905332939ad666bd665bc36686 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Wed, 18 Mar 2026 10:50:01 -0700 Subject: [PATCH] fix: groups recording for [all] --- cmd/joj3/conf/conf.go | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/cmd/joj3/conf/conf.go b/cmd/joj3/conf/conf.go index f5c8145..21b074a 100644 --- a/cmd/joj3/conf/conf.go +++ b/cmd/joj3/conf/conf.go @@ -202,20 +202,7 @@ func MatchGroups(conf *Conf, conventionalCommit *ConventionalCommit) []string { seen := make(map[string]bool) keywords := []string{} loweredCommitGroup := strings.ToLower(conventionalCommit.Group) - if loweredCommitGroup == "all" { - for i := range conf.PreStages { - conf.PreStages[i].Group = "" - conf.PreStages[i].Groups = nil - } - for i := range conf.Stages { - conf.Stages[i].Group = "" - conf.Stages[i].Groups = nil - } - for i := range conf.PostStages { - conf.PostStages[i].Group = "" - conf.PostStages[i].Groups = nil - } - } + matchAllGroups := loweredCommitGroup == "all" confStages := []ConfStage{} confStages = append(confStages, conf.PreStages...) confStages = append(confStages, conf.Stages...) @@ -241,10 +228,24 @@ func MatchGroups(conf *Conf, conventionalCommit *ConventionalCommit) []string { slog.Info("group keywords from stages", "keywords", keywords) groups := []string{} for _, keyword := range keywords { - if strings.Contains(loweredCommitGroup, keyword) { + if matchAllGroups || strings.Contains(loweredCommitGroup, keyword) { groups = append(groups, keyword) } } slog.Info("matched groups", "groups", groups) + if matchAllGroups { + for i := range conf.PreStages { + conf.PreStages[i].Group = "" + conf.PreStages[i].Groups = nil + } + for i := range conf.Stages { + conf.Stages[i].Group = "" + conf.Stages[i].Groups = nil + } + for i := range conf.PostStages { + conf.PostStages[i].Group = "" + conf.PostStages[i].Groups = nil + } + } return groups }