1
0
mirror of https://github.com/git/git.git synced 2024-10-20 01:48:55 +02:00
git/t/t6038-merge-text-auto.sh
Eyvind Bernhardsen 331a1838b2 Try normalizing files to avoid delete/modify conflicts when merging
If a file is modified due to normalization on one branch, and deleted on
another, a merge of the two branches will result in a delete/modify
conflict for that file even if it is otherwise unchanged.

Try to avoid the conflict by normalizing and comparing the "base" file
and the modified file when their sha1s differ.  If they compare equal,
the file is considered unmodified and is deleted.

Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-02 15:44:34 -07:00

65 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
test_description='CRLF merge conflict across text=auto change'
. ./test-lib.sh
test_expect_success setup '
git config merge.renormalize true &&
git config core.autocrlf false &&
echo first line | append_cr >file &&
echo first line >control_file &&
echo only line >inert_file &&
git add file control_file inert_file &&
git commit -m "Initial" &&
git tag initial &&
git branch side &&
echo "* text=auto" >.gitattributes &&
touch file &&
git add .gitattributes file &&
git commit -m "normalize file" &&
echo same line | append_cr >>file &&
echo same line >>control_file &&
git add file control_file &&
git commit -m "add line from a" &&
git tag a &&
git rm .gitattributes &&
rm file &&
git checkout file &&
git commit -m "remove .gitattributes" &&
git tag c &&
git checkout side &&
echo same line | append_cr >>file &&
echo same line >>control_file &&
git add file control_file &&
git commit -m "add line from b" &&
git tag b &&
git checkout master
'
test_expect_success 'Check merging after setting text=auto' '
git reset --hard a &&
git merge b &&
cat file | remove_cr >file.temp &&
test_cmp file file.temp
'
test_expect_success 'Check merging addition of text=auto' '
git reset --hard b &&
git merge a &&
cat file | remove_cr >file.temp &&
test_cmp file file.temp
'
test_expect_success 'Test delete/normalize conflict' '
git checkout side &&
git reset --hard initial &&
git rm file &&
git commit -m "remove file" &&
git checkout master &&
git reset --hard a^ &&
git merge side
'
test_done