Teach core.autocrlf to 'git apply'
This teaches git-apply that the data read from and written to the filesystem might need to get converted to adjust for local line-ending convention. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
@ -180,11 +180,8 @@ test_expect_success 'apply patch (autocrlf=true)' '
|
||||
git repo-config core.autocrlf true &&
|
||||
git read-tree --reset -u HEAD &&
|
||||
|
||||
# Sore thumb
|
||||
remove_cr one >tmp && mv -f tmp one &&
|
||||
|
||||
git apply patch.file &&
|
||||
test "$patched" = "`git hash-object --stdin <one`" || {
|
||||
test "$patched" = "`remove_cr one | git hash-object --stdin`" || {
|
||||
echo "Eh? apply without index"
|
||||
false
|
||||
}
|
||||
@ -203,4 +200,18 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
|
||||
}
|
||||
'
|
||||
|
||||
test_expect_success 'apply patch --index (autocrlf=true)' '
|
||||
|
||||
rm -f tmp one dir/two &&
|
||||
git repo-config core.autocrlf true &&
|
||||
git read-tree --reset -u HEAD &&
|
||||
|
||||
git apply --index patch.file &&
|
||||
test "$patched" = `git rev-parse :one` &&
|
||||
test "$patched" = "`remove_cr one | git hash-object --stdin`" || {
|
||||
echo "Eh? apply with --index"
|
||||
false
|
||||
}
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user