Skip to content
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

Extension doesn't work in case of sparse checkout and partial clone #356

Open
EugeniyMaksimov opened this issue Oct 29, 2020 · 12 comments
Open
Labels
Milestone

Comments

@EugeniyMaksimov
Copy link

EugeniyMaksimov commented Oct 29, 2020

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.

@laurentkempe
Copy link
Owner

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?

@laurentkempe laurentkempe added this to the 3.11.0 milestone Oct 29, 2020
@EugeniyMaksimov
Copy link
Author

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.

@laurentkempe
Copy link
Owner

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?

@EugeniyMaksimov
Copy link
Author

EugeniyMaksimov commented Oct 30, 2020

mkdir work
cd work
git clone -b --filter=blob:none --no-checkout .
git config core.sparsecheckout true
git sparse-checkout init --cone
git sparse-checkout set
git read-tree -mu HEAD
git remote add upstream
git fetch --all

I also tried full clone: git clone -b --no-checkout .
the result is the same

@laurentkempe
Copy link
Owner

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

@EugeniyMaksimov
Copy link
Author

EugeniyMaksimov commented Nov 2, 2020

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>

@laurentkempe
Copy link
Owner

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.

@laurentkempe
Copy link
Owner

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!

@EugeniyMaksimov
Copy link
Author

EugeniyMaksimov commented Nov 5, 2020

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: libgit2/libgit2sharp#1845

@laurentkempe
Copy link
Owner

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.

@miniyou
Copy link

miniyou commented Jan 18, 2021

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!

@laurentkempe
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants