0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-21 22:10:39 +00:00

fix: skip tag and next-version if unchanged (#11)

This commit is contained in:
Robert Kaussow 2023-10-17 15:23:00 +02:00 committed by GitHub
parent b9493c1610
commit 66b6f803b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -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{

View File

@ -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())

View File

@ -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
}
}