@matheusbsbs / matheus-bagliano / commits / 01faa91cb7
Fork 0

revision: disable min_age optimization with line-log

If one of the options --before, --min-age or --until is given, limit_list() filters out younger commits early on. Line-log needs all those commits to trace the movement of line ranges, though. Skip this optimization if both are used together. Reported-by: Мария Долгополова <dolgopolovamariia@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jul 4, 2020 at 14:56 UTC 01faa91cb71cf6f5acdf4e683cce08b5e233cfa8
2 files changed +10 -1
revision.c
+2 -1
@@ -1410,7 +1410,8 @@ static int limit_list(struct rev_info *revs)
1410 continue;
1411 break;
1412 }
1413 - if (revs->min_age != -1 && (commit->date > revs->min_age))
1413 + if (revs->min_age != -1 && (commit->date > revs->min_age) &&
1414 + !revs->line_level_traverse)
1415 continue;
1416 date = commit->date;
1417 p = &commit_list_insert(commit, p)->next;
t/t4211-line-log.sh
+8
@@ -240,10 +240,12 @@ test_expect_success 'setup for checking line-log and parent oids' '
240 EOF
241 git add file.c &&
242 test_tick &&
243 + first_tick=$test_tick &&
244 git commit -m "Add func1() and func2() in file.c" &&
245
246 echo 1 >other-file &&
247 git add other-file &&
248 + test_tick &&
249 git commit -m "Add other-file" &&
250
251 sed -e "s/F1/F1 + 1/" file.c >tmp &&
@@ -283,4 +285,10 @@ test_expect_success 'parent oids with parent rewriting' '
285 test_cmp expect actual
286 '
287
288 +test_expect_success 'line-log with --before' '
289 + echo $root_oid >expect &&
290 + git log --format=%h --no-patch -L:func2:file.c --before=$first_tick >actual &&
291 + test_cmp expect actual
292 +'
293 +
294 test_done