summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-13 16:52:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-13 16:52:52 -0700
commitb6bd704c3ed911b87e7c8eb1aaabf0b9b7b9f02a (patch)
treec3630b5851fbd97914f2640d69261dc6cba553c3 /git-p4.py
parentMerge branch 'ab/pre-auto-gc-hook-test' (diff)
parentgit-p4: fix failed submit by skip non-text data files (diff)
downloadtgif-b6bd704c3ed911b87e7c8eb1aaabf0b9b7b9f02a.tar.xz
Merge branch 'dc/p4-binary-submit-fix'
Prevent "git p4" from failing to submit changes to binary file. * dc/p4-binary-submit-fix: git-p4: fix failed submit by skip non-text data files
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-p4.py b/git-p4.py
index d34a1946b7..2b4500226a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1977,8 +1977,11 @@ class P4Submit(Command, P4UserMap):
newdiff += "+%s\n" % os.readlink(newFile)
else:
f = open(newFile, "r")
- for line in f.readlines():
- newdiff += "+" + line
+ try:
+ for line in f.readlines():
+ newdiff += "+" + line
+ except UnicodeDecodeError:
+ pass # Found non-text data and skip, since diff description should only include text
f.close()
return (diff + newdiff).replace('\r\n', '\n')