Skip to content

Review logic of GetIsGitRepo() #24

Description

@mrtrizer
        async Task<bool> GetIsGitRepo()
        {
            var result = await RunGit("rev-parse --show-toplevel", true);
            if (result.ExitCode != 0 || string.IsNullOrEmpty(result.Output))
                return false;

            // This check doesn't cover cases where Assets dir is a git repo, or a project is within a bigger repo
            // I also got feedback that this code is hard to read, probably need to add a comment or refactor it
            return Path.GetFullPath(result.Output.Trim()) != Directory.GetCurrentDirectory() || Path.GetFullPath(PhysicalPath) == Path.GetFullPath(Application.dataPath);
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions