3 # Based on a test case submitted by Björn Steinbrink.
5 test_description='git blame on conflicted files'
6 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11 test_expect_success 'setup first case' '
13 echo "Old line" > file1 &&
15 git commit --author "Old Line <ol@localhost>" -m file1.a &&
18 git checkout -b foo &&
20 # Do an ugly move and change
22 echo "New line ..." > file2 &&
23 echo "... and more" >> file2 &&
25 git commit --author "U Gly <ug@localhost>" -m ugly &&
27 # Back to main and change something
32 git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
34 # Back to foo and merge main
36 if git merge main; then
37 echo needed conflict here
40 echo merge failed - resolving automatically
48 git commit --author "M Result <mr@localhost>" -a -m merged &&
50 # Back to main and change file1 again
52 sed s/bla/foo/ <file1 >X &&
55 git commit --author "No Bla <nb@localhost>" -a -m replace &&
57 # Try to merge into foo again
59 if git merge main; then
60 echo needed conflict here
63 echo merge failed - test is setup
68 'blame runs on unconflicted file while other file has conflicts' '
72 test_expect_success 'blame does not crash with conflicted file in stages 1,3' '