Skip to content

Commit 20d451c

Browse files
committed
Merge branch 'rs/line-log-until' into master
"git log -Lx,y:path --before=date" lost track of where the range should be because it didn't take the changes made by the youngest commits that are omitted from the output into account. * rs/line-log-until: revision: disable min_age optimization with line-log
2 parents b7ebe8f + 01faa91 commit 20d451c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

revision.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,8 @@ static int limit_list(struct rev_info *revs)
14101410
continue;
14111411
break;
14121412
}
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)
14141415
continue;
14151416
date = commit->date;
14161417
p = &commit_list_insert(commit, p)->next;

t/t4211-line-log.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,12 @@ test_expect_success 'setup for checking line-log and parent oids' '
240240
EOF
241241
git add file.c &&
242242
test_tick &&
243+
first_tick=$test_tick &&
243244
git commit -m "Add func1() and func2() in file.c" &&
244245
245246
echo 1 >other-file &&
246247
git add other-file &&
248+
test_tick &&
247249
git commit -m "Add other-file" &&
248250
249251
sed -e "s/F1/F1 + 1/" file.c >tmp &&
@@ -283,4 +285,10 @@ test_expect_success 'parent oids with parent rewriting' '
283285
test_cmp expect actual
284286
'
285287

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+
286294
test_done

0 commit comments

Comments
 (0)