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
9 TEST_PASSES_SANITIZE_LEAK
=true
12 test_expect_success
'setup first case' '
14 echo "Old line" > file1 &&
16 git commit --author "Old Line <ol@localhost>" -m file1.a &&
19 git checkout -b foo &&
21 # Do an ugly move and change
23 echo "New line ..." > file2 &&
24 echo "... and more" >> file2 &&
26 git commit --author "U Gly <ug@localhost>" -m ugly &&
28 # Back to main and change something
33 git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
35 # Back to foo and merge main
37 if git merge main; then
38 echo needed conflict here
41 echo merge failed - resolving automatically
49 git commit --author "M Result <mr@localhost>" -a -m merged &&
51 # Back to main and change file1 again
53 sed s/bla/foo/ <file1 >X &&
56 git commit --author "No Bla <nb@localhost>" -a -m replace &&
58 # Try to merge into foo again
60 if git merge main; then
61 echo needed conflict here
64 echo merge failed - test is setup
69 'blame runs on unconflicted file while other file has conflicts' '
73 test_expect_success
'blame does not crash with conflicted file in stages 1,3' '