)]}'
{
  "commit": "89d850aab819eb2dea9d6340beab1ca810dbe18d",
  "tree": "90d6bc6221c625c939f2ad368a53be308db26411",
  "parents": [
    "4e95a60a7376bb0efe3d05df3130cfcb43c3c509"
  ],
  "author": {
    "name": "Brendan Linn",
    "email": "brendan.linn@gmail.com",
    "time": "Wed Jan 08 20:28:38 2025 -0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jan 09 04:28:38 2025 +0000"
  },
  "message": "fix: _which_unchecked: don\u0027t watch PATH if binary exists. (#2552)\n\nCurrently, the _which_unchecked helper unconditionally watches the\n`PATH` env var via repository_ctx.getenv. getenv is documented\nhttps://bazel.build/rules/lib/builtins/repository_ctx#getenv:\n\n\u003e any change to the value of the variable named by name will cause this\nrepository to be re-fetched.\n\nThus, any change to `PATH` will cause any repository rule that\ntransitively calls _which_unchecked to be re-fetched. This includes\npython_repository and whl_library.\n\nThere are reasonable development workflows that modify `PATH`. In\nparticular, when git runs a hook, it adds the value of `GIT_EXEC_PATH`\nto `PATH` before invoking the hook. If the hook invokes bazel (for\nexample, a pre-commit hook running `bazel build ...`), it will cause the\nPython repository rules to be re-fetched.\n\nThis commit lowers the repository_ctx.getenv(\"PATH\") call to its only\nuse site in _which_unchecked, which happens to be a failure case (when\nthe binary is not found). This allows the success case to not watch\n`PATH`, and therefore not to re-fetch the repository rule when it\nchanges.\n\nFixes https://github.com/bazelbuild/rules_python/issues/2551.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d343ae255ce8b7fac67040204bf51f615743116c",
      "old_mode": 33188,
      "old_path": "CHANGELOG.md",
      "new_id": "6ccc568d261ab54b7ec6fb171aa8aa6654a39206",
      "new_mode": 33188,
      "new_path": "CHANGELOG.md"
    },
    {
      "type": "modify",
      "old_id": "0e3f7b024b7fb6d7de145e351d94dd46a982d3d9",
      "old_mode": 33188,
      "old_path": "python/private/repo_utils.bzl",
      "new_id": "e5c78be815e829da6730e68e7ed06812924af2ce",
      "new_mode": 33188,
      "new_path": "python/private/repo_utils.bzl"
    }
  ]
}
