Support relative worktree paths (git 2.48+ worktree.useRelativePaths) by elovelan · Pull Request #2151 · gitpython-developers/GitPython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git/cmd.py
3 changes: 2 additions & 1 deletion git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def __init__(
sm_gitpath = find_worktree_git_dir(dotgit)

if sm_gitpath is not None:
git_dir = expand_path(sm_gitpath, expand_vars)
# worktrees can use relative paths as of Git 2.48, so we join to curpath
git_dir = osp.normpath(osp.join(curpath, sm_gitpath))
self._working_tree_dir = curpath
break

Expand Down
17 changes: 15 additions & 2 deletions test/test_repo.py
Loading