tests(git-provider): Add duplicated repo registration test

This commit is contained in:
Scott 2026-08-21 16:31:22 +10:00
commit 30e103f021
2 changed files with 28 additions and 2 deletions

View file

@ -138,8 +138,15 @@ public class GitManager
// we add it to the relevant dictionary
if (directorySegmentsFromName.Count == 0)
{
FullRepositoryPath = absoluteRepositoryLocation;
return this;
// If this is a new registration, set the FullRepositoryPath and return, otherwise we've got a duplicate
// entry and we throw
if (FullRepositoryPath == null)
{
FullRepositoryPath = absoluteRepositoryLocation;
return this;
}
throw new Exception($"Registration already exists for {InternalPath}");
}
var nextSegment = directorySegmentsFromName.Peek();