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