Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reference the .gitmodules file to get a list of current submodules, r…
…ather than the .git/config file, which may have old submodules from other branches. JENKINS-37419
- Loading branch information
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -961,6 +961,10 @@ public SubmoduleUpdateCommand timeout(Integer timeout) { | |
* @throws InterruptedException if called methods throw same exception | ||
*/ | ||
public void execute() throws GitException, InterruptedException { | ||
// Initialize the submodules to ensure that the git config | ||
// contains the URLs from .gitmodules. | ||
submoduleInit(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MarkEWaite
Contributor
|
||
|
||
ArgumentListBuilder args = new ArgumentListBuilder(); | ||
args.add("submodule", "update"); | ||
if (recursive) { | ||
|
@@ -995,7 +999,7 @@ else if (!referencePath.isDirectory()) | |
try { | ||
// We might fail if we have no modules, so catch this | ||
// exception and just return. | ||
cfgOutput = launchCommand("config", "--get-regexp", "^submodule"); | ||
cfgOutput = launchCommand("config", "-f", ".gitmodules", "--get-regexp", "^submodule\\.(.*)\\.url"); | ||
} catch (GitException e) { | ||
listener.error("No submodules found."); | ||
return; | ||
|
@MarkEWaite
Do you know why
--init
is still used in line 971 now when an explicit init is added here?Should
submoduleInit()
also be called inJGitAPIImpl
's implementation ofSubmoduleUpdateCommand::execute()
?I am asking because after your upgrade to JGit 5.0.1, I was having a look if some tests annoted with
@NotImplementedInJGit
could be enabled for JGit. Some tests (for example this one) just callsubmoduleUpdate()
withoutsubmoduleInit()
. So the CliGit implementation runs successfully but the JGit implementation doesn't.If you tell me to either add
submoduleInit()
to tests where it is missing or to JGit'ssubmoduleUpdate()
I will try to prepare a pull request with more tests enabled for JGit. It looks like it now supports renamed submodules.