示例#1
0
 /**
  * git diff --name-only [--cached]
  *
  * @return true if there is anything in the unstaged/staging area, false if the unstraed/staging
  *     area is empty.
  * @param staged if true checks the staging area, if false checks unstaged files.
  * @param project
  * @param root
  */
 public static boolean hasLocalChanges(boolean staged, Project project, VirtualFile root)
     throws VcsException {
   final GitSimpleHandler diff = new GitSimpleHandler(project, root, GitCommand.DIFF);
   diff.addParameters("--name-only");
   if (staged) {
     diff.addParameters("--cached");
   }
   diff.setStdoutSuppressed(true);
   diff.setStderrSuppressed(true);
   diff.setSilent(true);
   final String output = diff.run();
   return !output.trim().isEmpty();
 }