mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 02:12:17 +02:00
filter-repo: avoid applying --replace-text to binary files
--replace-text is meant to replace _text_ throughout the repository, not binary data. Use the same scheme as the lint-history script uses to avoid applying the changes to binary blob data. Reported-by: Tobias Gruetzmacher <tobias-git@23.gs> Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
859e66ae1c
commit
31f00a9ff8
@ -3231,7 +3231,8 @@ class RepoFilter(object):
|
||||
if blob.original_id in self._args.strip_blobs_with_ids:
|
||||
blob.skip()
|
||||
|
||||
if self._args.replace_text:
|
||||
if self._args.replace_text and \
|
||||
not any(x == b"0" for x in blob.data[0:8192]):
|
||||
for literal, replacement in self._args.replace_text['literals']:
|
||||
blob.data = blob.data.replace(literal, replacement)
|
||||
for regex, replacement in self._args.replace_text['regexes']:
|
||||
|
Loading…
Reference in New Issue
Block a user