-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
nbgv prepare-release fails with LibGit2SharpException: could not rmdir #886
Comments
I have no idea why nbgv prepare-release would ever delete version.json, much less your |
Yeah I also don't know why it's trying to delete my whole repo! Here are repro steps, although I don't think this adds anything to my original report since it's a very vanilla setup.
|
I'm having the exact same problem.
Outcome
|
I followed your steps and the right thing happened. And we certainly have no code in nbgv to delete any directory. The callstack shows LibGit2Sharp is the one doing it during Checkout. Seems to me then that there must be some serious bug in LibGit2Sharp. Maybe it's misbehaving because the git database is using an unsupported pattern (newer than the libgit2sharp that nbgv ships, perhaps). We are using the latest LibGit2Sharp (0.27.0-preview-0182). |
What's the diff of the commit that is HEAD and the commit that you're checking out? |
@ethomson I'm not sure if your question is aimed at me or @AArnott, but I've had a go at answering it. I locally checked out what I took to be the relevant revisions of Nerdbank.GitVersioning and LibGit2Sharp, brought them into a VS solution and stepped through a run of However, running in the debugger, the command succeeds as expected, so perhaps the info below isn't so useful. Here goes anyway. Control flow passes into LibGit2Sharp here with Then I follow the stack trace as in my original comment above, as far as So to try and directly answer your question @ethomson:
I don't know enough about git internals, but to me this looks like a commit waiting to happen, presumably containing the modifications to those files that nbgv makes when making the new v1.0 release. |
@HughWarrington I think what @ethomson was asking for was just a @HughWarrington You can find the exact commit that is behind your nbgv tool by running
This tells you that my nbgv tool was built from the commit beginning with hash 5d25f54. |
That's useful to know. It would be interesting to see what the diff shows and if it shows only those two files, or if there's a subtle difference between the commits. Is there a difference in case? Unicode encoding? etc. Or if it's just a file or two. |
Thanks for all the info @AArnott. I am also using Nerdbank.GitVersioning |
@HughWarrington Interesting. I downloaded the package version you mentioned, pulled out the dll, then opened the dll in ILSpy. I found this: |
@ethomson I think all the libgit2sharp calls around creating commits, branches, and staging changes is here: Nerdbank.GitVersioning/src/NerdBank.GitVersioning/ReleaseManager.cs Lines 192 to 203 in 7d22ed6
We:
So literally, the only change we're making is to an existing file, and checkout is across branches that only varies by that one file. |
I'm not suggesting that you're doing something wrong. There's a lot of things happening in a lot of layers. |
Understood. I wasn't meaning to sound defensive. I really appreciate your review of this issue. I just wanted to clearly answer your question about impact from checkout, case changes, etc, that you asked about. |
No, no worries. I was just trying to make sure that I was clear that ... I have no idea what's going on or why yet. 😁 All I really know so far is that I agree that this seems like very unexpected behavior and I'm pretty stumped. |
I was having the same issue, and I noticed that it specifically occurred when I ran Also relevant here is that the Visual Studio Developer PowerShell of course starts in the solution folder, meaning running it from there will fail by default, which probably adds to the confusion. |
Thanks for sharing. Maybe @ethomson can use that in figuring out why libgit2 would be doing this. |
I created a test git repo to try out nbgv. I followed these instructions. After running
nbgv install
I committed the two added files. After this I rannbgv prepare-release
which died with an exception.From the Developer PowerShell in Visual Studio:
There is a commit Set version to '1.0' on my master branch, and version.json has been deleted from the working directory.
I am using Visual Studio 2022 17.4.3.
This also happens if I close Visual Studio and run
nbgv
from a standalone Windows PowerShell console. Which suggests it's not VS with an open handle to the ClickOnceTest dir (why is nbgv trying to remove that dir anyway?).The text was updated successfully, but these errors were encountered: