t8004-blame-with-conflicts.sh [plain text]
#!/bin/sh
test_description='git blame on conflicted files'
. ./test-lib.sh
test_expect_success 'setup first case' '
echo "Old line" > file1 &&
git add file1 &&
git commit --author "Old Line <ol@localhost>" -m file1.a &&
git checkout -b foo &&
git rm file1 &&
echo "New line ..." > file2 &&
echo "... and more" >> file2 &&
git add file2 &&
git commit --author "U Gly <ug@localhost>" -m ugly &&
git checkout master &&
echo "
bla" >> file1 &&
git commit --author "Old Line <ol@localhost>" -a -m file1.b &&
git checkout foo &&
if git merge master; then
echo needed conflict here
exit 1
else
echo merge failed - resolving automatically
fi &&
echo "New line ...
... and more
bla
Even more" > file2 &&
git rm file1 &&
git commit --author "M Result <mr@localhost>" -a -m merged &&
git checkout master &&
sed s/bla/foo/ <file1 >X &&
rm file1 &&
mv X file1 &&
git commit --author "No Bla <nb@localhost>" -a -m replace &&
git checkout foo &&
if git merge master; then
echo needed conflict here
exit 1
else
echo merge failed - test is setup
fi
'
test_expect_success \
'blame runs on unconflicted file while other file has conflicts' '
git blame file2
'
test_expect_success 'blame runs on conflicted file in stages 1,3' '
git blame file1
'
test_done