Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use filepath functions for path manipulation in getGitRepositorySubdir #177

Merged
merged 3 commits into from
Sep 22, 2023

Commits on Sep 4, 2023

  1. Use filepath functions for path manipulation in getGitRepositorySubdir

    Before this commit, the root directory would be removed which leaves a
    trailing file separator character in the beginning. This would then be trimmed
    by using strings.TrimPrefix. The problem here is that it uses a hardcoded
    file separator character which won't work on Windows because
    Windows uses a backslash instead of a forward slash.
    
    Using filepath.Rel to get the directory relative to the root directory
    will not leave a separator character in the beginning.
    
    It's also important to use filepath.ToSlash which will translate every
    file separator character to the forward slash.
    
    This commit makes discovery work on Windows which it didn't before.
    JeffreyVdb committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    2c753b0 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2023

  1. Translate . from filepath.Rel into empty string

    Rel returns . when the directory is the same as the base directory.
    We can easily translate that to the empty string which is what we're
    looking for.
    JeffreyVdb committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    73a2642 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2023

  1. Prevent endless loop by checking result of filepath.Dir

    filepath.Dir will return the same result when you're calling it on the
    root directory of your filesystem. Checking when this happens is
    required so that you break out of your loop.
    
    This code used to loop endlessly when called outside of a git repo.
    This commit fixes that.
    JeffreyVdb committed Sep 13, 2023
    Configuration menu
    Copy the full SHA
    cff5ec0 View commit details
    Browse the repository at this point in the history