Skip to content

Commit

Permalink
More git test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Sep 21, 2024
1 parent 39273ff commit 54f36e2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Synthesis.Bethesda.UnitTests/RepoTestUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ public TempFolder GetRepository(
LibGit2Sharp.Commands.Stage(localRepo, AFile);
var sig = Signature;
localRepo.Commit("Initial commit", sig, sig);

var defaultBranch = localRepo.Branches.First();
if (defaultBranch.FriendlyName != DefaultBranch)
{
var dev = localRepo.Branches.Add(DefaultBranch, localRepo.Head.Tip);
localRepo.Branches.Remove(defaultBranch);
defaultBranch = dev;
}

if (createPatcherFiles)
{
var files = new CreateSolutionFile(IFileSystemExt.DefaultFilesystem, new ExportStringToFile()).Create(Path.Combine(local, SlnPath))
Expand All @@ -56,16 +63,11 @@ public TempFolder GetRepository(
}

var remoteRef = localRepo.Network.Remotes.Add("origin", remote);
var master = localRepo.Branches.First();
localRepo.Branches.Update(
master,
defaultBranch,
b => b.Remote = remoteRef.Name,
b => b.UpstreamBranch = master.CanonicalName);
localRepo.Network.Push(master);
if (master.FriendlyName != DefaultBranch)
{
localRepo.Branches.Add("dev", localRepo.Head.Tip);
}
b => b.UpstreamBranch = defaultBranch.CanonicalName);
localRepo.Network.Push(defaultBranch);

return folder;
}
Expand Down

0 comments on commit 54f36e2

Please sign in to comment.