Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request || Bug Fix ] Tag date #2

Open
ondrovic opened this issue Aug 16, 2024 · 0 comments
Open

[Feature Request || Bug Fix ] Tag date #2

ondrovic opened this issue Aug 16, 2024 · 0 comments

Comments

@ondrovic
Copy link

ondrovic commented Aug 16, 2024

Can we add a date to when we use your tool?

Currently if you do the following

git for-each-ref --sort=-taggerdate --format '%(refname:short) %(taggerdate:short)' refs/tags
-or-
git for-each-ref --format="%(refname:short) %(taggerdate)" refs/tags/

you just get a list of tags with no dates

if you create like like so using git using the annotated tag -a

git tag -a v0.1.22 -m "Version 0.1.22"

examples: all where done using git-semv patch --bump on windows, except v0.1.22 which was done with git tag -a

git for-each-ref --format="%(refname:short) %(taggerdate)" refs/tags/
list
v0.1.0
v0.1.1
v0.1.10
v0.1.11
v0.1.12
v0.1.13
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.2
v0.1.20
v0.1.21
v0.1.22 Fri Aug 16 11:43:01 2024 -0400
v0.1.3
v0.1.4
v0.1.5
v0.1.6
v0.1.7
 git-semv list
v0.1.0
v0.1.1
v0.1.2
v0.1.3
v0.1.4
v0.1.5
v0.1.6
v0.1.7
v0.1.8
v0.1.9
v0.1.10
v0.1.11
v0.1.12
v0.1.13
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22

system info - not sure what you need so decide to include

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ondro\AppData\Local\go-build
set GOENV=C:\Users\ondro\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\ondro\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\ondro\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\ondro\scoop\apps\go\current
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\ondro\scoop\apps\go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.0
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\ondro\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\ondro\source\repos\GO\common\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\ondro\AppData\Local\Temp\go-build169805946=/tmp/go-build -gno-record-gcc-switches
git-semv -v
git-semv version 1.2.0 [0cc0908edf0f46ded1ffaeeb21ce56a041b634a8, 2021-06-17T14:08:26Z]

So doing the following seems to work

// cli.go

if c.Bump {
	if gitTagCmder == nil {
		gitTagCmder = Cmd{}
	}
	// uses moved this to var now it's used in 3 places
	nextVer := next.String()
	// added the -a and -m flags
	_, err = gitTagCmder.Do("git", "tag", "-a", nextVer, fmt.Sprintf("-m Version %s", nextVer))
	if err != nil {
		fmt.Fprintf(c.env.Err, "Error: %s\n", err)
		return ExitErr
	}
	if gitPushTagCmder == nil {
		gitPushTagCmder = Cmd{}
	}
	_, err = gitPushTagCmder.Do("git", "push", "origin", nextVer)
	if err != nil {
		fmt.Fprintf(c.env.Err, "Error: %s\n", err)
		return ExitErr
	}
	fmt.Fprintf(c.env.Out, "Bumped version to %s\n", next)
}
@ondrovic ondrovic changed the title [Feature Request] Tag date [Feature Request || Bug Fix ] Tag date Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant