コード例 #1
0
        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: '/');
        }
コード例 #2
0
        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));
        }