Raw
1 #!/bin/sh
2
3 test_description='blaming through history with topic branches'
4
5 . ./test-lib.sh
6
7 # Creates the history shown below. '*'s mark the first parent in the merges.
8 # The only line of file.t is changed in commit B2
9 #
10 # +---C1
11 # / \
12 # A0--A1--*A2--*A3
13 # \ /
14 # B1-B2
15 #
16 test_expect_success setup '
17 test_commit A0 file.t line0 &&
18 test_commit A1 &&
19 git reset --hard A0 &&
20 test_commit B1 &&
21 test_commit B2 file.t line0changed &&
22 git reset --hard A1 &&
23 test_merge A2 B2 &&
24 git reset --hard A1 &&
25 test_commit C1 &&
26 git reset --hard A2 &&
27 test_merge A3 C1
28 '
29
30 test_expect_success 'blame --reverse --first-parent finds A1' '
31 git blame --porcelain --reverse --first-parent A0..A3 -- file.t >actual_full &&
32 head -n 1 <actual_full | sed -e "s/ .*//" >actual &&
33 git rev-parse A1 >expect &&
34 test_cmp expect actual
35 '
36
37 test_done