Fixes compiler crashing after completion

This commit is contained in:
Cyberboss
2017-11-15 02:28:05 -05:00
parent 942ae93586
commit 9acf4f1b4f
2 changed files with 32 additions and 20 deletions
+1 -1
View File
@@ -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);
+31 -19
View File
@@ -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 />