• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

        [JENKINS-45368] JGit doesn't support sparse checkout

        Mark Waite added a comment -

        If you need sparse checkout, then you'll need to use command line git as the implementation, rather than JGit. The underlying JGit implementation does not support sparse checkout yet. Refer to their enhancement request for more information.

        Sparse checkout works very well with command line git inside the git plugin. Change the selected implementation for that job from "jgit" to "Default", and the sparse checkout will work (assuming you have a command line git version installed, and that version of command line git is new enough to include sparse checkout support.

        Mark Waite added a comment - If you need sparse checkout, then you'll need to use command line git as the implementation, rather than JGit. The underlying JGit implementation does not support sparse checkout yet. Refer to their enhancement request for more information. Sparse checkout works very well with command line git inside the git plugin. Change the selected implementation for that job from "jgit" to "Default", and the sparse checkout will work (assuming you have a command line git version installed, and that version of command line git is new enough to include sparse checkout support.

        We're using 4.8.0.201706111038-r version of jgit. Is this fixed in higher version? Basically, sparse checkout does not work in this version of jgit.

        Venkata Shreyas Kabekkodu added a comment - We're using 4.8.0.201706111038-r version of jgit. Is this fixed in higher version? Basically, sparse checkout does not work in this version of jgit.

        Mark Waite added a comment -

        vshreyask as stated in the linked enhancement request to the JGit project, JGit does not support sparse checkout in any of its versions, including 4.5 as bundled with the git client plugin 2.x and 5.3 as bundled with the pre-release version of git client plugin 3.x

        Mark Waite added a comment - vshreyask as stated in the linked enhancement request to the JGit project, JGit does not support sparse checkout in any of its versions, including 4.5 as bundled with the git client plugin 2.x and 5.3 as bundled with the pre-release version of git client plugin 3.x

        Thanks markewaite

        Venkata Shreyas Kabekkodu added a comment - Thanks markewaite

        Mark Waite added a comment - - edited

        JGit 5.9.0 as bundled with git client plugin 3.5.0 (and later) includes support for the addPath and addPaths methods. Those methods should allow the git client plugin to implement sparse checkout support.

        Tasks to implement sparse checkout for JGit:

        • Extend the git client plugin JGit implementation to use addPath or addPaths during checkout
        • Write tests to confirm that sparse checkout behaves consistently between command line git and JGit
        • Extend git plugin to depend on the new release of git client plugin and remove sparse checkout guards from JGit calls
        • Remove the sparse checkout exclusion from GitToolChooser

        Mark Waite added a comment - - edited JGit 5.9.0 as bundled with git client plugin 3.5.0 (and later) includes support for the addPath and addPaths methods. Those methods should allow the git client plugin to implement sparse checkout support. Tasks to implement sparse checkout for JGit: Extend the git client plugin JGit implementation to use addPath or addPaths during checkout Write tests to confirm that sparse checkout behaves consistently between command line git and JGit Extend git plugin to depend on the new release of git client plugin and remove sparse checkout guards from JGit calls Remove the sparse checkout exclusion from GitToolChooser

        Raghav added a comment -

        I made the change to call the new addPaths API in the CheckoutCommand provided by eclipse.jgit, but the test case for sparse checkout fails.

        https://github.com/jenkinsci/git-client-plugin/blob/9832d664e90a90dff541342838949e0e2356eb06/src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java#L2123

        Is there something else other than calling addPaths API or could it be an issue with the library. 

        Raghav added a comment - I made the change to call the new addPaths API in the CheckoutCommand provided by eclipse.jgit, but the test case for sparse checkout fails. https://github.com/jenkinsci/git-client-plugin/blob/9832d664e90a90dff541342838949e0e2356eb06/src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java#L2123 Is there something else other than calling addPaths API or could it be an issue with the library. 

        Mark Waite added a comment -

        raghavgarg098 can you share a link to your repository that includes your change? That would allow others to see the changes you've made and assist with further exploration.

        Mark Waite added a comment - raghavgarg098 can you share a link to your repository that includes your change? That would allow others to see the changes you've made and assist with further exploration.

        Raghav added a comment -

        Raghav added a comment - Please find the changes in this repository https://github.com/raghavgarg098/git-client-plugin/tree/SparseCheckout

        Mark Waite added a comment -

        It looks to me like that more significant changes will be required in the git client plugin than were initially assumed. I have watched your changes in a debugger comparing the command line git implementation running that test and the JGit implementation running that test. The JGit implementation appears to include additional rest(HARD) steps that will need to be removed or avoided if sparseCheckoutPaths are to be honored with JGit.

        I've removed the "newbie-friendly" label from this issue. It will require much more analysis than we should require of a new contributor.

        Mark Waite added a comment - It looks to me like that more significant changes will be required in the git client plugin than were initially assumed. I have watched your changes in a debugger comparing the command line git implementation running that test and the JGit implementation running that test. The JGit implementation appears to include additional rest(HARD) steps that will need to be removed or avoided if sparseCheckoutPaths are to be honored with JGit. I've removed the "newbie-friendly" label from this issue. It will require much more analysis than we should require of a new contributor.

        Raghav added a comment -

        Thanks Mark

        Raghav added a comment - Thanks Mark

          Unassigned Unassigned
          kiran9456 Kiran Kumar
          Votes:
          0 Vote for this issue
          Watchers:
          4 Start watching this issue

            Created:
            Updated: