BlameCache: Add reader for .git-blame-ignore-revs files

Many projects list bulk reformatting and other mechanical commits in a
.git-blame-ignore-revs file at the root of the repository. git (through
blame.ignoreRevsFile), GitHub and GitLab use this file to keep those
commits out of blame. BlameCache.get() already accepts a set of
revisions to ignore, but each caller would have to find, read and parse
the file itself.

Add IgnoreRevFileReader, which reads such a file from the tree of a
commit and returns an IgnoreRevsFile record containing the listed
revisions, ready to pass to BlameCache.get(). Keeping the reader in the
blame cache library lets Gitiles and Gerrit share one implementation.

The format matches git: one full commit SHA-1 per line, "#" starts a
comment and blank lines are skipped. Unlike git, a malformed line is
skipped instead of rejecting the whole file. Only regular files are
read; a directory, symlink or submodule at the path is ignored.

Callers may read the file on every blame request, so reading is
bounded: files larger than 1 MiB are ignored and at most 20,000
revisions are used.

The BlameCache interface is unchanged.

Change-Id: I381018685e49c327c6ba14a5974386535a311913
2 files changed
tree: e7ed7d33adeb18eadba5b402f9d90d5415cc1590
  1. .settings/
  2. Documentation/
  3. java/
  4. javatests/
  5. lib/
  6. modules/
  7. resources/
  8. tools/
  9. .bazelignore
  10. .bazelrc
  11. .bazelversion
  12. .gitignore
  13. .gitmodules
  14. .mailmap
  15. .zuul.yaml
  16. BUILD
  17. COPYING
  18. external_deps.lock.json
  19. fake_pom_deploy.xml
  20. MODULE.bazel
  21. MODULE.bazel.lock
  22. navbar.md
  23. README.md
  24. version.bzl
README.md

Gitiles - A simple JGit repository browser

Gitiles is a simple repository browser for Git repositories, built on JGit. Its guiding principle is simplicity: it has no formal access controls, no write access, no fancy Javascript, etc.

Gitiles automatically renders *.md Markdown files into HTML for simplified documentation. Refer to the Markdown documentation for details.

Configuration

Gitiles is configurable in a git-style configuration file named gitiles.config. Refer to the configuration documentation for details.

Bugs

Use gerrit's issue tracker to file bugs.

Contributing to Gitiles

Please refer to the Developer Guide.