]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-p4: fix syncing file types with pattern
authorDaniel Levin <dendy.ua@gmail.com>
Wed, 23 Dec 2020 14:37:27 +0000 (14:37 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Dec 2020 21:49:40 +0000 (13:49 -0800)
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>
git-p4.py

index 4433ca53de7eff82c29a191019f1b6477f53f3bb..90b02f6b22c961d6923fef0fe36ff8f68384adb8 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -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)