mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: perf hack -- do minimal amount of quoting required by fast-import
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
da5895ecc3
commit
9bb4188e83
@ -113,8 +113,11 @@ class PathQuoting:
|
||||
|
||||
@staticmethod
|
||||
def enquote(unquoted_string):
|
||||
pqsc = PathQuoting._special_chars
|
||||
if any(pqsc[ord(x)] for x in set(unquoted_string)):
|
||||
# Option 1: Quoting when fast-export would:
|
||||
# pqsc = PathQuoting._special_chars
|
||||
# if any(pqsc[ord(x)] for x in set(unquoted_string)):
|
||||
# Option 2, perf hack: do minimal amount of quoting required by fast-import
|
||||
if unquoted_string.startswith('"') or '\n' in unquoted_string:
|
||||
pqe = PathQuoting._escape
|
||||
return '"' + ''.join(pqe[ord(x)] for x in unquoted_string) + '"'
|
||||
return unquoted_string
|
||||
|
Loading…
Reference in New Issue
Block a user