Skip to content

Commit b358ce0

Browse files
arturcicCopilot
andauthored
Update src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs
Co-authored-by: Copilot <[email protected]>
1 parent 35d7418 commit b358ce0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public static void RenameRemote(this LibGit2Sharp.RemoteCollection remotes, stri
7272
{
7373
throw new InvalidOperationException($"A remote with the name '{newName}' already exists.");
7474
}
75+
if (!remotes.Any(remote => remote.Name == oldName))
76+
{
77+
throw new InvalidOperationException($"A remote with the name '{oldName}' does not exist.");
78+
}
7579
remotes.Add(newName, remotes[oldName].Url);
7680
remotes.Remove(oldName);
7781
}

0 commit comments

Comments
 (0)