We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e6c0cbb commit c90fcf1Copy full SHA for c90fcf1
main/githooks.py
@@ -56,13 +56,17 @@
56
# File types that need a terminating newline
57
TERMINATING_NEWLINE_EXTS = ['.c', '.cpp', '.h', '.inl']
58
59
-esc_re = re.compile(r'\s|[]()[]')
+_esc_re = re.compile(r'\s|[]()[]')
60
def _esc_char(match):
61
+ ''' Lambda function to add in back-slashes to escape special chars as compiled in esc_re above
62
+ which makes filenames work with subprocess commands
63
+ '''
64
return '\\' + match.group(0)
65
-
66
def _escape_filename(filename):
- return esc_re.sub(_esc_char, filename)
67
+ ''' Return an escaped filename - for example fi(1)le.txt would be changed to fi\\(1\\)le.txt
68
69
+ return _esc_re.sub(_esc_char, filename)
70
71
72
def _get_output(command, cwd='.'):
0 commit comments