Repository navigation
Commit f7842d1
committed
unified: Count bare-newline context lines in hunk ranges
iter_file_patch tracked how far it had progressed through a hunk by
decrementing orig_range/mod_range only for lines starting with ' ',
'+' or '-'. Blank context lines emitted as a bare "\n" (without the
leading space, as quilt-refreshed and handwritten patches often do)
therefore didn't count, leaving the counter above zero when the hunk
body had actually finished.
In a multi-file patch that meant the next file's Index:/---/+++ lines
were absorbed into the previous hunk's body, so the Index: line ended
up fed to Hunk::from_header and failed with "Malformed hunk header:
Does not match format." Count a bare newline as a context line in both
ranges so grouping lines up with the real hunk size.1 parent 427d0dd commit f7842d1
1 file changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
920 | 926 | | |
921 | 927 | | |
922 | | - | |
| 928 | + | |
923 | 929 | | |
924 | 930 | | |
925 | 931 | | |
| |||
1140 | 1146 | | |
1141 | 1147 | | |
1142 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
1143 | 1183 | | |
1144 | 1184 | | |
1145 | 1185 | | |
| |||
0 commit comments