[JENKINS-21248] Support shallow submodule update#303
[JENKINS-21248] Support shallow submodule update#303fujii wants to merge 2 commits intojenkinsci:masterfrom
Conversation
|
This patch is the git-plugin part of this fix. |
MarkEWaite
left a comment
There was a problem hiding this comment.
Please provide tests for the shallow setting on submodule clone. The existing submodule tests should be a good starting point to add further tests.
9680c41 to
6af910a
Compare
|
Thank you for your feedback, @MarkEWaite. |
|
I see the same failure when I execute:
I assumed it was the missing submoduleInit() call in the new test compared to the test which precedes it in the file. Unfortunately, that was not enough to fix the test. I think you'll need to investigate further. |
6af910a to
89ba2d3
Compare
|
Thank you for testing my patch, @MarkEWaite. |
|
Hi @fujii, could you rebase this pull request on the current master branch? |
| return this; | ||
| } | ||
|
|
||
| public SubmoduleUpdateCommand depth(Integer depth) { |
There was a problem hiding this comment.
If possible I would go for int instead of Integer for the method parameter and instance variable. (I also see boolean and no Boolean).
There was a problem hiding this comment.
Ok. I have seen now that this is done like this to be consisent with the methods for clone/fetch.
| } | ||
|
|
||
| @NotImplementedInJGit | ||
| public void test_submodule_update_shallow() throws Exception { |
There was a problem hiding this comment.
Other test cases would also be useful:
- no
shallow(...)call shallow(false)depth(...)
|
@darxriggs: Thank you. I will do it. But, I'm pretty busy now. Feel free to take over. |
|
Hi @fujii, the error you mentioned, is it about referencing shas on github when cloning? Github does not support this (see isaacs/github#436). The respective git option would be Your proposed solution with an extra branch that contains a submodule referencing a local git repository is a clever trick. But I find it a bit confusing and an extra branch has to be maintained. Another idea is to put a repository with submodules into What are your thoughts @MarkEWaite? |
|
Adding a binary copy of a specific repository into src/test/resources would be fine. I have no problem with extra branches in the git-client-plugin repository for specific tests. I hesitate to have those branches depend on something outside the repository, unless the tests which use those branches are entirely optional. |
| } | ||
| if (shallow) { | ||
| listener.getLogger().println("[ERROR] JGit doesn't support shallow submodules yet."); | ||
| throw new UnsupportedOperationException("not implemented yet"); |
There was a problem hiding this comment.
Hi @MarkEWaite, should using shallow for JGit throw this UnsupportedOperationException here or just log a WARNING when calling shallow(true) at lines 2224-2227?
As a reference FetchCommand and CloneCommand just perform logging. That's not consistent in this class.
There was a problem hiding this comment.
You're right @darxriggs , it would be good enough to log the implementation gap rather than fail the checkout. Shallow clone is a performance optimization that isn't critical to the typical use of the repository.
|
As I cannot update this one, I prepared a new pull request #344 with improvements. |
|
Thanks. Closed this ticket. |
Fix for https://issues.jenkins-ci.org/browse/JENKINS-21248