test: cover subdirectory discovery and pathspec commands in bare-repository worktrees by christianvuerings · Pull Request #2228 · gitpython-developers/GitPython · GitHub
Skip to content

test: cover subdirectory discovery and pathspec commands in bare-repository worktrees - #2228

Open
christianvuerings wants to merge 2 commits into
gitpython-developers:mainfrom
christianvuerings:test-bare-worktree-subdir-discovery
Open

test: cover subdirectory discovery and pathspec commands in bare-repository worktrees#2228
christianvuerings wants to merge 2 commits into
gitpython-developers:mainfrom
christianvuerings:test-bare-worktree-subdir-discovery

Conversation

@christianvuerings

Copy link
Copy Markdown

Follow-up to #2223 / #2224, which fixed Repo treating a linked worktree of a bare repository as bare. The existing regression test checks repo.bare and working_tree_dir when Repo() is opened on the worktree root. This adds the two steps that actually broke for us in 3.1.61 and are not exercised yet:

  1. discovery from a subdirectory with search_parent_directories=True (how tools such as mkdocs-git-revision-date-localized-plugin open the repo), asserting working_dir is the worktree rather than the bare common dir;

  2. running a git command with an absolute pathspec through repo.git, which on 3.1.61 failed with:

    fatal: '<worktree>/docs' is outside repository at '<bare_repo>/.'
    

Our CI checks every job out as a linked worktree of a shared bare repository (git --git-dir=<bare> worktree add <job-dir> <sha>), so this was the shape that took down our documentation builds when the build image picked up 3.1.61. The new assertions pass on main (with 180b1ff) and fail on 3.1.61.

No behavior change; test only.

@christianvuerings
christianvuerings marked this pull request as ready for review September 6, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants