private static string GetRepositoryRelativePath([CanBeNull] string path, GitRepository repository) { if (path == null) return null; if (!Path.IsPathRooted(path)) return path; ControlFlow.Assert(PathConstruction.IsDescendantPath(repository.LocalDirectory.NotNull("repository.LocalDirectory != null"), path), $"PathConstruction.IsDescendantPath({repository.LocalDirectory}, {path})"); return PathConstruction.GetRelativePath(repository.LocalDirectory, path).Replace(oldChar: '\\', newChar: '/'); }
private static string GetRepositoryRelativePath([CanBeNull] string path, GitRepository repository) { if (path == null) { return(null); } if (!Path.IsPathRooted(path)) { return(path); } ControlFlow.Assert(PathConstruction.IsDescendantPath(repository.LocalDirectory.NotNull("repository.LocalDirectory != null"), path), $"PathConstruction.IsDescendantPath({repository.LocalDirectory}, {path})"); return(PathConstruction.GetRelativePath(repository.LocalDirectory, path)); }