diff --git a/src/Utils/Utilities.cs b/src/Utils/Utilities.cs
index 143a91fb..293bf468 100644
--- a/src/Utils/Utilities.cs
+++ b/src/Utils/Utilities.cs
@@ -26,6 +26,9 @@ public static class Utilities
/// StableSwarmUI's current version.
public static readonly string Version = Assembly.GetEntryAssembly()?.GetName().Version.ToString();
+ /// Current git commit (if known -- empty if unknown).
+ public static string GitCommit = "";
+
/// Used by linked pages to prevent cache errors when data changes.
public static string VaryID = Version;
@@ -39,6 +42,11 @@ public static class Utilities
static Utilities()
{
+ if (File.Exists("./.git/refs/heads/master"))
+ {
+ GitCommit = File.ReadAllText("./.git/refs/heads/master").Trim()[0..8];
+ VaryID += ".GIT-" + GitCommit;
+ }
for (int i = 0; i <= 9; i++)
{
ReservedFilenames.Add($"com{i}");