Skip to content

Commit c90fcf1

Browse files
committed
Comments added (NO_JIRA)
1 parent e6c0cbb commit c90fcf1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

main/githooks.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@
5656
# File types that need a terminating newline
5757
TERMINATING_NEWLINE_EXTS = ['.c', '.cpp', '.h', '.inl']
5858

59-
esc_re = re.compile(r'\s|[]()[]')
59+
_esc_re = re.compile(r'\s|[]()[]')
6060
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+
'''
6164
return '\\' + match.group(0)
6265

63-
6466
def _escape_filename(filename):
65-
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)
6670

6771

6872
def _get_output(command, cwd='.'):

0 commit comments

Comments
 (0)