)]}'
{
  "commit": "f7b5ff607fa1a62a480399afb6ccb9691735bf79",
  "tree": "fbf3bc4cda3b6e879c0d2652c6ac32e96767d447",
  "parents": [
    "6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e"
  ],
  "author": {
    "name": "Tao Klerks",
    "email": "tao@klerks.biz",
    "time": "Sat Apr 30 19:26:52 2022 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Wed May 04 10:30:01 2022 -0700"
  },
  "message": "git-p4: improve encoding handling to support inconsistent encodings\n\ngit-p4 is designed to run correctly under python2.7 and python3, but\nits functional behavior wrt importing user-entered text differs across\nthese environments:\n\nUnder python2, git-p4 \"naively\" writes the Perforce bytestream into git\nmetadata (and does not set an \"encoding\" header on the commits); this\nmeans that any non-utf-8 byte sequences end up creating invalidly-encoded\ncommit metadata in git.\n\nUnder python3, git-p4 attempts to decode the Perforce bytestream as utf-8\ndata, and fails badly (with an unhelpful error) when non-utf-8 data is\nencountered.\n\nPerforce clients (especially p4v) encourage user entry of changelist\ndescriptions (and user full names) in OS-local encoding, and store the\nresulting bytestream to the server unmodified - such that different\nclients can end up creating mutually-unintelligible messages. The most\ncommon inconsistency, in many Perforce environments, is likely to be utf-8\n(typical in linux) vs cp-1252 (typical in windows).\n\nMake the changelist-description- and user-fullname-handling code\npython-runtime-agnostic, introducing three \"strategies\" selectable via\nconfig:\n- \u0027passthrough\u0027, behaving as previously under python2,\n- \u0027strict\u0027, behaving as previously under python3, and\n- \u0027fallback\u0027, favoring utf-8 but supporting a secondary encoding when\nutf-8 decoding fails, and finally escaping high-range bytes if the\ndecoding with the secondary encoding also fails.\n\nKeep the python2 default behavior as-is (\u0027legacy\u0027 strategy), but switch\nthe python3 default strategy to \u0027fallback\u0027 with default fallback encoding\n\u0027cp1252\u0027.\n\nAlso include tests exercising these encoding strategies, documentation for\nthe new config, and improve the user-facing error messages when decoding\ndoes fail.\n\nSigned-off-by: Tao Klerks \u003ctao@klerks.biz\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e21fcd8f7127a3a8e9e6fcb5a268ab66a097b3a2",
      "old_mode": 33188,
      "old_path": "Documentation/git-p4.txt",
      "new_id": "de5ee6748e35886fd38cf3a4a73b28f270e06e2c",
      "new_mode": 33188,
      "new_path": "Documentation/git-p4.txt"
    },
    {
      "type": "modify",
      "old_id": "a9b1f9044108e4dce94b865f1f777039d8755613",
      "old_mode": 33261,
      "old_path": "git-p4.py",
      "new_id": "d24c3535f8ac44d286199c9abf384df6eed5ca2c",
      "new_mode": 33261,
      "new_path": "git-p4.py"
    },
    {
      "type": "modify",
      "old_id": "5aff2abe8b5490156e7745beb5ad01d9cacc0d58",
      "old_mode": 33188,
      "old_path": "t/lib-git-p4.sh",
      "new_id": "2a5b8738ea37da950b65cd8a3357b9ebdb59363e",
      "new_mode": 33188,
      "new_path": "t/lib-git-p4.sh"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "036bf79c6674f6f1f0d667c7270674168428ffee",
      "new_mode": 33261,
      "new_path": "t/t9835-git-p4-metadata-encoding-python2.sh"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "63350dc4b5c6262480cd0be8fd88fba714c55428",
      "new_mode": 33261,
      "new_path": "t/t9836-git-p4-metadata-encoding-python3.sh"
    }
  ]
}
