We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50f495e commit c2cf554Copy full SHA for c2cf554
main/githooks.py
@@ -173,7 +173,10 @@ def parse_diff_header(header_line):
173
start = int(match.group(1))
174
if match.group(2):
175
num = int(match.group(3))
176
- changed_lines = f'{start}-{start+num-1}'
+ if num > 0:
177
+ changed_lines = f'{start}-{start+num-1}'
178
+ else:
179
+ changed_lines = str(start)
180
else:
181
changed_lines = str(start)
182
return changed_lines
@@ -187,6 +190,8 @@ def _test(input, output):
187
190
_test('@@ -142 +178 @@', '178')
188
191
_test('@@ -142 +178,3 @@', '178-180')
189
192
_test('@@ -142 +178,7 @@', '178-184')
193
+ _test('@@ -3,0 +3 @@', '3')
194
+ _test('@@ -1 +0,0 @@', '0')
195
196
197
def get_changed_lines(modified_file):
0 commit comments