refs: inline function do_not_prune()
[git/jrn.git] / t / t8004-blame-with-conflicts.sh
blob9c353ab22276c052de054281dd57808d1826a355
1 #!/bin/sh
3 # Based on a test case submitted by Björn Steinbrink.
5 test_description='git blame on conflicted files'
6 . ./test-lib.sh
8 test_expect_success 'setup first case' '
9 # Create the old file
10 echo "Old line" > file1 &&
11 git add file1 &&
12 git commit --author "Old Line <ol@localhost>" -m file1.a &&
14 # Branch
15 git checkout -b foo &&
17 # Do an ugly move and change
18 git rm file1 &&
19 echo "New line ..." > file2 &&
20 echo "... and more" >> file2 &&
21 git add file2 &&
22 git commit --author "U Gly <ug@localhost>" -m ugly &&
24 # Back to master and change something
25 git checkout master &&
26 echo "
28 bla" >> file1 &&
29 git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
31 # Back to foo and merge master
32 git checkout foo &&
33 if git merge master; then
34 echo needed conflict here
35 exit 1
36 else
37 echo merge failed - resolving automatically
38 fi &&
39 echo "New line ...
40 ... and more
42 bla
43 Even more" > file2 &&
44 git rm file1 &&
45 git commit --author "M Result <mr@localhost>" -a -m merged &&
47 # Back to master and change file1 again
48 git checkout master &&
49 sed s/bla/foo/ <file1 >X &&
50 rm file1 &&
51 mv X file1 &&
52 git commit --author "No Bla <nb@localhost>" -a -m replace &&
54 # Try to merge into foo again
55 git checkout foo &&
56 if git merge master; then
57 echo needed conflict here
58 exit 1
59 else
60 echo merge failed - test is setup
64 test_expect_success \
65 'blame runs on unconflicted file while other file has conflicts' '
66 git blame file2
69 test_expect_success 'blame does not crash with conflicted file in stages 1,3' '
70 git blame file1
73 test_done