Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKilian Kilger <kilian.kilger@sap.com>2022-07-08 11:01:00 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-08 17:59:12 +0300
commit34f67c9619b56ab4718427c1a31071641f0dccdb (patch)
tree3bd6db437a1536eed9351db5e6fa5cc52677ff41 /git-p4.py
parente4a4b31577c7419497ac30cebe30d755b97752c5 (diff)
git-p4: fix bug with encoding of p4 client name
The Perforce client name can contain arbitrary characters which do not decode to UTF-8. Use the fallback strategy implemented in metadata_stream_to_writable_bytes() also for the client name. Signed-off-by: Kilian Kilger <kkilger@gmail.com> Reviewed-by: Tao Klerks <tao@klerks.biz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-p4.py b/git-p4.py
index 8fbf6eb1fe..e65d6a2b0e 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -854,12 +854,12 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
if bytes is not str:
# Decode unmarshalled dict to use str keys and values, except for:
# - `data` which may contain arbitrary binary data
- # - `desc` or `FullName` which may contain non-UTF8 encoded text handled below, eagerly converted to bytes
+ # - `desc` or `client` or `FullName` which may contain non-UTF8 encoded text handled below, eagerly converted to bytes
# - `depotFile[0-9]*`, `path`, or `clientFile` which may contain non-UTF8 encoded text, handled by decode_path()
decoded_entry = {}
for key, value in entry.items():
key = key.decode()
- if isinstance(value, bytes) and not (key in ('data', 'desc', 'FullName', 'path', 'clientFile') or key.startswith('depotFile')):
+ if isinstance(value, bytes) and not (key in ('data', 'desc', 'FullName', 'path', 'clientFile', 'client') or key.startswith('depotFile')):
value = value.decode()
decoded_entry[key] = value
# Parse out data if it's an error response
@@ -871,6 +871,8 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
continue
if 'desc' in entry:
entry['desc'] = metadata_stream_to_writable_bytes(entry['desc'])
+ if 'client' in entry:
+ entry['client'] = metadata_stream_to_writable_bytes(entry['client'])
if 'FullName' in entry:
entry['FullName'] = metadata_stream_to_writable_bytes(entry['FullName'])
if cb is not None: