Skip to content

Commit

Permalink
Apply Matthias Luescher patch trevorr#38 - 'Be more careful about des…
Browse files Browse the repository at this point in the history
…troying projects'

Signed-off-by: Július Adam <adam@elcom.sk>
  • Loading branch information
abevoelker authored and JAD-SVK committed Jul 4, 2016
1 parent daa30d5 commit bcde795
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Vss2Git/VssPathMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,9 @@ public VssProjectInfo MoveProjectTo(VssItemName project, VssItemName subproject,
subprojectInfo.Parent = parentInfo;
}
}
else
else if (IsInMappedSet(newParentSpec))
{
// if resolution fails, the target project has been destroyed
// or is outside the set of projects being mapped
subprojectInfo.Destroyed = true;
}
}
Expand Down Expand Up @@ -585,6 +584,24 @@ private VssFileInfo GetOrCreateFile(VssItemName name)
return fileInfo;
}

private bool IsInMappedSet(string projectSpec)
{
if (!projectSpec.StartsWith("$/"))
{
throw new ArgumentException("Project spec must start with $/", "projectSpec");
}

foreach (var rootInfo in rootInfos.Values)
{
if (projectSpec.StartsWith(rootInfo.OriginalVssPath))
{
return true;
}
}

return false;
}

private VssProjectInfo ResolveProjectSpec(string projectSpec)
{
if (!projectSpec.StartsWith("$/"))
Expand Down

0 comments on commit bcde795

Please sign in to comment.