Skip to content

Commit f2b3702

Browse files
Fix regex for git short hashes (#1872)
Follow up of #1871. Git short hashes can be longer than 7 characters, see the [“Short SHA-1” section of the git docs](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection). That’s relevant in our Pro repo, as you can [see in our latest build](https://app.circleci.com/pipelines/github/tiny-pilot/tinypilot-pro/4799/workflows/4ed6c793-a8f1-458e-b29c-434005e5ae0f/jobs/50173), where the output of `git describe --tags --long` yields `2.7.0-rc.4-5-g0bfe1e1f`, i.e. with 8 characters following the `-g`. Therefore, the regex replacement didn’t match. Contrary to [my assumption about config protection](tiny-pilot/tinypilot-pro#1475 (comment)) ([which wasn’t correct](tiny-pilot/tinypilot-pro#1475 (comment))), this seems to be the actual reason why the change didn’t have any effect in the PR build. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1872"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> Co-authored-by: Jan Heuermann <jan@jotaen.net>
1 parent 41e4dea commit f2b3702

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

dev-scripts/build-debian-pkg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ EOF
2727

2828
print_tinypilot_version() {
2929
# Format build hash suffix according to SemVer (`-ghhhhhhh` -> `+hhhhhhh`).
30+
# Note that git short hashes are variable in length, so they can contain more
31+
# than 7 characters, depending of the overall number of commits.
3032
git describe --tags --long |
31-
sed --expression 's/\(-g\([0-9a-f]\{7\}\)\)$/+\2/g'
33+
sed --expression 's/\(-g\([0-9a-f]\{7,\}\)\)$/+\2/g'
3234
}
3335

3436
# Parse command-line arguments.

0 commit comments

Comments
 (0)