mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 22:17:51 +01:00
Fixes compiler crashing after completion
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SHA or branch name of the <see cref="Repo"/>'s HEAD. Requires <see cref="RepoLock"/>
|
||||
/// </summary>
|
||||
/// <param name="error"><see langword="null"/> on success, error message on failure</param>
|
||||
/// <param name="branch">If <see langword="true"/>, returns the branch name instead of the SHA</param>
|
||||
/// <param name="tracked">If <see langword="true"/>, returns the tracked branch SHA and ignores <paramref name="branch"/></param>
|
||||
/// <returns>The SHA or branch name of the <see cref="Repo"/>'s HEAD</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user