GitVersion.sh: Make script simpler and more portable#416
Open
d97jro wants to merge 1 commit intoDrive-Trust-Alliance:masterfrom
Open
GitVersion.sh: Make script simpler and more portable#416d97jro wants to merge 1 commit intoDrive-Trust-Alliance:masterfrom
d97jro wants to merge 1 commit intoDrive-Trust-Alliance:masterfrom
Conversation
- No need to use bash for simple script, more portable with /bin/sh when the content is POSIX anyway - Use command instead of which and string comparison to see if git executable exists - Do not double quote static strings - Use contemporary $() instead of deprecated backtick syntax Signed-off-by: Joakim Roubert <joakim.roubert@gmail.com>
scottcmarks
reviewed
Jun 16, 2025
Contributor
scottcmarks
left a comment
There was a problem hiding this comment.
This results in a borked GIT_VERSION if git is installed but the sedutil-cli version is in fact downloaded from a tarball instead of being cloned. A more correct sh version would be something like this:
"#define GIT_VERSION \"$(command -v git >/dev/null && git describe --dirty 2>/dev/null || echo tarball)\""
so that GIT_VERSION is defined to be tarball when git describe --dirty fails, which will happen if there is no .git subfolder because it was not cloned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Signed-off-by: Joakim Roubert joakim.roubert@gmail.com