Re: [PATCH 5/5] convert: add support for 'checkout-encoding' attribute
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 5, 2018, 14:45 UTC
- Message-ID
- <alpine.DEB.2.21.1.1801051542550.31@MININT-6BKU6QN.europe.corp.microsoft.com>
- In-Reply-To
- <20171231080601.22444-1-tboegi@web.de>
Hi,
On Sun, 31 Dec 2017, tboegi@web.de wrote:
Show 36 quoted lines
> diff --git a/t/t0028-checkout-encoding.sh b/t/t0028-checkout-encoding.sh > new file mode 100755 > index 0000000000..1a329ab933 > --- /dev/null > +++ b/t/t0028-checkout-encoding.sh > @@ -0,0 +1,197 @@ > +#!/bin/sh > + > +test_description='checkout-encoding conversion via gitattributes' > + > +. ./test-lib.sh > + > +test_expect_success 'setup test repo' ' > + > + text="hallo there!\ncan you read me?" && > + > + echo "*.utf16 text checkout-encoding=utf-16" >.gitattributes && > + > + printf "$text" >test.utf8.raw && > + printf "$text" | iconv -f UTF-8 -t UTF-16 >test.utf16.raw && > + cp test.utf16.raw test.utf16 && > + > + git add .gitattributes test.utf16 && > + git commit -m initial > +' > + > +test_expect_success 'ensure UTF-8 is stored in Git' ' > + git cat-file -p :test.utf16 >test.utf16.git && > + test_cmp_bin test.utf8.raw test.utf16.git && > + rm test.utf8.raw test.utf16.git > +' > + > +test_expect_success 're-encode to UTF-16 on checkout' ' > + rm test.utf16 && > + git checkout test.utf16 && > + test_cmp_bin test.utf16.raw test.utf16 &&
This fails here, due to an extra CR in test.utf16. This diff fixes it (please include it in the next iteration of this patch series):
-- snipsnap --
diff --git a/t/t0028-checkout-encoding.sh b/t/t0028-checkout-encoding.sh index 1a329ab933b..aaf61bc9d7c 100755 --- a/t/t0028-checkout-encoding.sh +++ b/t/t0028-checkout-encoding.sh @@ -6,6 +6,7 @@ test_description='checkout-encoding conversion via gitattributes' test_expect_success 'setup test repo' ' + git config core.eol lf && text="hallo there!\ncan you read me?" && echo "*.utf16 text checkout-encoding=utf-16" >.gitattributes &&