We get the binary representation here on both python 2 and 3,
but on 2 we really don't need to do any decoding since we must
print it as 'str'. Decoding also fails if the input is valid
UTF-8, which seems strange, but even if it worked we actually
don't want unicode objects here to print, we'd have to encode
them again to print.
Reported-by: Henninger Henningstone <henningstone@gmx.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
if compat.py_maj > 2:
def byte_stream(file):
return file.buffer
+
+ def path_msg(x):
+ """Return a string representation of a path."""
+ # FIXME: configurability (might git-config quotePath be involved?)
+ return x.decode(errors='backslashreplace')
else:
def byte_stream(file):
return file
-
-def path_msg(x):
- """Return a string representation of a path."""
- # FIXME: configurability (might git-config quotePath be involved?)
- return x.decode(errors='backslashreplace')
+ def path_msg(x):
+ """Return a string representation of a path."""
+ # FIXME: configurability (might git-config quotePath be involved?)
+ return x