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: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f87d9804-b3a7-e428-0a23-a9d11a4d91b0
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD068:2CDA4:8011AF:8398AA:6A59EE68
html-safe-nonce9f8b39558daa4eba68f420aab05a5ec3032dea0850eb252e6424d731801cf75d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDY4OjJDREE0OjgwMTFBRjo4Mzk4QUE6NkE1OUVFNjgiLCJ2aXNpdG9yX2lkIjoiNzkyMjE0NDY1MTg3NjM2Mzg4MCIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9
visitor-hmacaaafe0d94752c29d0cada545a85c0540158ef6ec9752a4473b89ce8bf3160f20
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
Noneba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353
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
release32bf0b7849e1b6561059cca2cb03568251960859
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/GitPython/pull/2151/files#start-of-content
https://github.com/
Sign in https://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
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F2151%2Ffiles
Sign up https://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://github.com/gitpython-developers/GitPython/pull/2151/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/2151/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/2151/files
gitpython-developers https://github.com/gitpython-developers
GitPythonhttps://github.com/gitpython-developers/GitPython
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/2151/files
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 982 https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5.1k https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://github.com/gitpython-developers/GitPython
Issues 164 https://github.com/gitpython-developers/GitPython/issues
Pull requests 9 https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security and quality 12 https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Code https://github.com/gitpython-developers/GitPython
Issues https://github.com/gitpython-developers/GitPython/issues
Pull requests https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security and quality https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Sign up for GitHub https://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://github.com/login?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
Byronhttps://github.com/Byron
gitpython-developers:mainhttps://github.com/gitpython-developers/GitPython/tree/main
elovelan:relative_worktree_supporthttps://github.com/elovelan/GitPython/tree/relative_worktree_support
Conversation 9 https://github.com/gitpython-developers/GitPython/pull/2151
Commits 3 https://github.com/gitpython-developers/GitPython/pull/2151/commits
Checks 30 https://github.com/gitpython-developers/GitPython/pull/2151/checks
Files changed 3 https://github.com/gitpython-developers/GitPython/pull/2151/files
Support relative worktree paths (git 2.48+ worktree.useRelativePaths) https://github.com/gitpython-developers/GitPython/pull/2151/files#top
Show all changes 3 commits https://github.com/gitpython-developers/GitPython/pull/2151/files
c334167 fix(worktree): align with Git's gitdir resolution elovelan May 15, 2026 https://github.com/gitpython-developers/GitPython/pull/2151/commits/c334167a41f63fe6a16090d894d3bb26332bee9b
e94ccaf support relative worktree paths (git 2.48+ worktree.useRelativePaths) elovelan May 12, 2026 https://github.com/gitpython-developers/GitPython/pull/2151/commits/e94ccaff11ca7f4388e920bcc2ff617dd9e2a827
29c9861 doc(_call_process): correct example elovelan May 12, 2026 https://github.com/gitpython-developers/GitPython/pull/2151/commits/29c98613fd7f286786cf450ffa8a2e314f4317e7
Clear filters https://github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/2151/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/2151/files
cmd.py https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
base.py https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
test_repo.py https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
git/cmd.pyhttps://github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
View file https://github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/git/cmd.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-35a18a749eb4d6efad45e56e78a9554926be5526e2ba2159b44311e718450e88
git/repo/base.pyhttps://github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
View file https://github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/git/repo/base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-3cc1aaf2f1e2bc1341d3f71ceec44b2762b981280b4d162e26327bd558721fe1
test/test_repo.pyhttps://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
View file https://github.com/elovelan/GitPython/blob/29c98613fd7f286786cf450ffa8a2e314f4317e7/test/test_repo.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/2151/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
https://github.com/gitpython-developers/GitPython/pull/2151/files#diff-f50d635cf31b095a03b42fc1a73681a9c4025bbeb58b81e72588ba37e00cff87
Please reload this pagehttps://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.