-
Notifications
You must be signed in to change notification settings - Fork 389
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
[JENKINS-21248] Support shallow submodule update #303
Conversation
This patch is the git-plugin part of this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I have seen now that this is done like this to be consisent with the methods for clone/fetch.
@@ -2570,6 +2570,18 @@ public void test_submodule_update() throws Exception { | |||
assertFixSubmoduleUrlsThrows(); | |||
} | |||
|
|||
@NotImplementedInJGit | |||
public void test_submodule_update_shallow() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -2234,6 +2246,10 @@ public void execute() throws GitException, InterruptedException { | |||
listener.getLogger().println("[ERROR] JGit doesn't support submodule update --reference yet."); | |||
throw new UnsupportedOperationException("not implemented yet"); | |||
} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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