Program: 7806
Project: 7806
Buggy source:
/** 
 * Remove or delete the repository
 * @param event
 * @param delete if <code>true</code>, the repository will be deleted from disk
 */
protected void removeRepository(final ExecutionEvent event,final boolean delete){
  IWorkbenchSite activeSite=HandlerUtil.getActiveSite(event);
  IWorkbenchSiteProgressService service=(IWorkbenchSiteProgressService)activeSite.getService(IWorkbenchSiteProgressService.class);
  if (delete)   try {
    List<RepositoryNode> selectedNodes=getSelectedNodes(event);
    String title=UIText.RemoveCommand_DeleteConfirmTitle;
    if (selectedNodes.size() > 1) {
      String message=NLS.bind(UIText.RemoveCommand_DeleteConfirmSingleMessage,Integer.valueOf(selectedNodes.size()));
      if (!MessageDialog.openConfirm(getShell(event),title,message))       return;
    }
 else     if (selectedNodes.size() == 1) {
      String name=org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil().getRepositoryName(selectedNodes.get(0).getObject());
      String message=NLS.bind(UIText.RemoveCommand_DeleteConfirmMultiMessage,name);
      if (!MessageDialog.openConfirm(getShell(event),title,message))       return;
    }
  }
 catch (  ExecutionException e) {
    Activator.handleError(e.getMessage(),e,false);
    return;
  }
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      final List<IProject> projectsToDelete=new ArrayList<IProject>();
      monitor.setTaskName(UIText.RepositoriesView_DeleteRepoDeterminProjectsMessage);
      List<RepositoryNode> selectedNodes;
      try {
        selectedNodes=getSelectedNodes(event);
      }
 catch (      ExecutionException e) {
        Activator.logError(e.getMessage(),e);
        return new Status(IStatus.ERROR,Activator.getPluginId(),e.getMessage(),e);
      }
      for (      RepositoryNode node : selectedNodes) {
        if (node.getRepository().isBare())         continue;
        File workDir=node.getRepository().getWorkTree();
        final IPath wdPath=new Path(workDir.getAbsolutePath());
        for (        IProject prj : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
          if (monitor.isCanceled())           return Status.OK_STATUS;
          if (wdPath.isPrefixOf(prj.getLocation())) {
            projectsToDelete.add(prj);
          }
        }
      }
      final boolean[] confirmedCanceled=new boolean[]{false,false};
      if (!projectsToDelete.isEmpty()) {
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            try {
              confirmedCanceled[0]=confirmProjectDeletion(projectsToDelete,event);
            }
 catch (            OperationCanceledException e) {
              confirmedCanceled[1]=true;
            }
          }
        }
);
      }
      if (confirmedCanceled[1]) {
        return Status.OK_STATUS;
      }
      if (confirmedCanceled[0]) {
        IWorkspaceRunnable wsr=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor actMonitor) throws CoreException {
            for (            IProject prj : projectsToDelete)             prj.delete(false,false,actMonitor);
          }
        }
;
        try {
          ResourcesPlugin.getWorkspace().run(wsr,ResourcesPlugin.getWorkspace().getRoot(),IWorkspace.AVOID_UPDATE,monitor);
        }
 catch (        CoreException e1) {
          Activator.logError(e1.getMessage(),e1);
        }
      }
      for (      RepositoryNode node : selectedNodes) {
        util.removeDir(node.getRepository().getDirectory());
      }
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          RepositoriesView view;
          try {
            view=getView(event);
            view.getCommonViewer().refresh();
          }
 catch (          ExecutionException e) {
            Activator.logError(e.getMessage(),e);
          }
        }
      }
);
      if (delete) {
        try {
          for (          RepositoryNode node : selectedNodes) {
            Repository repo=node.getRepository();
            if (!repo.isBare())             deleteRecursive(repo.getWorkTree());
            deleteRecursive(repo.getDirectory());
          }
        }
 catch (        IOException e) {
          return Activator.createErrorStatus(e.getMessage(),e);
        }
      }
      return Status.OK_STATUS;
    }
    private void deleteRecursive(    File fileToDelete) throws IOException {
      if (fileToDelete == null)       return;
      if (fileToDelete.exists()) {
        if (fileToDelete.isDirectory()) {
          for (          File file : fileToDelete.listFiles()) {
            deleteRecursive(file);
          }
        }
        if (!fileToDelete.delete())         throw new IOException(NLS.bind(UIText.RemoveCommand_DeleteFailureMessage,fileToDelete.getAbsolutePath()));
      }
    }
  }
;
  service.schedule(job);
}

Fixed version (ground truth):
/** 
 * Remove or delete the repository
 * @param event
 * @param delete if <code>true</code>, the repository will be deleted from disk
 */
protected void removeRepository(final ExecutionEvent event,final boolean delete){
  IWorkbenchSite activeSite=HandlerUtil.getActiveSite(event);
  IWorkbenchSiteProgressService service=(IWorkbenchSiteProgressService)activeSite.getService(IWorkbenchSiteProgressService.class);
  final List<RepositoryNode> selectedNodes;
  try {
    selectedNodes=getSelectedNodes(event);
  }
 catch (  ExecutionException e) {
    Activator.handleError(e.getMessage(),e,true);
    return;
  }
  if (delete) {
    String title=UIText.RemoveCommand_DeleteConfirmTitle;
    if (selectedNodes.size() > 1) {
      String message=NLS.bind(UIText.RemoveCommand_DeleteConfirmSingleMessage,Integer.valueOf(selectedNodes.size()));
      if (!MessageDialog.openConfirm(getShell(event),title,message))       return;
    }
 else     if (selectedNodes.size() == 1) {
      String name=org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil().getRepositoryName(selectedNodes.get(0).getObject());
      String message=NLS.bind(UIText.RemoveCommand_DeleteConfirmMultiMessage,name);
      if (!MessageDialog.openConfirm(getShell(event),title,message))       return;
    }
  }
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      final List<IProject> projectsToDelete=new ArrayList<IProject>();
      monitor.setTaskName(UIText.RepositoriesView_DeleteRepoDeterminProjectsMessage);
      for (      RepositoryNode node : selectedNodes) {
        if (node.getRepository().isBare())         continue;
        File workDir=node.getRepository().getWorkTree();
        final IPath wdPath=new Path(workDir.getAbsolutePath());
        for (        IProject prj : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
          if (monitor.isCanceled())           return Status.OK_STATUS;
          if (wdPath.isPrefixOf(prj.getLocation())) {
            projectsToDelete.add(prj);
          }
        }
      }
      final boolean[] confirmedCanceled=new boolean[]{false,false};
      if (!projectsToDelete.isEmpty()) {
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            try {
              confirmedCanceled[0]=confirmProjectDeletion(projectsToDelete,event);
            }
 catch (            OperationCanceledException e) {
              confirmedCanceled[1]=true;
            }
          }
        }
);
      }
      if (confirmedCanceled[1]) {
        return Status.OK_STATUS;
      }
      if (confirmedCanceled[0]) {
        IWorkspaceRunnable wsr=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor actMonitor) throws CoreException {
            for (            IProject prj : projectsToDelete)             prj.delete(false,false,actMonitor);
          }
        }
;
        try {
          ResourcesPlugin.getWorkspace().run(wsr,ResourcesPlugin.getWorkspace().getRoot(),IWorkspace.AVOID_UPDATE,monitor);
        }
 catch (        CoreException e1) {
          Activator.logError(e1.getMessage(),e1);
        }
      }
      for (      RepositoryNode node : selectedNodes) {
        util.removeDir(node.getRepository().getDirectory());
      }
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          RepositoriesView view;
          try {
            view=getView(event);
            view.getCommonViewer().refresh();
          }
 catch (          ExecutionException e) {
            Activator.logError(e.getMessage(),e);
          }
        }
      }
);
      if (delete) {
        try {
          for (          RepositoryNode node : selectedNodes) {
            Repository repo=node.getRepository();
            if (!repo.isBare())             deleteRecursive(repo.getWorkTree());
            deleteRecursive(repo.getDirectory());
          }
        }
 catch (        IOException e) {
          return Activator.createErrorStatus(e.getMessage(),e);
        }
      }
      return Status.OK_STATUS;
    }
    private void deleteRecursive(    File fileToDelete) throws IOException {
      if (fileToDelete == null)       return;
      if (fileToDelete.exists()) {
        if (fileToDelete.isDirectory()) {
          for (          File file : fileToDelete.listFiles()) {
            deleteRecursive(file);
          }
        }
        if (!fileToDelete.delete())         throw new IOException(NLS.bind(UIText.RemoveCommand_DeleteFailureMessage,fileToDelete.getAbsolutePath()));
      }
    }
  }
;
  service.schedule(job);
}