Commit dd281f0
diff: prevent pprint_rename from underrunning input
The logic described in d020e27 (diff: Fix rename pretty-print when
suffix and prefix overlap, 2013-02-23) is wrong: The proof in the
comment is valid only if both strings are the same length. *One* of
old/new can reach a-1 (b-1, resp.) if 'a' is a suffix of 'b' (or vice
versa).
Since the intent was to let the loop run down to the '/' at the end of
the common prefix, fix it by making that distinction explicit: if
there is no prefix, allow no underrun.
Signed-off-by: Thomas Rast <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent d020e27 commit dd281f0
1 file changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
| 1154 | + | |
1154 | 1155 | | |
1155 | 1156 | | |
1156 | 1157 | | |
| |||
1178 | 1179 | | |
1179 | 1180 | | |
1180 | 1181 | | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1186 | 1188 | | |
1187 | | - | |
1188 | | - | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1189 | 1192 | | |
1190 | 1193 | | |
1191 | 1194 | | |
| |||
0 commit comments