git-p4: fix syncing file types with pattern

Example of pattern file type: text+k

Text filtered through the p4 pattern regexp must be converted from
string back to bytes, otherwise 'data' command for the fast-import
will receive extra invalid characters, followed by the fast-import
process error.

CC: Yang Zhao <yang.zhao@skyboxlabs.com>
Signed-off-by: Daniel Levin <dendy.ua@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Daniel Levin 2020-12-23 14:37:27 +00:00 коммит произвёл Junio C Hamano
Родитель 898f80736c
Коммит 52fc4f195c
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -3031,7 +3031,7 @@ class P4Sync(Command, P4UserMap):
regexp = re.compile(pattern, re.VERBOSE)
text = ''.join(decode_text_stream(c) for c in contents)
text = regexp.sub(r'$\1$', text)
contents = [ text ]
contents = [ encode_text_stream(text) ]
if self.largeFileSystem:
(git_mode, contents) = self.largeFileSystem.processContent(git_mode, relPath, contents)