fix BuildInfo without a tag

This commit is contained in:
sam 2024-05-20 17:40:25 +02:00
parent 9036c5a148
commit 41e4dda7b4
2 changed files with 3 additions and 1 deletions

View file

@ -12,11 +12,13 @@ public static class BuildInfo
using var reader = new StreamReader(stream);
var data = (await reader.ReadToEndAsync()).Trim().Split("\n");
if (data.Length < 3) return;
Hash = data[0];
var dirty = data[2] == "dirty";
var versionData = data[1].Split("-");
if (versionData.Length < 3) return;
Version = versionData[0];
if (versionData[1] != "0" || dirty) Version += $"+{versionData[2]}";
if (dirty) Version += ".dirty";

View file

@ -1,4 +1,4 @@
#!/bin/sh
(git rev-parse HEAD &&
git describe --tags --long &&
git describe --tags --always --long &&
if test -z "$(git ls-files --exclude-standard --modified --deleted --others)"; then echo clean; else echo dirty; fi) > ../.version