Describe the bug
The plugin panics after creating the first tag.
To Reproduce
I was using this repo: https://github.com/twelvelabs/stamp, but have seen the same results w/ several other repos.
# Start off w/ no tags
[sbaney@helios:~/src/twelvelabs/stamp] $ git tag -l
# Plugin works fine and shows the default starting version
[sbaney@helios:~/src/twelvelabs/stamp] $ gh semver
v0.1.0
# Create the first tag
[sbaney@helios:~/src/twelvelabs/stamp] $ gh semver -tag
v0.1.0
# Now the plugin panics when called
[sbaney@helios:~/src/twelvelabs/stamp] $ gh semver
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x1023a9648]
goroutine 1 [running]:
github.com/koozz/gh-semver/internal/semver.(*SemVer).SetBranch(...)
github.com/koozz/gh-semver/internal/semver/semver.go:139
github.com/koozz/gh-semver/internal/semver.(*ConventionalCommits).SemVer(0x1400017e300)
github.com/koozz/gh-semver/internal/semver/convcommits.go:92 +0x218
main.calculateSemVer(0x1023ac424?, {0x0?, 0x14000117f06?}, {0x0, 0x0}, 0xc9?, 0x4?)
github.com/koozz/gh-semver/main.go:61 +0x30
main.main()
github.com/koozz/gh-semver/main.go:47 +0x2e4
Expected behavior
I expected to see v0.1.0
... and if I created a new fix:
commit, v0.1.1
.
Additional context
If I delete the tag, the plugin works again:
[sbaney@helios:~/src/twelvelabs/stamp] $ git tag -d v0.1.0
Deleted tag 'v0.1.0' (was 2fc21e3)
[sbaney@helios:~/src/twelvelabs/stamp] $ gh semver
v0.1.0
I thought that maybe the issue was the major version being 0
, but I see the same results if I create a 1.0
tag:
[sbaney@helios:~/src/twelvelabs/stamp] $ git tag -l
v1.0.0
[sbaney@helios:~/src/twelvelabs/stamp] $ gh semver
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x104c99648]
goroutine 1 [running]:
github.com/koozz/gh-semver/internal/semver.(*SemVer).SetBranch(...)
github.com/koozz/gh-semver/internal/semver/semver.go:139
github.com/koozz/gh-semver/internal/semver.(*ConventionalCommits).SemVer(0x140001ce2c0)
github.com/koozz/gh-semver/internal/semver/convcommits.go:92 +0x218
main.calculateSemVer(0x104c9c424?, {0x0?, 0x14000145f06?}, {0x0, 0x0}, 0xc9?, 0x4?)
github.com/koozz/gh-semver/main.go:61 +0x30
main.main()
github.com/koozz/gh-semver/main.go:47 +0x2e4