Skip to content

Commit bcde795

Browse files
abevoelkerJAD-SVK
authored andcommitted
Apply Matthias Luescher patch trevorr#38 - 'Be more careful about destroying projects'
Signed-off-by: Július Adam <[email protected]>
1 parent daa30d5 commit bcde795

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Vss2Git/VssPathMapper.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,9 @@ public VssProjectInfo MoveProjectTo(VssItemName project, VssItemName subproject,
547547
subprojectInfo.Parent = parentInfo;
548548
}
549549
}
550-
else
550+
else if (IsInMappedSet(newParentSpec))
551551
{
552552
// if resolution fails, the target project has been destroyed
553-
// or is outside the set of projects being mapped
554553
subprojectInfo.Destroyed = true;
555554
}
556555
}
@@ -585,6 +584,24 @@ private VssFileInfo GetOrCreateFile(VssItemName name)
585584
return fileInfo;
586585
}
587586

587+
private bool IsInMappedSet(string projectSpec)
588+
{
589+
if (!projectSpec.StartsWith("$/"))
590+
{
591+
throw new ArgumentException("Project spec must start with $/", "projectSpec");
592+
}
593+
594+
foreach (var rootInfo in rootInfos.Values)
595+
{
596+
if (projectSpec.StartsWith(rootInfo.OriginalVssPath))
597+
{
598+
return true;
599+
}
600+
}
601+
602+
return false;
603+
}
604+
588605
private VssProjectInfo ResolveProjectSpec(string projectSpec)
589606
{
590607
if (!projectSpec.StartsWith("$/"))

0 commit comments

Comments
 (0)