Skip to content

fix: Recognize relative worktrees extension#7254

Merged
ethomson merged 1 commit into
libgit2:mainfrom
cwill747:fix/relative-worktrees-extension
May 12, 2026
Merged

fix: Recognize relative worktrees extension#7254
ethomson merged 1 commit into
libgit2:mainfrom
cwill747:fix/relative-worktrees-extension

Conversation

@cwill747
Copy link
Copy Markdown
Contributor

@cwill747 cwill747 commented May 8, 2026

Git supports relative worktrees since Git v2.48 - https://github.com/git/git/blob/cf6f63ea6bf35173e02e18bdc6a4ba41288acff9/Documentation/RelNotes/2.48.0.adoc?plain=1#L57

This was already handled programatically in libgit2, but was not recognized as an extension, meaning downstream consumers like Nix had issues with relative worktree-enabled repos.

Fixes #7210

Git supports relative worktrees since Git v2.48 - https://github.com/git/git/blob/cf6f63ea6bf35173e02e18bdc6a4ba41288acff9/Documentation/RelNotes/2.48.0.adoc?plain=1#L57

This was already handled programatically in libgit2, but was
not recognized as an extension, meaning downstream consumers
like Nix had issues with relative worktree-enabled repos.

Fixes libgit2#7210
@ethomson
Copy link
Copy Markdown
Member

Really helpful, thanks for this. Should we turn off relative worktree support if this isn't specified? 🤔 I'm curious what git does here.

@cwill747
Copy link
Copy Markdown
Contributor Author

Really helpful, thanks for this. Should we turn off relative worktree support if this isn't specified? 🤔 I'm curious what git does here.

Should be fine - git doesn't even check for this flag when resolving worktree paths - it resolves the paths (just like libgit2 does). The extension is for older versions to just refuse to deal with the repo if it doesn't understand it (what happened with nix) - https://github.com/git/git/blob/94f057755b7941b321fd11fec1b2e3ca5313a4e0/worktree.c#L158-L162

@ethomson
Copy link
Copy Markdown
Member

Makes sense; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libgit2 doesn't support relative worktrees (as per git >= 2.48)

2 participants