diff --git a/TGS.Server/Instance/Compiler.cs b/TGS.Server/Instance/Compiler.cs
index 19d1ce2237..0ed5d2881b 100644
--- a/TGS.Server/Instance/Compiler.cs
+++ b/TGS.Server/Instance/Compiler.cs
@@ -371,7 +371,7 @@ namespace TGS.Server
deleteExcludeList.Add(".git");
Helpers.CopyDirectory(RelativePath(RepoPath), resurrectee, deleteExcludeList);
- CurrentSha = GetHead(false, out string error);
+ CurrentSha = GetShaOrBranchNoLock(out string error, false, false);
//just the tip
const string GitLogsDir = "/.git/logs";
Helpers.CopyDirectory(RelativePath(RepoPath + GitLogsDir), resurrectee + GitLogsDir);
diff --git a/TGS.Server/Instance/Repository.cs b/TGS.Server/Instance/Repository.cs
index 3f93681b5b..76cb247190 100644
--- a/TGS.Server/Instance/Repository.cs
+++ b/TGS.Server/Instance/Repository.cs
@@ -418,26 +418,38 @@ namespace TGS.Server
error = "Repo is busy!";
return null;
}
- var result = LoadRepo();
- if (result != null)
- {
- error = result;
- return null;
- }
-
- try
- {
- error = null;
- if (tracked && Repo.Head.TrackedBranch != null)
- return Repo.Head.TrackedBranch.Tip.Sha;
- return branch ? Repo.Head.FriendlyName : Repo.Head.Tip.Sha;
- }
- catch (Exception e)
- {
- error = e.ToString();
- return null;
- }
+ return GetShaOrBranchNoLock(out error, branch, tracked);
}
+ }
+
+ ///
+ /// Gets the SHA or branch name of the 's HEAD. Requires
+ ///
+ /// on success, error message on failure
+ /// If , returns the branch name instead of the SHA
+ /// If , returns the tracked branch SHA and ignores
+ /// The SHA or branch name of the 's HEAD
+ string GetShaOrBranchNoLock(out string error, bool branch, bool tracked)
+ {
+ var result = LoadRepo();
+ if (result != null)
+ {
+ error = result;
+ return null;
+ }
+
+ try
+ {
+ error = null;
+ if (tracked && Repo.Head.TrackedBranch != null)
+ return Repo.Head.TrackedBranch.Tip.Sha;
+ return branch ? Repo.Head.FriendlyName : Repo.Head.Tip.Sha;
+ }
+ catch (Exception e)
+ {
+ error = e.ToString();
+ return null;
+ }
}
///