fix(formatter): guard ShortenID/SmallSHA against short input

ShortenID and SmallSHA sliced their input to a fixed length without
checking it was long enough, panicking on shorter strings. Return the
input unchanged when it is already shorter than the cut. Also replace the
blank Commit placeholder with an explicit "unknown-commit" sentinel.

(cherry picked from commit eeb4ea8b9c)
This commit is contained in:
Linus Gasser
2026-11-20 17:04:49 +01:00
parent 6fc26afad6
commit 2f0f3880e6
+1 -1
View File
@@ -16,7 +16,7 @@ func main() {
Version = "dev"
}
if Commit == "" {
Commit = " "
Commit = "unknown-commit"
}
cli.Run(Version, Commit)