Skip to content

Commit

Permalink
tools/version.sh: fix compilation of shallow clones (#220)
Browse files Browse the repository at this point in the history
version.sh assumed that commit 16cd907
existed, this isn't true when the source tree is a shallow clone.

Tested on OpenBSD 7.6 with a few uncommitted patches to fix unrelated
compilation issues.
  • Loading branch information
guijan authored Dec 30, 2024
1 parent 389746e commit 0f94f1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ osx_bundle_sed_path="${builddir}/osx-bundle.sed"

last_svn_revision=6962
last_svn_hash="16cd907fe7482cb54a7374cd28b8501f138116be"

git_revision=$(expr $last_svn_revision + $(git rev-list --count $last_svn_hash..HEAD))
# Check if the commit exists first, it doesn't exist in shallow clones.
if [ "$(git cat-file -t $last_svn_hash 2> /dev/null)" = "commit" ]; then
git_revision=$(expr $last_svn_revision + $(git rev-list --count $last_svn_hash..HEAD))
else
git_revision=0
fi
git_version_str=$(git describe --exact-match 2> /dev/null)
installer_version='0.0.0'
resource_version='0, 0, 0'
Expand Down

0 comments on commit 0f94f1f

Please sign in to comment.