-
Notifications
You must be signed in to change notification settings - Fork 899
Add support for worktrees #1607
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
Add support for worktrees #1607
Conversation
Damn, did I forget to commit some test resources? It all runs fine locally :) I will check. |
Thanks @mminns! Looks like that might be the case, but I'm eager to have worktree support. :D |
6a24e12
to
05e0283
Compare
There were some files making up part of the test repository that were being gitignored, thought I'd added them all in now, but it looks like not quite.... back to the drawing board... |
Ah despite all the red, some progress. AFAICS the tests
Although maybe I should have checked the LEAKING before opening the PR :) |
Hey, guys! I'm currently working on a solution that would highly benefit from this feature, if you need some help, please, let me know! |
I think I finally sorted out the LEAK stuff.... fingers crossed 🤞 |
1 step forward
|
While I fix up the remaining build, if anyone has any comments about the way I've exposed the functionality let me know. I took the submodules work as a starting point and it seems to work OK, but I'm open to any suggestions. |
Ah I left the LEAK constants defined in the csproj, rookie error. |
Yes! 1 green, 2 to go. 👍 |
Hi Ok, I seem to have fixed up the tests and the leaks, but I am at a loss about the Azure Build errors 2018-09-28T10:36:32.3866704Z ##[error]TF400813: The user '4180bb58-415f-47d4-955f-53f0887f795e' is not authorized to access this resource. The error seems to be re-produced in other PRs |
In which case please let let rip on the code review itself ... 😰 👍 |
Hi @mminns! Thank you for working on this feature! Alternatively, when getting a worktree reference and the worktree repository is not valid, it should not throw an exception. The worktree repository should simply be invalid. |
@mminns ; there is also a problem I see in the last version (after the leaks fix) - I'm getting an AccessViolationException at LibGit2Sharp.Core.NativeMethods.git_worktree_lookup(git_worktree*& reference, git_repository* repo, String name) I have compiled your version for .Net Framework 4.7.2 and I'm debugging this in Visual Studio 2015 so it might be just something specific to this combination. |
@dusan-tkac thanks for the feedback, I've not seen the AccessViolation but let me know if you find anything more, and yes that is a good usecase catch when deleting the worktree outside of libgit, I'll have a think |
@mminns , the problem was on my side. I was accessing worktree.WorktreeRepository outside of the "using" block of the worktree parent repository. |
Not forgotten about this, planning to look into the pruning a deleted worktree issue asap, once the day job calms down. |
@dusan-tkac I've corrected the pruning, just need to rebase again.... |
…y fragile. In real life they will use absolute paths, but luckily they do work with relative paths, but they have a habit of getting re-written as soon as you use Git to inspect the repository
…cross-platform compatible
…ixed test data to correctly reference the worktree's working directories
82e42a0
to
bd98667
Compare
so that rebase broke all the things.... |
OK, some progress again, tests passing again, 1 memory leak to fix. |
OK, I think that is as green as the builds will get. 👍 FWIW this PR does not include the ability to specify the target branch etc when opening a Worktree as that option, libgit2/libgit2@a22f19e, wasn't available in the native libgit2 when I started writing this. Personally I do need that functionality so I intend to add it in a follow up PR, but I'd rather try and get this merged first if possible. Although I am open to suggestions on that order of event. 😄 |
I'd say we should release this PR as it is if everyone is happy with that, then we put another one for the improvement. |
Hi @ethomson what happens next, if anything, with this? |
Hi @ all, When this PR will be merged and released in the nuget package? |
Sorry for the delay in reviewing this @mminns - this is a great PR. Thanks so much for tackling this! I have just a few questions. 😀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only questions are around the csproj
changes - I'm not sure if they're intentional or if Visual Studio just added them itself (it does that sometimes). If they are intentional, could you help me understand what they do? And if they're not can we roll them back? Otherwise, this is an amazing pull request.
LibGit2Sharp/LibGit2Sharp.csproj
Outdated
@@ -34,6 +41,10 @@ | |||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> | |||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | |||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand what this is...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
LibGit2Sharp/LibGit2Sharp.csproj
Outdated
<Compile Update="Core\Handles\Objects.cs" DependentUpon="Objects.tt"> | ||
<DesignTime>True</DesignTime> | ||
<AutoGen>True</AutoGen> | ||
</Compile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this changed - is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Thanks for getting back to me, and good questions. I fairly sure they can be reverted but I'll clarify in the next few days. |
Hi, I know everyone is busy, but just checking in to see what the state of play is with this @ethomson ? Enjoy the holidays everyone. |
Cool, thanks for adding this @mminns! |
See #1471 for more details.
Adds wrappers and tests for the current worktree implementation in libgit2.
This is my first PR for libgit2, please pull apart and point out anything that should be done differently 👍