git-ecosystem / git-bundle-server

A web server & management CLI to host Git bundles for use with Git's "bundle URIs" feature
Other
43 stars 20 forks source link

Add `version` command #43

Closed vdye closed 1 year ago

vdye commented 1 year ago

Closes #17

This pull request contains a smattering of CI/CD updates as well as the addition of the git-bundle-server version command.

CI/CD changes

git-bundle-server version

CC: @jeffhostetler (since this is based on your recommendation in an earlier PR)

vdye commented 1 year ago

Overall, looks really good! The one thing I'm having trouble with is getting the new command to work locally (although I recognize this is probabaly just me holding it wrong). Here's what I'm seeing:

make output

ldennington@Lessleys-MBP:~/repos/git-bundle-server(vdye/version-cmd○) » make
rm -f -r /Users/ldennington/repos/git-bundle-server/bin
GOOS="darwin" GOARCH="amd64" go build -o /Users/ldennington/repos/git-bundle-server/bin -ldflags "-X 'github.com/github/git-bundle-server/cmd/utils.Version='" ./...

git-bundle-server version output

ldennington@Lessleys-MBP:~/repos/git-bundle-server(vdye/version-cmd○) » ./bin/git-bundle-server version
git-bundle-server version <no version>

git tag --list output

ldennington@Lessleys-MBP:~/repos/git-bundle-server(vdye/version-cmd○) » git tag --list
v0.0.1
v0.1.0
v0.1.1
v0.1.2
v0.2.0

@ldennington the issue is that none of those tags are on the main branch, so they're not in the ancestry path searched by git describe, so no version is found. If you locally tag the main branch with v<something>, does that work?

ldennington commented 1 year ago

@ldennington the issue is that none of those tags are on the main branch, so they're not in the ancestry path searched by git describe, so no version is found. If you locally tag the main branch with v<something>, does that work?

That worked! Thanks for clarifying.