summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d0f7dcb)
raw | patch | inline | side by side (parent: d0f7dcb)
author | Matthieu Moy <Matthieu.Moy@imag.fr> | |
Wed, 9 Mar 2011 20:52:15 +0000 (21:52 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 9 Mar 2011 22:28:24 +0000 (14:28 -0800) |
The --max-count limit is implemented by counting revisions in
get_revision(), but the -S and -G take effect later when running diff.
Hence "--max-count=10 -Sfoo" meant "examine the 10 first revisions, and
out of them, show only those changing the occurences of foo", not "show 10
revisions changing the occurences of foo".
In case the commit isn't actually shown, cancel the decrement of
max_count.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
get_revision(), but the -S and -G take effect later when running diff.
Hence "--max-count=10 -Sfoo" meant "examine the 10 first revisions, and
out of them, show only those changing the occurences of foo", not "show 10
revisions changing the occurences of foo".
In case the commit isn't actually shown, cancel the decrement of
max_count.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/log.c | patch | blob | history | |
t/t4013-diff-various.sh | patch | blob | history | |
t/t4013/diff.log_-SF_master_--max-count=0 | [new file with mode: 0644] | patch | blob |
t/t4013/diff.log_-SF_master_--max-count=1 | [new file with mode: 0644] | patch | blob |
t/t4013/diff.log_-SF_master_--max-count=2 | [new file with mode: 0644] | patch | blob |
diff --git a/builtin/log.c b/builtin/log.c
index d8c6c28d2fcc3bd0744f071da536215141dc0d0b..2b82272eac8aff30140babbcdbe29d9e84b12a5f 100644 (file)
--- a/builtin/log.c
+++ b/builtin/log.c
* retain that state information if replacing rev->diffopt in this loop
*/
while ((commit = get_revision(rev)) != NULL) {
- log_tree_commit(rev, commit);
+ if (!log_tree_commit(rev, commit) &&
+ rev->max_count >= 0)
+ /*
+ * We decremented max_count in get_revision,
+ * but we didn't actually show the commit.
+ */
+ rev->max_count++;
if (!rev->reflog_info) {
/* we allow cycles in reflog ancestry */
free(commit->buffer);
index b8f81d07c33d3596fef5f5a361f4774d5e357fca..5daa0f2a0c9c8cd6ed2c06e12c8fd421c178d4f0 100755 (executable)
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
log -SF master
log -S F master
log -SF -p master
+log -SF master --max-count=0
+log -SF master --max-count=1
+log -SF master --max-count=2
log -GF master
log -GF -p master
log -GF -p --pickaxe-all master
diff --git a/t/t4013/diff.log_-SF_master_--max-count=0 b/t/t4013/diff.log_-SF_master_--max-count=0
--- /dev/null
@@ -0,0 +1,2 @@
+$ git log -SF master --max-count=0
+$
diff --git a/t/t4013/diff.log_-SF_master_--max-count=1 b/t/t4013/diff.log_-SF_master_--max-count=1
--- /dev/null
@@ -0,0 +1,7 @@
+$ git log -SF master --max-count=1
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+$
diff --git a/t/t4013/diff.log_-SF_master_--max-count=2 b/t/t4013/diff.log_-SF_master_--max-count=2
--- /dev/null
@@ -0,0 +1,7 @@
+$ git log -SF master --max-count=2
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+$