René's URL Explorer Experiment


Title: Support relative worktree paths (git 2.48+ worktree.useRelativePaths) by elovelan · Pull Request #2151 · gitpython-developers/GitPython · GitHub

Open Graph Title: Support relative worktree paths (git 2.48+ worktree.useRelativePaths) by elovelan · Pull Request #2151 · gitpython-developers/GitPython

X Title: Support relative worktree paths (git 2.48+ worktree.useRelativePaths) by elovelan · Pull Request #2151 · gitpython-developers/GitPython

Description: Summary Git 2.48 introduced the worktree.useRelativePaths config option. When enabled, git worktree add writes a relative gitdir: into the worktree's .git file — relative to the directory containing that .git file. GitPython's Repo.__init__ previously passed the value of that gitdir: line straight through expand_path, which calls os.path.abspath against the process's current working directory rather than against the worktree. Using the library when the cwd was not the worktree root therefore failed. This change resolves the relative gitdir against curpath (the directory containing the .git file) before expanding. Absolute paths — i.e. the pre-2.48 default — are unaffected, because os.path.join ignores its first argument when the second is absolute. This change also includes a minor doc fix that I came across when trying to better understand how git is called. Test plan New test TestRepo.test_git_work_tree_dotgit_relative, which delegates to test_git_work_tree_dotgit but runs git worktree add --relative-paths. I verified that the test failed before implementation and now passes. Existing test_git_work_tree_dotgit still passes, confirming absolute-path worktrees are unaffected. AI disclosure Per CONTRIBUTING.md: this PR description and the commit message were drafted by Claude Code on behalf of @elovelan; though the final versions were manually reworded for clarity. All code was written without AI (didn't start that way but I didn't like its test implementation, and the actual implementation was trivial).

Open Graph Description: Summary Git 2.48 introduced the worktree.useRelativePaths config option. When enabled, git worktree add writes a relative gitdir: into the worktree's .git file — relative to the directory conta...

X Description: Summary Git 2.48 introduced the worktree.useRelativePaths config option. When enabled, git worktree add writes a relative gitdir: into the worktree's .git file — relative to the directory c...

Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/2151

X: @github

direct link

Domain: redirect.github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:694de0de-c78d-d501-cd6a-d310e922c5b5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9216:2623CE:18BFAB:22D57C:6A621AD6
html-safe-noncef65bb6208d89388b81ea2210a6c400960f7c1d50338539b3aab0e5c18bd0d48d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjE2OjI2MjNDRToxOEJGQUI6MjJENTdDOjZBNjIxQUQ2IiwidmlzaXRvcl9pZCI6Ijc2NjY4MjEwMjIzNjE5ODM3MDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac56d1b4db1c8cd9fcd7cdf291c43e78443a2da6ad1d9525703779a8c25748dd97
hovercard-subject-tagpull_request:3671415349
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/2151/files
twitter:imagehttps://avatars.githubusercontent.com/u/563397?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/563397?s=400&v=4
og:image:altSummary Git 2.48 introduced the worktree.useRelativePaths config option. When enabled, git worktree add writes a relative gitdir: into the worktree's .git file — relative to the directory conta...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonebe68eaf9abf2a202afbd94047d7200fb88b7edb0338f533bf171bbb1a69fab4e
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126087
octolytics-dimension-repository_nwogitpython-developers/GitPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126087
octolytics-dimension-repository_network_root_nwogitpython-developers/GitPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3d00b04c8874615454dfbdb32a7d2ca4db66d3f4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#start-of-content
https://redirect.github.com/
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F2151%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F2151%2Ffiles
Sign up https://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=gitpython-developers%2FGitPython
Reloadhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Reloadhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Reloadhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
gitpython-developers https://redirect.github.com/gitpython-developers
GitPythonhttps://redirect.github.com/gitpython-developers/GitPython
Please reload this pagehttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Notifications https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 983 https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5.1k https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://redirect.github.com/gitpython-developers/GitPython
Issues 15 https://redirect.github.com/gitpython-developers/GitPython/issues
Pull requests 3 https://redirect.github.com/gitpython-developers/GitPython/pulls
Discussions https://redirect.github.com/gitpython-developers/GitPython/discussions
Actions https://redirect.github.com/gitpython-developers/GitPython/actions
Security and quality 17 https://redirect.github.com/gitpython-developers/GitPython/security
Insights https://redirect.github.com/gitpython-developers/GitPython/pulse
Code https://redirect.github.com/gitpython-developers/GitPython
Issues https://redirect.github.com/gitpython-developers/GitPython/issues
Pull requests https://redirect.github.com/gitpython-developers/GitPython/pulls
Discussions https://redirect.github.com/gitpython-developers/GitPython/discussions
Actions https://redirect.github.com/gitpython-developers/GitPython/actions
Security and quality https://redirect.github.com/gitpython-developers/GitPython/security
Insights https://redirect.github.com/gitpython-developers/GitPython/pulse
Sign up for GitHub https://redirect.github.com/signup?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
Byronhttps://redirect.github.com/Byron
gitpython-developers:mainhttps://redirect.github.com/gitpython-developers/GitPython/tree/main
elovelan:relative_worktree_supporthttps://redirect.github.com/elovelan/GitPython/tree/relative_worktree_support
Conversation 9 https://redirect.github.com/gitpython-developers/GitPython/pull/2151
Commits 3 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/commits
Checks 30 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/checks
Files changed 3 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Support relative worktree paths (git 2.48+ worktree.useRelativePaths) https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#top
Show all changes 3 commits https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
c334167 fix(worktree): align with Git's gitdir resolution elovelan May 15, 2026 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/commits/c334167a41f63fe6a16090d894d3bb26332bee9b
e94ccaf support relative worktree paths (git 2.48+ worktree.useRelativePaths) elovelan May 12, 2026 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/commits/e94ccaff11ca7f4388e920bcc2ff617dd9e2a827
29c9861 doc(_call_process): correct example elovelan May 12, 2026 https://redirect.github.com/gitpython-developers/GitPython/pull/2151/commits/29c98613fd7f286786cf450ffa8a2e314f4317e7
Clear filters https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
cmd.py https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
base.py https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
test_repo.py https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
git/cmd.pyhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
View file https://redirect.github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/git/cmd.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
git/repo/base.pyhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
View file https://redirect.github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/git/repo/base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
test/test_repo.pyhttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
View file https://redirect.github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/test/test_repo.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://redirect.github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
Please reload this pagehttps://redirect.github.com/gitpython-developers/GitPython/pull/2151/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.