Skip to content

Commit 64dc437

Browse files
arturcicCopilot
andauthored
Update src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 520d23d commit 64dc437

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public static void DumpGraph(this IRepository repository, Action<string>? writer
6868
public static void RenameRemote(this LibGit2Sharp.RemoteCollection remotes, string oldName, string newName)
6969
{
7070
if (oldName.IsEquivalentTo(newName)) return;
71+
if (remotes.Any(remote => remote.Name == newName))
72+
{
73+
throw new InvalidOperationException($"A remote with the name '{newName}' already exists.");
74+
}
7175
remotes.Add(newName, remotes[oldName].Url);
7276
remotes.Remove(oldName);
7377
}

0 commit comments

Comments
 (0)