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.Init and Repository.Clone fail with path too long #2051
Comments
This behaviour can reproduced via UnitTest
This will fail with an LibGit2SharpException path too long |
Is there any sensible solution? It is impossible to use the package with such a blocking error. |
Only after execution |
@kazakevich-alexei |
Have the same issue here. :( LibGit2Sharp.Repository.Clone(repo.CloneUrl, clonedRepoPath, branchCloneOptions); When I oull out libGit2SharpException.Message I getting this: path too long: 'D:/Backup data/GitHub/Github Backup 08-03-2024-(11-46)/michaelmsonne/xxxxxxxxxx/code/main/xxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxx/xxxxxxxxxxxx/xxxxxxxxxxx.ps1' Total path is 273 for one sample here from a console application. Regedit longpath is set, AppContext.SetSwitch("System.IO.UseLegacyPathHandling", false); is set too and so - same issues.. |
@michaelmsonne git supports long paths only when the More information is here. https://github.com/libgit2/libgit2/blob/9903482593db438abbbbaf5324a0cc78c5472603/docs/win32-longpaths.md What does git do in this case? |
@ethomson thanks - I found that too after i posted it.. I have a .Net Console Apllication (portable) there is using this to backup repos to a local path on a Windows Server. The "core.longpaths" - how can I in some way "setup" this so the application is working when moved around (as it is portale)? 🤔 |
Reproduction steps
Set core.longpaths = true in global or user
Use either Repository.Init or Repository.Clone on a path which is longer than 260
Expected behavior
Init and Clone work without an error
Actual behavior
LibGit2Sharp.Exception (path too long)
Version of LibGit2Sharp (release number or SHA1)
0.27.2
Operating system(s) tested; .NET runtime tested
Win 10 22H2 (.NET 4.8)
The text was updated successfully, but these errors were encountered: