-
Notifications
You must be signed in to change notification settings - Fork 316
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
Downloader: Sparse checkout is (no longer) working #8195
Comments
JGit does not support sparse checkouts currently, that's a known limitation: ort/plugins/version-control-systems/git/src/main/kotlin/Git.kt Lines 244 to 246 in 64fd9db
I'm not sure what we can do about it without breaking #7725 again other than contributing sparse checkout support to upstream JGit... |
I forgot about that part, that's unfortunate. I have put this on the agenda for the next community meeting so that we can discuss the options:
|
That's a valid question. My initial motivation to replace Git CLI with JGit was to reduce dependencies on external tools and make ORT as self-contained as possible. However, we've been struggling to get rid of Git CLI completely for a long time, mostly due to limitations in JGit. Also, I had to accept that when trying to target Kotlin Multiplatform, it would actually be easier to call Git CLI on all platforms rather than finding native Git implementations on all platforms.
I would not want to maintain those two implementations. We already are in the state of using Git CLI and JGit, but that should have been only a temporary solution.
That would be very nice from a community perspective. I believe the maintains would happily accept such a feature, but they're not actively looking into it, mostly because JGIt seems to be more and more about the Git server side (as it's used in Gerrit) than the Git client side. |
I'm actually a bit surprised that the code path with
is even triggered for the given example. IIUC this code should only be necessary when updating a previously checked out non-fixed revision. That is, it should not be necessary when doing an initial sparse checkout in a freshly initialized working tree. So, avoid to call this on the first "update" call which actually populates the working tree initially should also fix the problem, or? |
Debugging this actually shows that |
JGit still does not support sparse checkouts [1], and its `reset` call turns the sparse checkout done by `git checkout` into a full checkout. So again use the Git CLI to perform the actual reset like done before 8472931, but continue to determine the resolved revision to reset to via JGit. Fixes #8195. [1]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=383772 Signed-off-by: Sebastian Schuberth <[email protected]>
I've found a better very simple solution, see #8199. |
JGit still does not support sparse checkouts [1], and its `reset` call turns the sparse checkout done by `git checkout` into a full checkout. So again use the Git CLI to perform the actual reset like done before 8472931, but continue to determine the resolved revision to reset to via JGit. Fixes #8195. [1]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=383772 Signed-off-by: Sebastian Schuberth <[email protected]>
JGit still does not support sparse checkouts [1], and its `reset` call turns the sparse checkout done by `git checkout` into a full checkout. So again use the Git CLI to perform the actual reset like done before 8472931, but continue to determine the resolved revision to reset to via JGit. Fixes #8195. [1]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=383772 Signed-off-by: Sebastian Schuberth <[email protected]>
Possibly some code changes in #8170 led to the effect that git sparse checkouts are no longer working.
To reproduce:
Let's say, from a gradle managed repository with many modules, I only want to check out an Angular web application subdirectory
ort --debug download --project-url=https://github.com/wkl3nk/fun-with-notes.git --vcs-path=frontend-angular16 --vcs-revision=main -o .
Looking into
.git/info/sparse-checkout
it looks good, everything is prepared, also.git/config
is set to sparseCheckout = trueBut the final step, a "git.reset() ..." in the code has no effect.
If I manually do a
git reset --hard FETCH_HEAD
in the target directory, then everything looks good.As I said, this line here in the code of Git.kt just seems to have no effect.
git.reset().setMode(ResetCommand.ResetType.HARD).setRef(resolvedRevision).call()
The OSS Review Toolkit, version 15.0.0-051.sha.64fd9db.
Running 'download' under Java 17.0.8.1 on Mac OS X
The text was updated successfully, but these errors were encountered: