コード例 #1
0
 /**
  * Update index (delete and remove files)
  *
  * @param project the project
  * @param root a vcs root
  * @param added added/modified files to commit
  * @param removed removed files to commit
  * @param exceptions a list of exceptions to update
  * @return true if index was updated successfully
  */
 private static boolean updateIndex(
     final Project project,
     final VirtualFile root,
     final Collection<FilePath> added,
     final Collection<FilePath> removed,
     final List<VcsException> exceptions) {
   boolean rc = true;
   if (!added.isEmpty()) {
     try {
       GitFileUtils.addPaths(project, root, added);
     } catch (VcsException ex) {
       exceptions.add(ex);
       rc = false;
     }
   }
   if (!removed.isEmpty()) {
     try {
       GitFileUtils.delete(project, root, removed, "--ignore-unmatch");
     } catch (VcsException ex) {
       exceptions.add(ex);
       rc = false;
     }
   }
   return rc;
 }
コード例 #2
0
 /** Add files to the Git index. */
 public static void addFiles(
     @NotNull Project project, @NotNull VirtualFile root, @NotNull Collection<VirtualFile> files)
     throws VcsException {
   addPaths(project, root, VcsFileUtil.chunkFiles(root, files));
   updateUntrackedFilesHolderOnFileAdd(project, root, files);
 }