)]}'
{
  "commit": "b80b8fde601f3bee9a4174c4aef03a3811912b93",
  "tree": "8a434c13fd3c581c850d0f185b4c27a38df6bf24",
  "parents": [
    "86eadf1ecf89f346476354f42d4d5bc861acab1b"
  ],
  "author": {
    "name": "Mathieu Sabourin",
    "email": "mathieu.c.sabourin@gmail.com",
    "time": "Fri Apr 07 23:52:41 2023 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Apr 07 23:52:41 2023 -0700"
  },
  "message": "fix: respect kind mapping (#1158)\n\nWhen using the kind `gazelle:map_kind` directive, `gazelle` will\r\ncorrectly generate the buildfile on the first pass (or if no target of\r\nthat type / name are present).\r\n\r\nHowever, when running gazelle a second time (or if a target of the\r\nmapped kind with the same name is present), `gazelle` will error out\r\nsaying that it kind create a target of the original kind because a\r\ntarget of mapped kind is present and has the same name.\r\n\r\nEx:\r\nGiven the directive `# gazelle:map_kind py_test py_pytest_test\r\n//src/bazel/rules/python:py_pytest_test.bzl`, `gazelle` will correctly\r\ngenerate a `py_pytest_test` target where it would have generated a\r\n`py_test` target.\r\n\r\nBut on a second invocation of `gazelle` (and subsequent invocations) it\r\nwill error our with:\r\n```\r\ngazelle: ERROR: failed to generate target \"//test/python/common:common_test\" of kind \"py_test\": a target of kind \"py_pytest_test\" with the same name already exists. Use the \u0027# gazelle:python_test_naming_convention\u0027 directive to change the naming convention.\r\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "26ffedaca2ebe029909f3d5fa7165a07290ce4c6",
      "old_mode": 33188,
      "old_path": "gazelle/python/generate.go",
      "new_id": "fb41324fd60546981b84c2fb90da87a3f52c4c9c",
      "new_mode": 33188,
      "new_path": "gazelle/python/generate.go"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6a0673762378342e19c80d840377ecc3e8b3d0a2",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/BUILD.in"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7c5fb0bd207d38bb1268443a36484b61a094709c",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/BUILD.out"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "9f0fa6cf39127f9d7ad819c0c4af37e1879e684c",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/README.md"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "faff6af87ac0ef60c3f9dacae80ca00b08118b58",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/WORKSPACE"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b274b0d921326d8c3d12425bad8e887a05d6450e",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/__init__.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "2b180a5f5384ee60d21cc2549f43c6d85e3fc9db",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/__test__.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "932de45b7487433a06bc5dd66285b69ebba42cab",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/foo.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "2410223e5999e8b2ef1720863d19e2012a0974eb",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/respect_kind_mapping/test.yaml"
    }
  ]
}
