# patch-2 is the same as patch-1 but is based
# on a version that already has whitespace fixed,
# and does not introduce whitespace breakages.
- sed -e "s/ $//" patch-1 >patch-2 &&
+ sed -e "s/ \$//" patch-1 >patch-2 &&
# If all whitespace breakages are fixed the contents
# should look like file-fixed
- sed -e "s/ $//" file-1 >file-fixed
+ sed -e "s/ \$//" file-1 >file-fixed
'
git apply --whitespace=nowarn patch-1 &&
# The result should obviously match.
- diff -u file-1 file
+ test_cmp file-1 file
'
test_expect_success 'withfix (forward)' '
git apply --whitespace=fix patch-0 &&
git apply --whitespace=fix patch-1 &&
- diff -u file-fixed file
+ test_cmp file-fixed file
'
test_expect_success 'withfix (backward)' '
sed -e /h/d file-fixed >fixed-head &&
sed -e /h/d file >file-head &&
- diff -u fixed-head file-head &&
+ test_cmp fixed-head file-head &&
sed -n -e /h/p file-fixed >fixed-tail &&
sed -n -e /h/p file >file-tail &&
- ! diff -u fixed-tail file-tail
+ ! test_cmp fixed-tail file-tail
'