-
Notifications
You must be signed in to change notification settings - Fork 41
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
Change ArborX hash to "hash-dirty" if worktree is not clean #558
Conversation
Did you look how other projects deal with this? I don't think it is an issue to use a tag when it exists. |
I chose the path of least effort to improve status quo. It was not my intent to provide the final solution to the problem, which your reference may be.
The only concern I have about this is that tags maybe removed and readded, and correspond to different hashes. If we promise not to do that, it is not a concern. Or we can promise not to add annotated tags, in which case it's always a hash. |
98e5754
to
4b4b7d1
Compare
Opted in favor of # Work out if the repository is dirty
execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_QUIET
ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DIFF_INDEX
ERROR_QUIET)
string(COMPARE NOTEQUAL "${GIT_DIFF_INDEX}" "" GIT_DIRTY)
if (${GIT_DIRTY})
set(GIT_DESCRIBE_VERSION "${GIT_DESCRIBE_VERSION}-dirty")
endif() |
d14ffe8
to
19459dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me. I only have a minor comment.
19459dc
to
4c2ae15
Compare
@dalg24 Changed to |
If a tree is dirty, it will print
<hash>-dirty
. This is helpful when we share logs.One caveat is that if the
HEAD
points to an annotated tag, it will print a tag instead of a hash. However, I think we are only using lightweight tags, so I don't see much of an issue, and feel like it's worth doing this.