Repository navigation
Conversation
Since 2.0, a working tree whose .git is a file pointing to its git directory opens: a linked worktree, a submodule, or a clone with --separate-git-dir. Only linked worktrees had a test, and the file was read unlike git: - the "\r" of a file written on Windows stayed in the path, which then didn't exist; - "gitdir: " was accepted on any line, where git requires it first; - a NUL byte in the path made realpath() throw a ValueError, which isn't an exception of gitlib; - a file that can't be read, without permission for instance, was reported as one that doesn't point to a git directory. Both drivers read the file like git. A submodule, whose .git file holds a relative path, and a clone with --separate-git-dir, whose one holds an absolute path, have tests. Fixes #200. Co-authored-by: Chris Stretton <chriss@datainterconnect.co.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #201, and fixes #200.
#201 proposed in 2023 to open a working tree whose
.gitis a file pointing to its git directory. 2.0 does it since #253, for linked worktrees, submodules and clones with--separate-git-dir, but only linked worktrees had a test, and some issues of the review of #201 were still there.RepositoryPathsnow reads the file like git:\rof a file written on Windows stayed in the path, which then didn't exist;gitdir:was accepted on any line, where git requires it first;realpath()throw aValueError, which isn't an exception of gitlib;Tests
.gitfile holds a relative path, the case of No support for git submodules #200, and a clone with--separate-git-dir, whose.gitfile holds an absolute path, the case of Separate git directory support #201: they open with both drivers.The commit credits @chris114782, whose PR started it. Thanks!