SubmoduleUpdateCommand: Add fetch callback
When the submodule already exists, it is fetched instead of cloned. Use the fetch callback instead of clone callback in this case. Change-Id: I170c21ab92b4117f25fdf940fe6807f214b04d39 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
06835f3e4f
commit
e32aed6d75
|
@ -91,6 +91,8 @@ public class SubmoduleUpdateCommand extends
|
||||||
|
|
||||||
private CloneCommand.Callback callback;
|
private CloneCommand.Callback callback;
|
||||||
|
|
||||||
|
private FetchCommand.Callback fetchCallback;
|
||||||
|
|
||||||
private boolean fetch = false;
|
private boolean fetch = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,10 +193,8 @@ public Collection<String> call() throws InvalidConfigurationException,
|
||||||
clone.setProgressMonitor(monitor);
|
clone.setProgressMonitor(monitor);
|
||||||
submoduleRepo = clone.call().getRepository();
|
submoduleRepo = clone.call().getRepository();
|
||||||
} else if (this.fetch) {
|
} else if (this.fetch) {
|
||||||
if (callback != null) {
|
if (fetchCallback != null) {
|
||||||
// FIXME: Do we need a new callback to tell them we're
|
fetchCallback.fetchingSubmodule(generator.getPath());
|
||||||
// fetching?
|
|
||||||
callback.cloningSubmodule(generator.getPath());
|
|
||||||
}
|
}
|
||||||
FetchCommand fetchCommand = Git.wrap(submoduleRepo).fetch();
|
FetchCommand fetchCommand = Git.wrap(submoduleRepo).fetch();
|
||||||
if (monitor != null) {
|
if (monitor != null) {
|
||||||
|
@ -274,4 +274,18 @@ public SubmoduleUpdateCommand setCallback(CloneCommand.Callback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set status callback for submodule fetch operation.
|
||||||
|
*
|
||||||
|
* @param callback
|
||||||
|
* the callback
|
||||||
|
* @return {@code this}
|
||||||
|
* @since 4.9
|
||||||
|
*/
|
||||||
|
public SubmoduleUpdateCommand setFetchCallback(
|
||||||
|
FetchCommand.Callback callback) {
|
||||||
|
this.fetchCallback = callback;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue