LogServlet: Handle HEAD symref to non-existent branch

The ObjectId of a Ref can be null. If HEAD is a symbolic ref to a
non-existent branch, headRef.getObjectId() will return null. The
current LogServlet code does not handle this, causing
NullPointerException in RevWalk.

This issue is particularly common when a repo is created but nothing is
pushed yet; so a HEAD symmetry is created to point to refs/heads/main by default but lacks a commit SHA.

Treat a HEAD ref with a null ObjectId as if the ref itself were null,
returning no view instead of throwing an internal error.

Change-Id: I4fe85010db0694403770923fcdf957854e72cd34
Signed-off-by: Xing Huang <[email protected]>
1 file changed
tree: acb9de58e85d3c5b9880c3c20c1427abac50fd2c
  1. .settings/
  2. Documentation/
  3. java/
  4. javatests/
  5. lib/
  6. modules/
  7. resources/
  8. tools/
  9. .bazelrc
  10. .bazelversion
  11. .gitignore
  12. .gitmodules
  13. .mailmap
  14. .zuul.yaml
  15. BUILD
  16. COPYING
  17. fake_pom_deploy.xml
  18. navbar.md
  19. README.md
  20. version.bzl
  21. WORKSPACE
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.