summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-09-15 06:05:39 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-09-16 09:59:05 -0700
commit95a4fb0eac20de024fed242a7c9227af86334202 (patch)
tree5099a9f345c300b8290a4937550aeffb32c349ea /t
parentGit 2.5.2 (diff)
downloadtgif-95a4fb0eac20de024fed242a7c9227af86334202.tar.xz
blame: handle --first-parent
The revision.c options-parser will parse "--first-parent" for us, but the blame code does not actually respect it, as we simply iterate over the whole list returned by first_scapegoat(). We can fix this by returning a truncated parent list. Note that we could technically also do so by limiting the return value of num_scapegoats(), but that is less robust. We would rely on nobody ever looking at the "next" pointer from the returned list. Combining "--reverse" with "--first-parent" is more complicated, and will probably involve cooperation from revision.c. Since the desired semantics are not even clear, let's punt on this for now, but explicitly disallow it to avoid confusing users (this is not really a regression, since it did something nonsensical before). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/annotate-tests.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index f5c01758ca..b1673b3e8f 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -111,6 +111,10 @@ test_expect_success 'blame 2 authors + 2 merged-in authors' '
check_count A 2 B 1 B1 2 B2 1
'
+test_expect_success 'blame --first-parent blames merge for branch1' '
+ check_count --first-parent A 2 B 1 "A U Thor" 2 B2 1
+'
+
test_expect_success 'blame ancestor' '
check_count -h master A 2 B 2
'