-
Notifications
You must be signed in to change notification settings - Fork 213
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
git_describe() and --dirty #35
Comments
Or is it because cmake is re-run only after a commit is done and that makes --dirty basically useless? |
Well, the script is set up to trigger a CMake re-run if a commit is done. Not sure about --dirty, haven't used it myself, though it does seem useful: is that a feature of only newer git versions? I could see changing the logic so that if we are just looking at head, we omit the commit and pass --dirty. |
No it's not new, I remember using |
Would like to see this supported as well. Preferably it would also automatically re-run CMake if the repo changes from dirty to clean state and vice versa. |
Hi, seems that this issue is still present. Maybe some more information here about this modification: https://stackoverflow.com/questions/16035240/why-is-git-describe-dirty-adding-a-dirty-suffix-when-describing-a-clean-ch I'll try to fix this. |
The issue is still happening. If I prepare a patch just removing the hash from the call to git_describe would you merge it? I don't see a use-case for calling git-describe with anothe parameter than HEAD. |
Something like this works for my use-case: 0001-cmake-fix-git_describe-not-working-with-dirty.txt Edit: this does NOT work. Removing the hash from the list of parameters has the side-effect that cmake does not re-generate the version string when the git commit changes. |
I also recommend removing "ERROR_QUIET". Failing the build with the git error visible in the logs is better than silently printing "128-NOTFOUND" as a version string in my opinion. |
agreed on ERROR_QUIET |
There is now a git_describe_working_tree that does a |
It seems that git_describe() can't be used with --dirty - it will always return
-128-NOTFOUND
. When running the same command from the command line yields this:So basically git doesn't like that we're passing both hash and --dirty. I don't see why we have to pass commit hash to
git describe
in git_describe(), by default git will just assumeHEAD
.The text was updated successfully, but these errors were encountered: