Skip to content
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

installing gitui releases from source results in a "nightly" version string by default #2254

Open
decathorpe opened this issue Jun 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@decathorpe
Copy link
Contributor

Running cargo install gitui as documented here:
https://github.com/extrawurst/gitui?tab=readme-ov-file#cargo-install

Results in gitui --version returning:
gitui nightly 2024-06-02 () (replace 2024-06-02 with the current date)

I'm also having trouble making this work sensibly for the Fedora Linux package for gitui.

I can easily set GITUI_RELEASE=1, but then the get_git_hash() function from build.rs will fail hard (with an std::io::Error: No such file or directory) if git is not installed in the build environment. And if git is available, it will either return "" (in the case where the git command fails with no output on stdout) or random garbage if there is an unrelated git repository in any of the parent directories.

Would you accept a PR that adapted build.rs to work better in more cases, for example, when git is not available?

@decathorpe decathorpe added the bug Something isn't working label Jun 2, 2024
@extrawurst
Copy link
Owner

extrawurst commented Jun 3, 2024

please checkout #2187 and the newly introduced BUILD_GIT_COMMIT_ID env var. does this not solve the issue of building from source without git?

the cargo install gitui problem to turning out with a nightly version string is a bit tricky. not sure if this can be fixed. maybe I have to reverse and pick the cargo package version by default and set nightly via env

@decathorpe
Copy link
Contributor Author

decathorpe commented Jun 3, 2024

please checkout #2187 and the newly introduced BUILD_GIT_COMMIT_ID env var. does this not solve the issue of building from source without git?

This would work. However, I don't want to introduce another manual step into the process of updating our packages. I'd have to look up the commit hash that corresponds to the tagged release for every new release, and I can't automate that. I could set BUILD_GIT_COMMIT_ID to some garbage data, but that would just end up as garbage in gitui --version :(

If the git commit hash cannot be determined, maybe it would be better to just exclude it from the format string? i.e. something like

if let Some(hash) = commit_hash {
    format!("{} {} ({})", gitui_version, source_date, hash)
} else {
    format!("{} {}", gitui_version, source_date)
}

the cargo install gitui problem to turning out with a nightly version string is a bit tricky. not sure if this can be fixed. maybe I have to reverse and pick the cargo package version by default and set nightly via env

Yeah, I'm not sure how to fix this either. Maybe set the version string to "nightly" only if the git commit hash can be determined and GITUI_RELEASE is not set? That way a build from git could be made a "release" build, but builds from git would be "nightly" by default. I think you already set GITUI_RELEASE in your github workflows, so those would not be affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants