|
|
|
@ -171,7 +171,7 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
|
|
|
|
|
} |
|
|
|
|
walk.setTree(revWalk.parseTree(fetchHead)); |
|
|
|
|
while (walk.next()) { |
|
|
|
|
Repository submoduleRepo = walk.getRepository(); |
|
|
|
|
try (Repository submoduleRepo = walk.getRepository()) { |
|
|
|
|
|
|
|
|
|
// Skip submodules that don't exist locally (have not been
|
|
|
|
|
// cloned), are not registered in the .gitmodules file, or
|
|
|
|
@ -184,15 +184,18 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
|
|
|
|
|
FetchRecurseSubmodulesMode recurseMode = getRecurseMode( |
|
|
|
|
walk.getPath()); |
|
|
|
|
|
|
|
|
|
// When the fetch mode is "yes" we always fetch. When the mode
|
|
|
|
|
// is "on demand", we only fetch if the submodule's revision was
|
|
|
|
|
// When the fetch mode is "yes" we always fetch. When the
|
|
|
|
|
// mode
|
|
|
|
|
// is "on demand", we only fetch if the submodule's revision
|
|
|
|
|
// was
|
|
|
|
|
// updated to an object that is not currently present in the
|
|
|
|
|
// submodule.
|
|
|
|
|
if ((recurseMode == FetchRecurseSubmodulesMode.ON_DEMAND |
|
|
|
|
&& !submoduleRepo.hasObject(walk.getObjectId())) |
|
|
|
|
|| recurseMode == FetchRecurseSubmodulesMode.YES) { |
|
|
|
|
FetchCommand f = new FetchCommand(submoduleRepo) |
|
|
|
|
.setProgressMonitor(monitor).setTagOpt(tagOption) |
|
|
|
|
.setProgressMonitor(monitor) |
|
|
|
|
.setTagOpt(tagOption) |
|
|
|
|
.setCheckFetchedObjects(checkFetchedObjects) |
|
|
|
|
.setRemoveDeletedRefs(isRemoveDeletedRefs()) |
|
|
|
|
.setThin(thin).setRefSpecs(refSpecs) |
|
|
|
@ -205,6 +208,7 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
|
|
|
|
|
results.addSubmodule(walk.getPath(), f.call()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
throw new JGitInternalException(e.getMessage(), e); |
|
|
|
|
} catch (ConfigInvalidException e) { |
|
|
|
|