Disable rename detection when computing changed files

To detect renames Git must compare file contents of deleted and added
files. Loading and comparing file contents is rather expensive and is
likely the reason why we are seeing a high latency for computing the
changed files for 1% of the changes.

By turning off the rename detection we expect that Git can do a pure
tree diff without needing to load file contents, which should be much
faster.

The rename detection in DiffFormatter is off by default, it gets turned
on only if either DiffFormatter#setDetectRenames(true) or
DiffFormatter#setPathFilter(TreeFilter.FOLLOW) is called. We rely on the
default since it's very unlikely that this default will ever change (and
if it does our rename tests will start failing).

Turning off the rename detection affects the Get Code Owner Status REST
endpoint. For renamed files it now returns 2 file code owner statuses,
one for the old path and one for the new path.

Example:

* old:

  ...
  {
    "change_type": "RENAMED",
    "old_path_status" {
      "path": "user-introduction.txt",
      "status": "INSUFFICIENT_REVIEWERS"
    },
    "new_path_status" {
      "path": "docs/user-intro.md",
      "status": "APPROVED"
    }
  }
  ...

* new:

  ...
  {
    "change_type": "ADDED",
    "new_path_status" {
      "path": "docs/user-intro.md",
      "status": "APPROVED"
    }
  },
  {
    "change_type": "DELETED",
    "old_path_status" {
      "path": "user-introduction.txt",
      "status": "INSUFFICIENT_REVIEWERS"
    }
  }
  ...

This change in behaviour requires an update in the frontend, otherwise
the code owner status icon for renamed files in the file list could be
wrong, as it would only considers the status for the new path, but not
for the old path.

The tests with renamed paths have been adapted accordingly. Since paths
are always returned in alphabetical order, the tests know which path
(new or old path) is returned first in the response and hence the
assertions can rely on this order.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I9a1d6ba9d23b2ba2b5fe2c8afcc0ed0598400041
7 files changed
tree: 63a7a41d04a5e3e7f97bd171d2843c6ab468cc02
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.