diff options
author | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·36+0000 |
---|---|---|
committer | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·40+0000 |
commit | 7ef0d62730840ded097b524104cc0a0904591a63 (patch) | |
tree | a670f96103667aeca4789a95d94ca0dff550c4ce /third_party/git/t/t8004-blame-with-conflicts.sh | |
parent | 6a2a3007077818e24a3d56fc492ada9206a10cf0 (diff) | |
parent | 1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5 (diff) |
merge(third_party/git): Merge squashed git subtree at v2.23.0 r/373
Merge commit '1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5' as 'third_party/git'
Diffstat (limited to 'third_party/git/t/t8004-blame-with-conflicts.sh')
-rwxr-xr-x | third_party/git/t/t8004-blame-with-conflicts.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/third_party/git/t/t8004-blame-with-conflicts.sh b/third_party/git/t/t8004-blame-with-conflicts.sh new file mode 100755 index 000000000000..9c353ab22276 --- /dev/null +++ b/third_party/git/t/t8004-blame-with-conflicts.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# Based on a test case submitted by Björn Steinbrink. + +test_description='git blame on conflicted files' +. ./test-lib.sh + +test_expect_success 'setup first case' ' + # Create the old file + echo "Old line" > file1 && + git add file1 && + git commit --author "Old Line <ol@localhost>" -m file1.a && + + # Branch + git checkout -b foo && + + # Do an ugly move and change + git rm file1 && + echo "New line ..." > file2 && + echo "... and more" >> file2 && + git add file2 && + git commit --author "U Gly <ug@localhost>" -m ugly && + + # Back to master and change something + git checkout master && + echo " + +bla" >> file1 && + git commit --author "Old Line <ol@localhost>" -a -m file1.b && + + # Back to foo and merge master + 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 && + + # Back to master and change file1 again + git checkout master && + sed s/bla/foo/ <file1 >X && + rm file1 && + mv X file1 && + git commit --author "No Bla <nb@localhost>" -a -m replace && + + # Try to merge into foo again + 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 does not crash with conflicted file in stages 1,3' ' + git blame file1 +' + +test_done |