]> git.ipfire.org Git - thirdparty/git.git/commitdiff
revision: disable min_age optimization with line-log
authorRené Scharfe <l.s.r@web.de>
Sat, 4 Jul 2020 12:56:32 +0000 (14:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Jul 2020 01:38:03 +0000 (18:38 -0700)
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>
revision.c
t/t4211-line-log.sh

index ebb4d2a0f2e62e54d4680fc0968796db0ff92750..3bdc1bbf2ae5c137682e69c6502faa004493c36e 100644 (file)
@@ -1410,7 +1410,8 @@ static int limit_list(struct rev_info *revs)
                                continue;
                        break;
                }
-               if (revs->min_age != -1 && (commit->date > revs->min_age))
+               if (revs->min_age != -1 && (commit->date > revs->min_age) &&
+                   !revs->line_level_traverse)
                        continue;
                date = commit->date;
                p = &commit_list_insert(commit, p)->next;
index 1428eae26299d63262568bf93e3b46671b517660..e186c8325043920cd4bfb79ab4fa2ce021dc7ac4 100755 (executable)
@@ -240,10 +240,12 @@ test_expect_success 'setup for checking line-log and parent oids' '
        EOF
        git add file.c &&
        test_tick &&
+       first_tick=$test_tick &&
        git commit -m "Add func1() and func2() in file.c" &&
 
        echo 1 >other-file &&
        git add other-file &&
+       test_tick &&
        git commit -m "Add other-file" &&
 
        sed -e "s/F1/F1 + 1/" file.c >tmp &&
@@ -283,4 +285,10 @@ test_expect_success 'parent oids with parent rewriting' '
        test_cmp expect actual
 '
 
+test_expect_success 'line-log with --before' '
+       echo $root_oid >expect &&
+       git log --format=%h --no-patch -L:func2:file.c --before=$first_tick >actual &&
+       test_cmp expect actual
+'
+
 test_done