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

Version numbers increase, even when building from same commit or tag #482

Closed
phusen opened this issue Mar 10, 2023 · 4 comments
Closed

Version numbers increase, even when building from same commit or tag #482

phusen opened this issue Mar 10, 2023 · 4 comments

Comments

@phusen
Copy link

phusen commented Mar 10, 2023

We are building g3log as a depenedency to another project. In our scripts, we clone the repo and checkout tag "1.3.3" in order to always build the same version. However, I noticed that this produces a libg3logger.so with increasing verision number over time, which was causing us a bit of trouble with our scripts. E.g. it just changed from libg3logger.so.1.3.2-210 to libg3logger.so.1.3.2-211. I think this is because the version number is generated using

git rev-list --branches HEAD

When the --brances flag is included, the list includes commits from the "future" (i.e. which are not in the history of the current commit). So this means that the version will increase, when there are new commits in the repo, even though we are building the same thing. I'm really not an expert on generating version numbers using git, but this just seemed a bit counter-intuitive to me. Also, we can work around this for our use case - I just wanted to let you know about my findings.

@KjellKod
Copy link
Owner

KjellKod commented Mar 11, 2023

interesting discovery, I have to spin up a linux box to verify that. It seems to work differently maybe under osx or the code changed for the versioning (and I can't at the moment recall when we did that).

I tested with 1.3.1 also and it also showed, what I expected.

Example:

2.3.2 
Installing: /usr/local/lib/libg3log.2.3.2-212.dylib
-- Installing: /usr/local/lib/libg3log.2.dylib
2.2.0
 Installing: /usr/local/lib/libg3log.2.2.0-0.dylib
-- Installing: /usr/local/lib/libg3log.2.dylib

Then again. I downloaded the zip release, so maybe at a snapshot at that time it didn't have access to HEAD and for that reason the zip file release snapshot works?

@KjellKod
Copy link
Owner

I'm adding this as a feature request. Your use case make sense and we should be able to update the version handling to avoid this.

@KjellKod
Copy link
Owner

KjellKod commented Dec 7, 2023

still testing it out but I believe this PR should fix it @phusen https://github.com/KjellKod/g3log/pull/515/files

  • if you check out from a tag, the patch number should not increase regardless of what happens on the master/HEAD.
  • if you checkout master, then the patch number will continue to increase from the latest tag as committed prs get merged to master.

@KjellKod
Copy link
Owner

KjellKod commented Dec 7, 2023

resolved with #515

  1. verified with: created release 2.4
  2. verified with master that version, patch numbers kept increasing with commits.
  3. verified that patch number stayed as expected when git checkout 2.4 was made - regardless of things happening in master.

@KjellKod KjellKod closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants