git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 &&
Previous: tboegi@web.deNext: tboegi@web.de
Message 13 of 26 in “convert: add support for different encodings”
  1. 0/5 convert: add support for different encodingslars.schneider@autodesk.com, Dec 29, 2017
  2. 1/5 strbuf: add xstrdup_toupper()lars.schneider@autodesk.com, Dec 29, 2017
  3. Torsten BögershausenDec 29, 2017
  4. Lars SchneiderDec 29, 2017
  5. 2/5 utf8: add function to detect prohibited UTF-16/32 BOMlars.schneider@autodesk.com, Dec 29, 2017
  6. 5/5 convert: add tracing for checkout-encodinglars.schneider@autodesk.com, Dec 29, 2017
  7. 4/5 convert: add support for 'checkout-encoding' attributelars.schneider@autodesk.com, Dec 29, 2017
  8. Torsten BögershausenDec 29, 2017
  9. Lars SchneiderDec 30, 2017
  10. 3/5 utf8: add function to detect a missing UTF-16/32 BOMlars.schneider@autodesk.com, Dec 29, 2017
  11. 0/5 V2B: simplify convert.c/htboegi@web.de, Dec 31, 2017
  12. 5/5 convert: add support for 'checkout-encoding' attributetboegi@web.de, Dec 31, 2017
  13. Johannes SchindelinJan 5, 2018
  14. 3/5 utf8: add function to detect prohibited UTF-16/32 BOMtboegi@web.de, Dec 31, 2017
  15. 1/5 convert_to_git(): checksafe becomes an integertboegi@web.de, Dec 31, 2017
  16. Lars SchneiderDec 31, 2017
  17. 1/1 convert_to_git(): checksafe becomes int conv_flagstboegi@web.de, Jan 1, 2018
  18. Lars SchneiderJan 2, 2018
  19. Torsten BögershausenJan 3, 2018
  20. Lars SchneiderJan 3, 2018
  21. Lars SchneiderJan 5, 2018
  22. Torsten BögershausenJan 5, 2018
  23. Junio C HamanoJan 5, 2018
  24. Lars SchneiderJan 6, 2018
  25. 2/5 strbuf: add xstrdup_toupper()tboegi@web.de, Dec 31, 2017
  26. 4/5 utf8: add function to detect a missing UTF-16/32 BOMtboegi@web.de, Dec 31, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.