mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-21 12:00:40 +00:00
fix: skip tag and next-version if unchanged (#11)
This commit is contained in:
parent
b9493c1610
commit
66b6f803b8
@ -31,7 +31,7 @@ func ChangelogFlags(settings *app.ChangelogSettings) []cli.Flag {
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "strict",
|
||||
Usage: "only show tags 'SemVer-ish'",
|
||||
Usage: "only include semver comliant tags",
|
||||
Destination: &settings.Strict,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
|
@ -3,6 +3,7 @@ package commands
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/thegeeklab/git-sv/app"
|
||||
"github.com/thegeeklab/git-sv/sv"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -22,7 +23,12 @@ func NextVersionHandler(g app.GitSV) cli.ActionFunc {
|
||||
return fmt.Errorf("error getting git log: %w", err)
|
||||
}
|
||||
|
||||
nextVer, _ := g.CommitProcessor.NextVersion(currentVer, commits)
|
||||
nextVer, updated := g.CommitProcessor.NextVersion(currentVer, commits)
|
||||
if !updated {
|
||||
log.Info().Msgf("nothing to do: current version %s unchanged", currentVer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Printf("%d.%d.%d\n", nextVer.Major(), nextVer.Minor(), nextVer.Patch())
|
||||
|
||||
|
@ -3,6 +3,7 @@ package commands
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/thegeeklab/git-sv/app"
|
||||
"github.com/thegeeklab/git-sv/sv"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -22,15 +23,20 @@ func TagHandler(g app.GitSV) cli.ActionFunc {
|
||||
return fmt.Errorf("error getting git log: %w", err)
|
||||
}
|
||||
|
||||
nextVer, _ := g.CommitProcessor.NextVersion(currentVer, commits)
|
||||
nextVer, updated := g.CommitProcessor.NextVersion(currentVer, commits)
|
||||
if !updated {
|
||||
log.Info().Msgf("nothing to do: current version %s unchanged", currentVer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
tagname, err := g.Tag(*nextVer)
|
||||
|
||||
fmt.Println(tagname)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error generating tag version: %s: %w", nextVer.String(), err)
|
||||
}
|
||||
|
||||
fmt.Println(tagname)
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user