GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Keep bare-repository worktrees non-bare by Byron · Pull Request #2224 · gitpython-developers/GitPython

Keep bare-repository worktrees non-bare #2224

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.

Sign up for GitHub

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

Merged
Byron merged 2 commits into main from worktree-from-bare
Sep 1, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Keep bare-repository worktrees non-bare #2224

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
180b1ff
fix: keep bare-repository worktrees non-bare (#2223)
Byron Sep 1, 2026
0e8c23c
ci: restore Cygwin virtual environments on Python 3.9
Byron Sep 1, 2026
File filter
Filter by extension


Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

7 changes: 5 additions & 2 deletions 7 .github/workflows/cygwin-test.yml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Install Cygwin
uses: cygwin/cygwin-install-action@v6
with:
packages: git python39 python-pip-wheel python-setuptools-wheel python-wheel-wheel
packages: curl git python39 python-setuptools-wheel
add-to-path: false # No need to change $PATH outside the Cygwin environment.

- name: Arrange for verbose output
Expand Down Expand Up @@ -73,12 +73,15 @@ jobs:

- name: Set up virtual environment
run: |
pip_wheel=/usr/share/python-wheels/pip-26.0.1-py3-none-any.whl
curl -fsSLo "$pip_wheel" https://files.pythonhosted.org/packages/de/f0/c81e05b613866b76d2d1066490adf1a3dbc4ee9d9c839961c3fc8a6997af/pip-26.0.1-py3-none-any.whl
python3.9 -c 'import hashlib, pathlib, sys; assert hashlib.sha256(pathlib.Path(sys.argv[1]).read_bytes()).hexdigest() == sys.argv[2]' "$pip_wheel" bdb1b08f4274833d62c1aa29e20907365a2ceb950410df15fc9521bad440122b
python3.9 -m venv .venv
echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"

- name: Update PyPA packages
run: |
python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel
python -m pip install -U 'setuptools; python_version<"3.12"' wheel

- name: Install project and test dependencies
run: |
Expand Down
4 changes: 4 additions & 0 deletions 4 git/repo/base.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ def __init__(
# Let's not assume the option exists, although it should.
pass

# A linked worktree is not bare even when its main repository is.
if self._bare and self._working_tree_dir and osp.isfile(osp.join(self.git_dir, "commondir")):
self._bare = False

# Adjust the working directory in case we are actually bare - we didn't know
# that in the first place.
if self._bare:
Expand Down
17 changes: 17 additions & 0 deletions 17 test/test_repo.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,23 @@ def test_git_work_tree_dotgit(self, rw_dir, use_relative_paths=False):

self.assertIsInstance(repo.heads["aaaaaaaa"], Head)

@with_rw_directory
def test_git_work_tree_from_bare_repo(self, rw_dir):
if Git().version_info[:3] < (2, 5, 1):
pytest.skip("worktree feature unsupported, needs git 2.5.1 or later")

bare_repo = self.rorepo.clone(join_path_native(rw_dir, "bare_repo"), bare=True)
worktree_path = join_path_native(rw_dir, "worktree_repo")
if Git.is_cygwin():
worktree_path = cygpath(worktree_path)
bare_repo.git.worktree("add", "--detach", worktree_path)
Comment thread
Copilot marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


repo = Repo(worktree_path)

assert Git(worktree_path).rev_parse("--is-bare-repository") == "false"
assert not repo.bare
assert osp.samefile(repo.working_tree_dir, worktree_path)

def test_git_work_tree_dotgit_relative(self):
"""Check that we find .git as a worktree file containing a relative path
and find the worktree based on it."""
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.