private static @Nullable FilePath doGetBlobPathInRevision(@NotNull Project project,
                                                            final @NotNull VirtualFile root,
                                                            final @NotNull String blob,
                                                            @NotNull VcsRevisionNumber revision,
                                                            @Nullable FilePath path) {
    final FilePath[] result = new FilePath[1];
    final boolean[] pathAmbiguous = new boolean[1];

    GitLineHandler h = new GitLineHandler(project, root, GitCommand.LS_TREE);
    h.addParameters(revision.asString());

    if (path != null) {
      h.endOptions();
      h.addRelativePaths(path);
    }
    else {
      h.addParameters("-r");
      h.endOptions();
    }

    h.addLineListener(new GitLineHandlerListener() {
      @Override
      public void onLineAvailable(String line, Key outputType) {
        if (outputType != ProcessOutputTypes.STDOUT) return;
        if (!line.contains(blob)) return;
        if (pathAmbiguous[0]) return;

        GitIndexUtil.StagedFileOrDirectory stagedFile = GitIndexUtil.parseListTreeRecord(root, line);
        if (stagedFile instanceof GitIndexUtil.StagedFile && blob.equals(((GitIndexUtil.StagedFile)stagedFile).getBlobHash())) {
          if (result[0] == null) {
            result[0] = stagedFile.getPath();
          }
          else {
            // there are multiple files with given content in this revision.
            // we don't know which is right, so do not return any
            pathAmbiguous[0] = true;
          }
        }
      }
    });
    GitCommandResult commandResult = Git.getInstance().runCommandWithoutCollectingOutput(h);
    if (!commandResult.success()) return null;

    if (pathAmbiguous[0]) return null;
    return result[0];
  }
private static @Nullable FilePath doGetBlobPathInRevision(@NotNull Project project,
                                                            final @NotNull VirtualFile root,
                                                            final @NotNull String blob,
                                                            @NotNull VcsRevisionNumber revision,
                                                            @Nullable FilePath path)