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