-
Notifications
You must be signed in to change notification settings - Fork 889
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.
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
Repository.Worktrees.Add leaves now worktree empty #2037
Comments
Is there any update on this issue? |
I forked LibGit2 repo and I found why the worktree is creating an empty folder (only .git file) and it is because current code does not contain the checkout_strategy is GIT_CHECKOUT_NONE when it was GIT_CHECKOUT_FORCE in version 02.26.2 (latest version that it works fine). This version is from 12/11/2019 and the image below is a diff between commits 5d5b76df (Committed by @ethomson on 24/06/2019 16:00:41) and latest commit 85f5aec1 (Committed by @ethomson on 05/03/2024 10:44:16). Any reason for this change? There are two options to fix it.
|
Thanks for the investigation @enriqueraso - this needs a fix in LibGit2Sharp. |
(IIUC that is - I think that the default opts structure for worktrees is wrong.) |
@ethomson ok, I will create a PR for it |
Somewhere in the 0.27.0-preview-0182 to 0.27.2 range, LibGit2Sharp broke creation of work trees.
Reproduction steps
Given a
Repository
object that points to a valid git repo with at least 2 commits in its history,call
Repository.Worktrees.Add("HEAD~1", "myworktree", "../somePath", isLocked: false);
See this test method for a full repro.
Expected behavior
The worktree directory is created with a
.git
file and all files from the ref/commit that was specified when it was created.Actual behavior
The worktree directory is created with a
.git
file in it, but otherwise it is empty.Version of LibGit2Sharp (release number or SHA1)
0.27.0-preview-0182
Operating system(s) tested; .NET runtime tested
Windows
Fails on .NET Framework 4.8 and .NET 7.
The text was updated successfully, but these errors were encountered: