Improve git commit hash lookup #5225
Open
+55
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
High Level Overview of Change
Changes the lookup of the git hash included in rippled's version number (for debug builds) to use
rev-parse
instead ofdescribe
, plus a few more improvements.Context of Change
Commit bf013c0 back in 2021 used
git describe
to find the hash of the commit being built when buildingrippled
.From the description of
git describe
:This sometimes results in rippled version numbers that look like:
We want version numbers that look like:
In other words, without
ppe-build-175-g
, indicating that the commit is 175 commits after theppe-build
tag, particularly since that tag is on version 2.1.0-rc1 from February.This changes the lookup to use
git rev-parse
instead, which always just returns a hash.While I was in there, I also added code to find the branch name, and included the hash and branch name in the admin-only result of
server_info
, and the output of--version
, so this info can be found on release builds as well.Type of Change
API Impact
Before / After
rippled --version
Before:
rippled --version
on a debug build may return something likeAfter:
rippled --version
on a debug build will return something likeAnd on a release build will return something like
server_info
Before:
server_info
does not include any git information.After:
server_info
on an admin connection will include git info: