)]}'
{
  "commit": "5d154d1eac1044b01f31b6422b8a9551e10bb1e4",
  "tree": "a7561c257c1bb747c9164f19857db592b6875a17",
  "parents": [
    "eb29aa6a92ff38818873c89f08c704037f6a4bf2"
  ],
  "author": {
    "name": "Marcin Kowalczyk",
    "email": "qrczak@google.com",
    "time": "Thu Apr 16 12:23:58 2026 +0200"
  },
  "committer": {
    "name": "Marcin Kowalczyk",
    "email": "qrczak@google.com",
    "time": "Fri Apr 17 11:50:09 2026 +0200"
  },
  "message": "Make conversion from `{String,Bytes,Path}Ref` to `absl::string_view` explicit.\nSame for conversion from `{Bytes,Path}Ref` to `StringRef`. Conversions in the\nother direction remain implicit.\n\nMutual implicit conversions are prone to ambiguities, e.g. in heterogeneous\ncalls to `\u003d\u003d`.\n\nComparisons are especially problematic, as subtleties of overload resolution\ndepend on whether secondary comparison operators are derived automatically\nin C++20 or emulated in C++17 with `WithEqual` and `WithCompare`. If primary\ncomparison operators have concrete parameter types, then C++20 provides\nsecondary comparison operators with the same parameter types, for which argument\nconversions happen in the caller, while C++17 emulataion provides templates for\nwhich argument conversions happen in the callee.\n\nTypes `StringRef` etc. are designed for function parameters. It is important\nthat they accept any suitable argument, i.e. conversions to them are important\nto be implicit. OTOH consuming these parameters can be less convenient, and\nconversions from them can be explicit.\n\nLet `BytesRef` and `PathRef` derive from `StringRefBase` extracted from\n`StringRef` rather than from `StringRef` itself. The latter would make\n`BytesRef` implicitly convertible to `StringRef`, while we prefer\nthe other direction: `BytesRef` accepts more types than `StringRef`, e.g.\n`Span\u003cconst char\u003e`, so `BytesRef` should accept `StringRef` instead of\nthe other way around.\n\nMake `CStringRef` convertible from types convertible to `std::string`, e.g.\n`StringInitializer`. This improves compatibility with `StringRef`.\n\nPolish constructors of `StringRef` etc.:\n\n* Accept view types by value. This lets `ABSL_ATTRIBUTE_LIFETIME_BOUND` apply\n  only to what the view is constructed from, but not to the view object itself.\n  The view can safely be a temporary. Also, this reduces template instantiations\n  in common usages.\n\n* Remove `ABSL_ATTRIBUTE_LIFETIME_BOUND` where the parameter reference is not\n  actually retained because its data have been just copied to `std::string`.\n\n* Constrain templates by types being convertible to `absl::string_view` rather\n  than to `StringRef` etc. The latter conversions may keep data in defaulted\n  arguments, which do not survive forwarding, so they should not be used inside\n  implementations of other conversions to view types.\n\nCoalesce comments about the constructors. A single comment states the goal of\nmultiple constructors, rather than details of the order of conversions and\nmaterialization by each constructor. The details are not that important,\nand the expectations about arguments are already stated in class comments.\n\nMake `BytesRef` comparable only against itself, and make `CompactString`\nand `OptionalCompactString` comparable against `absl::string_view` but not\n`BytesRef`. While this disallows direct comparisons between e.g. `CompactString`\nand `std::array\u003cchar, length\u003e`, this reduces ambiguities in cases like\n`CompactString \u003d\u003d StringRef`. Arbitrary types convertible to `BytesRef`\nare not necessarily comparable anyway, e.g. `std::string` against\n`std::array\u003cchar, length\u003e`, so `CompactString` does not need to cover that.\n\n`BytesRef` remains implicitly convertible both from and to\n`absl::Span\u003cconst char\u003e`. This is hard to avoid because `absl::Span\u003cconst char\u003e`\nis convertible from any type providing suitable `data()` and `size()`,\nwhich includes `BytesRef`.\n\n`BytesRef` cannot be reliably compared against `absl::Span\u003cconst char\u003e` in C++17\nmode. This is so because `absl::Span` provides a comparison against any type\nconvertible to `absl::Span`, which is ambiguous wrt. comparisons provided by\n`WithCompare\u003cBytesRef\u003e`. It is comparable in C++20 mode though, because overload\nresolution prefers templated operators provided by `Span` over converting `Span`\nto `BytesRef` on the caller side.\n\nPiperOrigin-RevId: 900626152\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "5be6bb44349265df900f646683d3c3170652c8e2",
      "old_mode": 33188,
      "old_path": "riegeli/base/BUILD",
      "new_id": "4a8299ae1d3c887c47896fd5fdfc75f41d9177f8",
      "new_mode": 33188,
      "new_path": "riegeli/base/BUILD"
    },
    {
      "type": "modify",
      "old_id": "d8d43a1b0cc26506bd38cd478a1f3b5e3610fb65",
      "old_mode": 33188,
      "old_path": "riegeli/base/bytes_ref.h",
      "new_id": "93ef9213cd3767ff1b3b7c27c029f39b2dda016a",
      "new_mode": 33188,
      "new_path": "riegeli/base/bytes_ref.h"
    },
    {
      "type": "modify",
      "old_id": "bef558831d862366234d183c1b02ccc312ed2b7c",
      "old_mode": 33188,
      "old_path": "riegeli/base/c_string_ref.h",
      "new_id": "8ce45647cdf7580b1b706fda40a43be7e8b1c2db",
      "new_mode": 33188,
      "new_path": "riegeli/base/c_string_ref.h"
    },
    {
      "type": "modify",
      "old_id": "d19394f45077744fbfe81b27b6742e3b11382f0f",
      "old_mode": 33188,
      "old_path": "riegeli/base/chain.cc",
      "new_id": "17d917d3369b271aee2aef84a203815e84cc2679",
      "new_mode": 33188,
      "new_path": "riegeli/base/chain.cc"
    },
    {
      "type": "modify",
      "old_id": "d48c4779fcd01691bf246352d1a7fa71fb2e723d",
      "old_mode": 33188,
      "old_path": "riegeli/base/chain_details.h",
      "new_id": "432dfd2973c0aaf52a7836ac69039c9d1eeba682",
      "new_mode": 33188,
      "new_path": "riegeli/base/chain_details.h"
    },
    {
      "type": "modify",
      "old_id": "a7079b330338efdacab34ce484af8f4b16dfd960",
      "old_mode": 33188,
      "old_path": "riegeli/base/compact_string.h",
      "new_id": "66542c82457c04430794ba3cc01dbba4ee65d90f",
      "new_mode": 33188,
      "new_path": "riegeli/base/compact_string.h"
    },
    {
      "type": "modify",
      "old_id": "530baabf0f2c107cee0f84a726975d6d1d4d682a",
      "old_mode": 33188,
      "old_path": "riegeli/base/dependency.h",
      "new_id": "9ecb4aa3ca3604f863a2c57acd85af0807de7796",
      "new_mode": 33188,
      "new_path": "riegeli/base/dependency.h"
    },
    {
      "type": "modify",
      "old_id": "aaa8c38648be957fdcbc2a46f7ae892a57c7c803",
      "old_mode": 33188,
      "old_path": "riegeli/base/external_ref_base.h",
      "new_id": "f0bb5784d8b07e35568fc7b970cb313ea5040755",
      "new_mode": 33188,
      "new_path": "riegeli/base/external_ref_base.h"
    },
    {
      "type": "modify",
      "old_id": "a6bf69ebcdd50b672ec64223e7977a34dbf28188",
      "old_mode": 33188,
      "old_path": "riegeli/base/optional_compact_string.h",
      "new_id": "506df7f24bfeccd97fdc7e90999f3f7e85b4beee",
      "new_mode": 33188,
      "new_path": "riegeli/base/optional_compact_string.h"
    },
    {
      "type": "modify",
      "old_id": "6c0eff2a388ac5d3dd4a60e016193e1baad83e1f",
      "old_mode": 33188,
      "old_path": "riegeli/base/string_ref.h",
      "new_id": "a2796db7d72edc5ddf712986f391a3124c252340",
      "new_mode": 33188,
      "new_path": "riegeli/base/string_ref.h"
    },
    {
      "type": "modify",
      "old_id": "6575b3fbd6366568da99430a3415a84cf1daec61",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/BUILD",
      "new_id": "de6b70bae05291954b28217356e9d792bf8c122a",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/BUILD"
    },
    {
      "type": "modify",
      "old_id": "d81bf444bd5d9005956c0f336ecc76507060e485",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/backward_writer.h",
      "new_id": "7aa7ff1c087d993e18b4a5eacc84bd57d1f6846c",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/backward_writer.h"
    },
    {
      "type": "modify",
      "old_id": "ef9e9dcee586d910a90ed16cef4aee5dbd080f57",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/fd_handle.cc",
      "new_id": "c1e6c1ae20541a3f7ced3d2e13a38063d05059c3",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/fd_handle.cc"
    },
    {
      "type": "modify",
      "old_id": "cc1edda1ed4e9f383f58a370737ba7e6ce84746a",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/fd_handle.h",
      "new_id": "dab232a01bcd4d9edd8b7cfc1734ee88eed73189",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/fd_handle.h"
    },
    {
      "type": "modify",
      "old_id": "0fb7e52869cf3b2d037a5773de0fa71b5e118644",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/fd_mmap_reader.h",
      "new_id": "d5e77b9b00f1ba63da60ff6fed00fcb94deef80b",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/fd_mmap_reader.h"
    },
    {
      "type": "modify",
      "old_id": "4cefa8c26d20563d4061dc28c0ac08d8318c934e",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/fd_reader.h",
      "new_id": "a660d043fd1824d06ee22b9de0f88021796f4140",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/fd_reader.h"
    },
    {
      "type": "modify",
      "old_id": "0239fac78f956a56f3fb79f80969f91ad8f255a2",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/fd_writer.h",
      "new_id": "48f3009da439de2826362b10f815b44e307d579a",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/fd_writer.h"
    },
    {
      "type": "modify",
      "old_id": "dbd54becf4ad090876bb5751d16f3eeaddb3ce3f",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/path_ref.h",
      "new_id": "0b002456daf988c9c059524d607b2e3bd8a162a7",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/path_ref.h"
    },
    {
      "type": "modify",
      "old_id": "2404a1f67f0c5b5c9ea21b02c214a5fcb60d256f",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/string_reader.h",
      "new_id": "b73396e518c40e2c2bec6c849ba3145f08308001",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/string_reader.h"
    },
    {
      "type": "modify",
      "old_id": "1527bbddd34b7a73fd151a1715cfe70989865757",
      "old_mode": 33188,
      "old_path": "riegeli/bytes/writer.h",
      "new_id": "c7087c9e57c7023f001d03eb41b9a13175b1cafa",
      "new_mode": 33188,
      "new_path": "riegeli/bytes/writer.h"
    },
    {
      "type": "modify",
      "old_id": "15aa45b5504eb6f9259f2377517a0e6a39ada547",
      "old_mode": 33188,
      "old_path": "riegeli/chunk_encoding/deferred_encoder.cc",
      "new_id": "a0a267f1d88c9a74ac05eb9c21c9e62e0be8c1ff",
      "new_mode": 33188,
      "new_path": "riegeli/chunk_encoding/deferred_encoder.cc"
    },
    {
      "type": "modify",
      "old_id": "a9c3934b39a08e8052931d8bfc31dc2ac8f7344a",
      "old_mode": 33188,
      "old_path": "riegeli/chunk_encoding/simple_encoder.cc",
      "new_id": "b1867425fa6bf702d5ce47d95460257b7945290b",
      "new_mode": 33188,
      "new_path": "riegeli/chunk_encoding/simple_encoder.cc"
    },
    {
      "type": "modify",
      "old_id": "2c7c62f0cc194bba6a7747b586a2d72ef224f709",
      "old_mode": 33188,
      "old_path": "riegeli/digests/digester_handle.h",
      "new_id": "bb9e9b9cec20fea66aa447070e93e92bdccf3d66",
      "new_mode": 33188,
      "new_path": "riegeli/digests/digester_handle.h"
    },
    {
      "type": "modify",
      "old_id": "e1716e3634eafa042d248a6793191ef7658b3a7d",
      "old_mode": 33188,
      "old_path": "riegeli/messages/serialized_message_reader.h",
      "new_id": "510abf47be1471bfa88b81c7494a024fef9a9502",
      "new_mode": 33188,
      "new_path": "riegeli/messages/serialized_message_reader.h"
    },
    {
      "type": "modify",
      "old_id": "66497552988c023ac3bd2010ad3045c18701bef3",
      "old_mode": 33188,
      "old_path": "riegeli/records/record_writer.cc",
      "new_id": "23ac9f2dc2a70ff9f37e30214632a9ccfe8fa139",
      "new_mode": 33188,
      "new_path": "riegeli/records/record_writer.cc"
    }
  ]
}
