Ejemplo n.º 1
0
        public GitStatusEntry CreateGitStatusEntry(string path, GitFileStatus indexStatus, GitFileStatus workTreeStatus = GitFileStatus.None, string originalPath = null)
        {
            var absolutePath = new NPath(path).MakeAbsolute();
            var relativePath = absolutePath.RelativeTo(environment.RepositoryPath);
            var projectPath  = absolutePath.RelativeTo(environment.UnityProjectPath);

            return(new GitStatusEntry(relativePath, absolutePath, projectPath, indexStatus, workTreeStatus, originalPath?.ToNPath()));
        }
Ejemplo n.º 2
0
        public static NPath GetRepositoryPath(this IEnvironment environment, NPath path)
        {
            Guard.ArgumentNotNull(path, nameof(path));

            NPath projectPath    = environment.UnityProjectPath;
            NPath repositoryPath = environment.RepositoryPath;

            if (projectPath == repositoryPath)
            {
                return(path);
            }

            if (repositoryPath.IsChildOf(projectPath))
            {
                throw new InvalidOperationException($"RepositoryPath:\"{repositoryPath}\" should not be child of ProjectPath:\"{projectPath}\"");
            }

            return(projectPath.RelativeTo(repositoryPath).Combine(path));
        }