From 9bb4188e83768c7972ae4c93dae8e957a7bee69a Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Thu, 20 Dec 2018 11:25:44 -0800 Subject: [PATCH] filter-repo: perf hack -- do minimal amount of quoting required by fast-import Signed-off-by: Elijah Newren --- git-filter-repo | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-filter-repo b/git-filter-repo index 0b5132d..0431394 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -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