From: "René Scharfe" <l.s.r@web.de>
To: "Мария Долгополова" <dolgopolovamariia@gmail.com>, git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH] revision: disable min_age optimization with line-log
Date: Sat, 4 Jul 2020 14:56:32 +0200 [thread overview]
Message-ID: <0c55e178-8f7c-ef84-e6eb-e50de9924ef6@web.de> (raw)
In-Reply-To: <CAD6JL5SRvB_yXcqJ5HGADQaGtZAiKrtd447vtHLSagJqNGPChA@mail.gmail.com>
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>
---
Needs careful review -- I'm not familiar with that the line-log code and
the revision traversal machinery is a bit scary. AFAIU the min_age
check is done again in get_commit_action(), so this patch shouldn't
cause underage commits to be shown, but I'm not sure. Test coverage for
the three options is spotty. :-/
revision.c | 3 ++-
t/t4211-line-log.sh | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/revision.c b/revision.c
index ebb4d2a0f2..3bdc1bbf2a 100644
--- a/revision.c
+++ b/revision.c
@@ -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;
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index 1428eae262..e186c83250 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -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
--
2.27.0
next prev parent reply other threads:[~2020-07-04 12:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 14:14 Git log: filtering by date and by lines do not work together Мария Долгополова
2020-07-04 12:56 ` René Scharfe
2020-07-04 12:56 ` René Scharfe [this message]
2020-07-07 1:37 ` [PATCH] revision: disable min_age optimization with line-log Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c55e178-8f7c-ef84-e6eb-e50de9924ef6@web.de \
--to=l.s.r@web.de \
--cc=dolgopolovamariia@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).