Skip to content

Commit

Permalink
add current git commit to vary id to improve cache dodge on update
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 16, 2023
1 parent 9680c26 commit 5724d0f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Utils/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static class Utilities
/// <summary>StableSwarmUI's current version.</summary>
public static readonly string Version = Assembly.GetEntryAssembly()?.GetName().Version.ToString();

/// <summary>Current git commit (if known -- empty if unknown).</summary>
public static string GitCommit = "";

/// <summary>Used by linked pages to prevent cache errors when data changes.</summary>
public static string VaryID = Version;

Expand All @@ -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}");
Expand Down

0 comments on commit 5724d0f

Please sign in to comment.