diff options
author | Vincent Driessen <me@nvie.com> | 2016-06-14 22:44:11 +0200 |
---|---|---|
committer | Vincent Driessen <me@nvie.com> | 2016-06-14 23:09:22 +0200 |
commit | 3ee291c469fc7ea6065ed22f344ed3f2792aa2ca (patch) | |
tree | 2b0b2e213c34fb61a0eb91f358685bb40101b1b0 /git/cmd.py | |
parent | 105a8c0fb3fe61b77956c8ebd3216738c78a3dff (diff) | |
download | gitpython-keep-raw-bytes-on-diffs.tar.gz |
Store raw path bytes in Diff instanceskeep-raw-bytes-on-diffs
Previously, the following fields on Diff instances were assumed to be
passed in as unicode strings:
- `a_path`
- `b_path`
- `rename_from`
- `rename_to`
However, since Git natively records paths as bytes, these may
potentially not have a valid unicode representation.
This patch changes the Diff instance to instead take the following
equivalent fields that should be raw bytes instead:
- `a_rawpath`
- `b_rawpath`
- `raw_rename_from`
- `raw_rename_to`
NOTE ON BACKWARD COMPATIBILITY:
The original `a_path`, `b_path`, etc. fields are still available as
properties (rather than slots). These properties now dynamically decode
the raw bytes into a unicode string (performing the potentially
destructive operation of replacing invalid unicode chars by "�"'s).
This means that all code using Diffs should remain backward compatible.
The only exception is when people would manually construct Diff
instances by calling the constructor directly, in which case they should
now pass in bytes rather than unicode strings.
See also the discussion on
https://github.com/gitpython-developers/GitPython/pull/467
Diffstat (limited to 'git/cmd.py')
0 files changed, 0 insertions, 0 deletions