Community
Participate
Working Groups
Using EGit nightly I see the following. I think Joerg fixed a similar issue before in EGit. java.lang.IllegalStateException: beginTask should only be called once per instance. At least call done() before further invocations at org.eclipse.jface.operation.AccumulatingProgressMonitor.beginTask(AccumulatingProgressMonitor.java:148) at org.eclipse.core.runtime.SubMonitor.convert(SubMonitor.java:483) at org.eclipse.core.runtime.SubMonitor.convert(SubMonitor.java:428) at org.eclipse.egit.ui.internal.repository.RepositorySearchDialog.findGitDirsRecursive(RepositorySearchDialog.java:448) at org.eclipse.egit.ui.internal.repository.RepositorySearchDialog$10.run(RepositorySearchDialog.java:619) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Caused by: java.lang.IllegalStateException: beginTask(Searching, -1) was called here previously at org.eclipse.jface.operation.AccumulatingProgressMonitor.beginTask(AccumulatingProgressMonitor.java:155) at org.eclipse.egit.ui.internal.repository.RepositorySearchDialog$10.run(RepositorySearchDialog.java:615) ... 1 more
I saw the same stack trace in 2023-12 M1. In my case, it happened when adding an existing local repository to the view. It seems to happen immediately after selecting "Add a Git repository..." from the right-click menu in the "Git Repositories" tab in the Git perspective.
Just switch that trace flag off. (I think it is off by default now.) The code is working perfectly fine. IMO SubMonitor is broken. If this rule about beginTask is enforced, then SubMonitor.convert(IProgressMonitor) and SubMonitor.convert(IProgressMonitor, int) become useless since in general the caller cannot be sure whether beginTask was already called on the passed monitor. And in particular that will always be the case if the passed monitor is a SubMonitor. Either drop this somewhat artificial rule, or make sure that the SubMonitor.convert(...) variants do not call beginTask if the given monitor is a SubMonitor, but call setTaskName() and setWorkRemaining() directly (if a name or ticks are given).
https://git.eclipse.org/r/c/egit/egit/+/204918