/**
  * Get current revision for the file under git
  *
  * @param project a project
  * @param filePath a file path
  * @return a revision number or null if the file is unversioned or new
  * @throws VcsException if there is problem with running git
  */
 @Nullable
 public static ItemLatestState getLastRevision(final Project project, FilePath filePath)
     throws VcsException {
   VirtualFile root = GitUtil.getGitRoot(filePath);
   GitBranch c = GitBranch.current(project, root);
   GitBranch t = c == null ? null : c.tracked(project, root);
   if (t == null) {
     return new ItemLatestState(getCurrentRevision(project, filePath, null), true, false);
   }
   filePath = getLastCommitName(project, filePath);
   GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.LOG);
   GitLogParser parser =
       new GitLogParser(project, GitLogParser.NameStatus.STATUS, HASH, COMMIT_TIME, SHORT_PARENTS);
   h.setNoSSH(true);
   h.setSilent(true);
   h.addParameters("-n1", parser.getPretty(), "--name-status", t.getFullName());
   h.endOptions();
   h.addRelativePaths(filePath);
   String result = h.run();
   if (result.length() == 0) {
     return null;
   }
   GitLogRecord record = parser.parseOneRecord(result);
   if (record == null) {
     return null;
   }
   final List<Change> changes = record.parseChanges(project, root);
   boolean exists = !FileStatus.DELETED.equals(changes.get(0).getFileStatus());
   record.setUsedHandler(h);
   return new ItemLatestState(
       new GitRevisionNumber(record.getHash(), record.getDate()), exists, false);
 }
 private static GitCommit createCommit(
     Project project, SymbolicRefsI refs, VirtualFile root, GitLogRecord record)
     throws VcsException {
   GitCommit gitCommit;
   final Collection<String> currentRefs = record.getRefs();
   List<String> locals = new ArrayList<String>();
   List<String> remotes = new ArrayList<String>();
   List<String> tags = new ArrayList<String>();
   final String s = parseRefs(refs, currentRefs, locals, remotes, tags);
   gitCommit =
       new GitCommit(
           root,
           AbstractHash.create(record.getShortHash()),
           new SHAHash(record.getHash()),
           record.getAuthorName(),
           record.getCommitterName(),
           record.getDate(),
           record.getSubject(),
           record.getFullMessage(),
           new HashSet<String>(Arrays.asList(record.getParentsShortHashes())),
           record.getFilePaths(root),
           record.getAuthorEmail(),
           record.getCommitterEmail(),
           tags,
           locals,
           remotes,
           record.parseChanges(project, root),
           record.getAuthorTimeStamp() * 1000);
   gitCommit.setCurrentBranch(s);
   /*final String current = refs.getCurrent().getName();
   gitCommit.setOnLocal((current != null) && (! current.startsWith(GitBranch.REFS_REMOTES_PREFIX)) &&
                        (! current.startsWith("remotes/")) && branches.contains(current));
   String remoteName = refs.getTrackedRemoteName();
   if (".".equals(remoteName)) {
     gitCommit.setOnTracked(gitCommit.isOnLocal());
   } else {
     remoteName = remoteName.startsWith("refs/") ? remoteName.substring("refs/".length()) : remoteName;
     gitCommit.setOnTracked(remoteName != null && branches.contains(remoteName));
   }*/
   return gitCommit;
 }