Skip to content

Update commit_hash field to GetInfo response #946

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

Merged

Conversation

ViktorTigerstrom
Copy link
Contributor

@ViktorTigerstrom ViktorTigerstrom commented May 22, 2025

This PR updates the GetInfo response to adhere to lightninglabs/lightning-terminal#1034.

In general it updates the output of the commit_hash field in the GetInfoResponse.
The commit_hash field will now contain the most recent commit_hash that the build was based on. If the build had uncommitted changes, this field will contain the most recent commit hash, suffixed by "-dirty".

We also change the output of commit field in the --version command. The Commit field will now contain most recent git commit tag.

Note that both of these changes are breaking changes!

Additionally we also add a commit_hash part of the output of the --version output.

@ViktorTigerstrom ViktorTigerstrom marked this pull request as ready for review May 22, 2025 14:52
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one comment!

Makefile Outdated
LDFLAGS := -ldflags "-X $(PKG).Commit=$(COMMIT)"
COMMIT := $(shell git describe --abbrev=40 --dirty --tags)
COMMIT_HASH := $(shell git rev-parse HEAD)
DIRTY := $(shell git diff-index --quiet HEAD -- || echo -dirty)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of -dirty we should store it as dirty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good idea! Addressed with the latest push :).

@bhandras bhandras requested a review from hieblmi May 22, 2025 15:51
Update the output of the `commit_hash` field in the GetInfoResponse.
The `commit_hash` field will contain the most recent commit_hash that
the build was based on. If the build had uncommitted changes, this field
will contain the most recent commit hash, suffixed by "-dirty".

Note that this change also changes the output of `commit` field in the
`--version` command. The `Commit` field will now contain most recent git
commit tag.
The `commit_hash` field will contain the full commit hash of the commit
that build was based on.
@ViktorTigerstrom ViktorTigerstrom force-pushed the 2025-05-update-getinfo-response branch from 0198172 to 3aaef99 Compare May 22, 2025 16:01
@ViktorTigerstrom
Copy link
Contributor Author

Thanks for the swift review @bhandras 🙏! Addressed your feedback with the latest push.

@ViktorTigerstrom ViktorTigerstrom requested a review from bhandras May 22, 2025 16:02
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! 🎉

Copy link
Collaborator

@hieblmi hieblmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, thanks @ViktorTigerstrom!

@bhandras bhandras merged commit 0ddcabe into lightninglabs:master May 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants