Reputation: 202
I am using JGit libs to implement basic git operations.
Javadoc for ProgressMonitor
:
http://archive.eclipse.org/jgit/docs/jgit-2.0.0.201206130900-r/apidocs/org/eclipse/jgit/lib/ProgressMonitor.html
Here, you can see the log when I use a ProgressMonitor
for git clone
(implementation in the end):
Now the question:
According to the method start
, there are 2 tasks, but the method beginTask
is reporting 6 tasks started and the method endTask
is reporting 3 tasks ended... Can anybody explain to me this magic?
The cloning process itself finished successfully.
Below you can see the implementation of ProgressMonitor
with methods writing to the log.
import org.eclipse.jgit.lib.ProgressMonitor;
public class MyProgressMonitor implements ProgressMonitor {
String currentTaskTitle;
@Override
public void start(int totalTasks) {
System.out.println("Total tasks: " + totalTasks);
}
@Override
public void beginTask(String title, int totalWork) {
currentTaskTitle = title;
System.out.println("Task started: " + title + " with total work: " + totalWork);
}
@Override
public void update(int completed) {
}
@Override
public void endTask() {
System.out.println("Task ended: " + currentTaskTitle);
}
@Override
public boolean isCancelled() {
return false;
}
}
Upvotes: 1
Views: 173