Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

adds build commit hash to --version output #1032

Closed
wants to merge 1 commit into from

Conversation

kbknapp
Copy link

@kbknapp kbknapp commented Nov 9, 2021

This commit adds the build commit hash to the --version output. This
helps while helix is built regularly from git sources on the master
branch.

This commit works by using a Cargo build script. It shells out to git rev-parse HEAD at compile time. It then sets a Cargo environment
variable with the version plus commit hash. Where the version is
displayed in the main() function, at compile time the Cargo env var is
read and the contents compiled into the binary as a static string.

The output looks like:

$ hx --vesrion
helix 0.5.0 (490919df)

I find this super useful while building helix from source commonly and knowing where in the history my current binary is at.

If there is no interest in this feature, please feel free to close 😄

This commit adds the build commit hash to the `--version` output. This
helps while helix is built regularly from git sources on the master
branch.

This commit works by using a Cargo build script. It shells out to `git
rev-parse HEAD` at compile time. It then sets a Cargo environment
variable with the version plus commit hash. Where the version is
displayed in the `main()` function, at compile time the Cargo env var is
read and the contents compiled into the binary as a static string.

The output looks like:

```console
$ hx --vesrion
helix 0.5.0 (490919d)
```
@archseer
Copy link
Member

archseer commented Nov 9, 2021

There's already #957 open too

@kbknapp kbknapp closed this Nov 9, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants