List<VcsException> (@NotNull List<? extends VirtualFile> files) { ArrayList<VcsException> rc = new ArrayList<>(); Map<VirtualFile, List<VirtualFile>> sortedFiles; try { sortedFiles = sortFilesByGitRoot(myProject, files); } catch (VcsException e) { rc.add(e); return rc; } for (Map.Entry<VirtualFile, List<VirtualFile>> e : sortedFiles.entrySet()) { try { final VirtualFile root = e.getKey(); GitFileUtils.addFiles(myProject, root, e.getValue()); markRootDirty(root); } catch (VcsException ex) { rc.add(ex); } } return rc; }