GitDiffMargin
GitDiffMargin copied to clipboard
Extension doesn't work in case of sparse checkout and partial clone
Hello!
Versions
- Git Diff Margin version: 3.10.2.268
- Visual Studio version: Microsoft Visual Studio Professional 2019 Version 16.7.6
What happened
Change markers (yellow lines, red triangles) are not shown if the project is in the repository, where sparse checkout and partial clone git features are used.
Steps to Reproduce
I have two repository, in regular one everything is fine, but in the other, where the sparse checkout and partial clone features are used, there is no any markers.
Thanks @EugeniyMaksimov for reporting it! I will have a look asap. I guess the version of Git Diff Margin has a typo and you mean 3.10.2?
Thank you very much! I've corrected the typo in the Git Diff Margin version. I think, the Sparse Checkout is a great feature of Git, I believe, a lot of people will use it, especially when Git Hub supports it.
I just have seen on the documentation that
THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN THE FUTURE.
Nevertheless, could you give me an example of the command you are using on an existing repository which I could use to test?
mkdir work
cd work
git clone -b
I also tried full clone: git clone -b
I tried the command you are listing but cannot make it work, imagine I would like to do it with this repo - https://github.com/laurentkempe/DynamicRun.git
If I try what you also tried
git clone -b --no-checkout https://github.com/laurentkempe/DynamicRun.git
I get the following
Cloning into 'DynamicRun'...
fatal: Remote branch --no-checkout not found in upstream origin
Hi Laurent, This is a full listening of commands I used to clone the DynamicRun repository. I used the Power Shell console.
PS C:\New folder> git clone -b master --no-checkout https://github.com/laurentkempe/DynamicRun.git . Cloning into '.'... remote: Enumerating objects: 14, done. remote: Counting objects: 100% (14/14), done. remote: Compressing objects: 100% (13/13), done. remote: Total 92 (delta 4), reused 2 (delta 1), pack-reused 78 Unpacking objects: 100% (92/92), 35.12 KiB | 115.00 KiB/s, done. PS C:\New folder> git config core.sparsecheckout true PS C:\New folder> git sparse-checkout init --cone PS C:\New folder> git sparse-checkout set DynamicRun PS C:\New folder> git read-tree -mu HEAD PS C:\New folder> git fetch --all Fetching origin PS C:\New folder>
Thanks @EugeniyMaksimov I could do a sparse checkout of DynamicRun now and can reproduce the issue that no changes are shown with Git Diff Margin. I also learned about something new. I need to go deeper into why it is like that, but my first guess is that the https://github.com/libgit2/libgit2sharp/, which Git Diff Margin is using, is not supporting sparse checkout which seems quite new.
I can confirm that the issue comes from libgit2sharp
Git Diff Margin get an exception unsupported repository version 1. Only versions up to 0 are supported.
while creating a Repository
on this line.
So, I guess there is not much I can do about it!
Hello Laurent, Thank you for the investigation! I think the best idea in this case is to write an issue in the libgit2sharp project. Here it is: https://github.com/libgit2/libgit2sharp/issues/1845
Hello Eugeniy You are welcome, thanks for reporting it! The issue is that libgit2sharp is missing a maintainer so I do not expect too much from it.
Hi!
Git Diff Margin works for me in the main repo folder. However, I get nothing in the margin for projects that are in another work tree, i.e. added with git worktree add …
. It seems plausible that this is for the same reason, but I'm not sure how to verify.
Git Diff Margin version: 3.10.2.268 VS Pro 2019 version: 16.8.2 Git version: 2.30.0.windows.2
Ps. thanks for a great extension! ❤
Thanks @miniyou for your nice message! You can also add a star to the project on Github to show your recognition and on Visual Studio Git Diff Margin marketplace Worktree are mentioned in #88 as I also use those from time to time and faced the same issue.