)]}'
{
  "commit": "91bba01d7ad01b83133b29324e131389deb7a80a",
  "tree": "32b7249c04fd4ea402764a0d13a3ce653d946573",
  "parents": [
    "e8bedb10e9357f7e4607e7685eda6fc7a206d6f1"
  ],
  "author": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Fri Jan 29 11:13:33 2021 +0100"
  },
  "committer": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Fri Jan 29 14:37:16 2021 +0100"
  },
  "message": "FindOwnersBackend: Fix incompatibility of handling globs\n\nThe find-owners backend promises to be compatible with the syntax of the\nfind-owners plugin, but currently the handling of globs differs.\n\nThe find-owners plugin ignores subdirectories when checking if a glob\nmatches a file.\n\nExamples:\n1. the glob \"*.md\" in \"/\" matches \"foo.md\", \"bar/foo.md\" and\n   \"baz/bar/foo.md\"\n2. the glob \"BUILD\" in \"/\" matches \"BUILD\", \"bar/BUILD\" and\n   \"baz/bar/BUILD\"\n3. the glob \"foo-[1-4].txt\" in \"/\" matches \"foo-1.txt\", \"bar/foo-1.txt\"\n   and \"baz/bar/foo-1.txt\"\n\nThis is because the find-owners plugin iterates over all parent\ndirectories [1,2] to see if there is a glob that matches the\nfilename [3]. E.g. if the glob \"*.md\" is defined at \u0027/\u0027 and the file\npath is \"baz/bar/foo.md\" then it does the following checks:\na. Is there a glob at \"./baz/bar\" that matches file \"./baz/bar/foo.md\" (no)\nb. Is there a glob at \"./baz\" that matches file \"./baz/foo.md\" (no)\nc. Is there a glob at \"./\" that matches file \"./foo.md\" (yes)\n\nEffectively this means that subdirectories are ignored (although the\nactual file is \"./baz/bar/foo.md\" the find-owners plugin checks the glob\nagainst \"./foo.md\").\n\nTo be compatible with this behaviour the code-owners plugin needs to\nignore subdirectories too when checking if a file matches a glob.\nInstead of iterating over the parent directories for each file as it\u0027s\ndone in the find-owners plugin, we simply prefix all globs with \"{**/,}\"\n(\"{**/,}\" matches \"**/\" or \"\", which matches any subdirectory and no\nsubdirectory).\n\nChange I1ddc8bf32 was a first attempt to fix this by replacing \"*\" with\n\"**\" in globs, but this only fixed case 1 (and not the cases 2 and 3).\n\n[1] https://gerrit.googlesource.com/plugins/find-owners/+/refs/heads/master/src/main/java/com/googlesource/gerrit/plugins/findowners/OwnersDb.java#367\n[2] https://gerrit.googlesource.com/plugins/find-owners/+/refs/heads/master/src/main/java/com/googlesource/gerrit/plugins/findowners/OwnersDb.java#396\n[3] https://gerrit.googlesource.com/plugins/find-owners/+/refs/heads/master/src/main/java/com/googlesource/gerrit/plugins/findowners/OwnersDb.java#375\n\nBug: Issue 14008\nSigned-off-by: Edwin Kempin \u003cekempin@google.com\u003e\nChange-Id: I04931606858511fb1c36c449a4ce3f2300eabecf\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2db7b6d2bfb365372fca769048aa2b2ad0e2c00b",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/backend/FindOwnersGlobMatcher.java",
      "new_id": "650ae504717506bb5ea83a0fc9b654b3963111d8",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/backend/FindOwnersGlobMatcher.java"
    },
    {
      "type": "modify",
      "old_id": "7e0c03eed5db9dd181c97fc58bc18d8bcb625dd1",
      "old_mode": 33188,
      "old_path": "javatests/com/google/gerrit/plugins/codeowners/backend/FindOwnersGlobMatcherTest.java",
      "new_id": "8696f198ebb9032cd4b57a87d9ec7e9bde7d0b98",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/backend/FindOwnersGlobMatcherTest.java"
    },
    {
      "type": "modify",
      "old_id": "75affd9315ce940362a19fabee84bbc192040cfc",
      "old_mode": 33188,
      "old_path": "javatests/com/google/gerrit/plugins/codeowners/backend/GlobMatcherTest.java",
      "new_id": "5291bb7faca778e5278d0c684aaacbda4483de1c",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/backend/GlobMatcherTest.java"
    },
    {
      "type": "modify",
      "old_id": "322d757ddf5047e10093a6eb811789fbbaf801ad",
      "old_mode": 33188,
      "old_path": "resources/Documentation/path-expressions.md",
      "new_id": "e5c2dd801a9680b764f80eaa5ade34747132193c",
      "new_mode": 33188,
      "new_path": "resources/Documentation/path-expressions.md"
    }
  ]
}
