git-p4: handle utf16 filetype properly
commit55aa5714afc1310fd94936a8cd922e868d694bd2
authorPete Wyckoff <pw@padd.com>
Sat, 17 Sep 2011 23:16:14 +0000 (17 19:16 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Oct 2011 03:45:28 +0000 (17 20:45 -0700)
tree37f8c46abdbf700cfb2bb2d5812c6b3bc2de51a9
parentfc002330718c2d939b4a1d0603db1a1ae623aa47
git-p4: handle utf16 filetype properly

One of the filetypes that p4 supports is utf16.  Its behavior is
odd in this case.  The data delivered through "p4 -G print" is
not encoded in utf16, although "p4 print -o" will produce the
proper utf16-encoded file.

When dealing with this filetype, discard the data from -G, and
instead read the contents directly.

An alternate approach would be to try to encode the data in
python.  That worked for true utf16 files, but for other files
marked as utf16, p4 delivers mangled text in no recognizable encoding.

Add a test case to check utf16 handling, and +k and +ko handling.

Reported-by: Chris Li <git@chrisli.org>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4
t/t9802-git-p4-filetype.sh [new file with mode: 0755]