)]}'
{
  "commit": "5ceb2d5d72c33ca8928557d7e09e059fc86c5d9c",
  "tree": "9a704ffe3ac911bf6eb38f164e0cf1040fa43d7d",
  "parents": [
    "85d963c70f6e715c6d40906c671d324cddf64604"
  ],
  "author": {
    "name": "Xiaoyi",
    "email": "ashi009@users.noreply.github.com",
    "time": "Mon Nov 16 16:05:16 2026 +0000"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Nov 16 16:05:16 2026 +0000"
  },
  "message": "crate_universe: use repository_ctx APIs instead of `cp`/`find` in `local_crate_mirror` (#4427)\n\nFixes #4426.\n\nReplaces `cp -r` and the `find` + `read` loop with a Starlark copy\n(`readdir`, `read`, `file`) plus `repository_ctx.watch_tree`, so\n`local_crate_mirror` works on Windows.\n\n- Files are copied rather than symlinked, so the mirror stays\nself-contained. An earlier revision of this PR used symlinks and failed\n`local_path (external)`: that test vendors into `mktemp -d`, and the\nLinux sandbox hides `/tmp`.\n- `legacy_utf8 \u003d False` keeps the copy byte-exact on Bazel 7.\n- The walk passes `watch \u003d \"no\"` because `watch_tree` already covers the\ntree. With the default watches, deleting a subdirectory of the crate\nfailed the refetch with \"Inconsistent filesystem operations\".\n- `watch_tree` is called before the copy, so an edit made during the\ncopy still refetches.\n- `repository_ctx` cannot read file modes, so every copied file is\nexecutable. `cp -r` kept modes, but this keeps any script a build script\nruns working.\n- Symlinks inside the crate are followed. `cp -r` kept them as links.\n\nThis does what the #3025 review asked for (no shell, `watch_tree`). That\nreview left `watch` erroring on out-of-workspace paths as an open\nconcern; it is retested below.\n\nTested with stock rules_rust 0.75.0 plus this change, using the repro in\n#4426:\n- The repro builds on Bazel 8.7.0 and 7.4.1. The mirror has no symlinks,\nand every file matches its source byte for byte.\n- A file of all 256 byte values, a UTF-8 file and nested directories\ncopy byte-exact on both versions.\n- An edit to the linked crate rebuilds it: appending `compile_error!`\nfails the build and reverting it builds again. This holds for\nin-workspace paths and for absolute out-of-workspace paths.\n- Adding a nested directory to the crate shows up in the mirror, and\ndeleting it removes it (3 cycles, no errors).\n- Our monorepo\u0027s Windows build, which failed as in #4426, passes with\nthe symlink revision of this change. The copy revision has not been run\non Windows yet.\n\n`repository_ctx.copy` (Bazel 10) could replace the walk once that is the\nminimum version.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "edf49a6ce03ba24d404ba7f8cbd4523a962134f3",
      "old_mode": 33188,
      "old_path": "crate_universe/private/local_crate_mirror.bzl",
      "new_id": "f8b5befc0fca1a4cd9a23a1b6f23ef66c28191f8",
      "new_mode": 33188,
      "new_path": "crate_universe/private/local_crate_mirror.bzl"
    }
  ]
}
