Suggested change to compile process version number

it is possible to have a version number like

v1.11.1-3-ABCD that says that the firmware you are running is based on v1.11.1 but has 3 additional commits and is at the commit ABCD

git describe:
This command is highly useful for generating version strings based on the most recent tag reachable from a commit.
git describe --tags --always --dirty can produce output like v1.0.0-1-gABCDEF (tag, number of commits since tag, abbreviated commit hash) or v1.0.0-dirty if there are uncommitted changes.

on the branch that I’m working on, I get

git describe --tags --always --dirty
v1.11-46-gf9f81f38

so between your work and my work, we are 46 commits away from v1.11

when I go back to v1.11

git describe --tags --always --dirty
v1.11

so you can add a check that warns you if the version number has a - in it, which will tell you that you forgot to tag it.

but even if you don’t tag it, there won’t be confusion between v1.11 and the current state of the tree

one suggestion I saw was to run this in a pre-commit hook and write it to a file, or you can have it as a macro that populates it at build time

1 Like

I’m super open to this, but it might be beyond my git-fu abilities to actually implement it :grin:

Bar wrote:

I’m super open to this, but it might be beyond my git-fu abilities to actually implement it :grin:

this issue isn’t how to get git to give you the information, the issue is how to
make it something that gets populated at compile time from a shell command
rather than be hard-coded in the file.

it could be an external command that gets run and writes the value to a file
that is then used during the compile

or it could be a macro that populates the value based on running an external
command.

I created an issue for this improve version numvers · Issue #310 · BarbourSmith/FluidNC · GitHub

should we see if copilot can do this?

David Lang

1 Like

It looks like it already generated a pull request!

Let me know if it’s working the way that you would expect it to.

You can even have it build automatically by commenting “@MaslowBot please build” on the pull request and it will run the build and attach it to the pull request.

If you don’t like the way that it is working you can say “@MaslowBot please fix this to run automatically when build-release.py is called” or something like that and it should update the pull request with your suggestions