]> git.ipfire.org Git - thirdparty/git.git/commit
git-p4: fix CR LF handling for utf16 files
authorMoritz Baumann <moritz.baumann@sap.com>
Wed, 20 Jul 2022 18:17:45 +0000 (18:17 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Jul 2022 18:38:06 +0000 (11:38 -0700)
commit4d35f744219335d8b32df363891b6336dcf02a6e
tree49025a6a2bd038dc89b108d4c4d1707bd4ecb659
parentbbea4dcf42b28eb7ce64a6306cdde875ae5d09ca
git-p4: fix CR LF handling for utf16 files

Perforce silently replaces LF with CR LF for "utf16" files if the client
is a native Windows client. Since git's autocrlf logic does not undo
this transformation for UTF-16 encoded files, git-p4 replaces CR LF with
LF during the sync if the file type "utf16" is detected and the Perforce
client platform indicates that this conversion is performed.

Windows only runs on little-endian architectures, therefore the encoding
of the byte stream received from the Perforce client is UTF-16-LE and
the relevant byte sequence is 0D 00 0A 00.

Signed-off-by: Moritz Baumann <moritz.baumann@sap.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py