{"thread":{"id":"48840","subject":"[PATCH v1 0/2] convert: add alias support for 'working-tree-encoding' attributes","startedAt":"2018-07-08T18:31:52Z","lastAt":"2018-07-10T16:31:52Z","messageCount":8,"participants":["larsxschneider@gmail.com","Lars Schneider","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"351879","messageId":"20180708183036.29459-1-larsxschneider@gmail.com","threadId":"48840","inReplyTo":null,"subject":"[PATCH v1 0/2] convert: add alias support for 'working-tree-encoding' attributes","fromName":"","fromEmail":"larsxschneider@gmail.com","sentAt":"2018-07-08T18:30:34Z","receivedAt":"2018-07-08T18:31:52Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"From: Lars Schneider <larsxschneider@gmail.com>\n\nHi,\n\nthis series adds Git config based alias support for\n'working-tree-encoding' attributes that were introduced in 107642fe26\n(\"convert: add 'working-tree-encoding' attribute\", 2018-04-15).\nThe feature was suggested by Steve Groeger in [1].\n\nThe first patch is a refactoring with no functional change intended.\nThe second patch is the actual change.\n\nThanks,\nLars\n\n[1] https://public-inbox.org/git/OF5D40FE06.C18CD7CD-ON002582B9.002B7A02-002582B9.002B7A07@notes.na.collabserv.com/\n\nBase Ref: master\nWeb-Diff: https://github.com/larsxschneider/git/commit/0cbee9bd8d\nCheckout: git fetch https://github.com/larsxschneider/git encoding-alias-v1 && git checkout 0cbee9bd8d\n\nLars Schneider (2):\n  convert: refactor conversion driver config parsing\n  convert: add alias support for 'working-tree-encoding' attributes\n\n Documentation/gitattributes.txt  |  19 ++++++\n convert.c                        | 114 ++++++++++++++++++++++---------\n t/t0028-working-tree-encoding.sh |  28 ++++++++\n 3 files changed, 129 insertions(+), 32 deletions(-)\n\n\nbase-commit: e3331758f12da22f4103eec7efe1b5304a9be5e9\n--\n2.18.0\n\n"},{"id":"351880","messageId":"20180708183036.29459-2-larsxschneider@gmail.com","threadId":"48840","inReplyTo":"20180708183036.29459-1-larsxschneider@gmail.com","subject":"[PATCH v1 1/2] convert: refactor conversion driver config parsing","fromName":"","fromEmail":"larsxschneider@gmail.com","sentAt":"2018-07-08T18:30:35Z","receivedAt":"2018-07-08T18:31:54Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"From: Lars Schneider <larsxschneider@gmail.com>\n\nRefactor conversion driver config parsing to ease the parsing of new\nconfigs in a subsequent patch.\n\nNo functional change intended.\n\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\n---\n convert.c | 64 +++++++++++++++++++++++++++----------------------------\n 1 file changed, 32 insertions(+), 32 deletions(-)\n\ndiff --git a/convert.c b/convert.c\nindex 64d0d30e08..949bc783e4 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1003,43 +1003,43 @@ static int read_convert_config(const char *var, const char *value, void *cb)\n \tint namelen;\n \tstruct convert_driver *drv;\n \n-\t/*\n-\t * External conversion drivers are configured using\n-\t * \"filter.<name>.variable\".\n-\t */\n-\tif (parse_config_key(var, \"filter\", &name, &namelen, &key) < 0 || !name)\n-\t\treturn 0;\n-\tfor (drv = user_convert; drv; drv = drv->next)\n-\t\tif (!strncmp(drv->name, name, namelen) && !drv->name[namelen])\n-\t\t\tbreak;\n-\tif (!drv) {\n-\t\tdrv = xcalloc(1, sizeof(struct convert_driver));\n-\t\tdrv->name = xmemdupz(name, namelen);\n-\t\t*user_convert_tail = drv;\n-\t\tuser_convert_tail = &(drv->next);\n-\t}\n+\tif (parse_config_key(var, \"filter\", &name, &namelen, &key) >= 0 && name) {\n+\t\t/*\n+\t\t * External conversion drivers are configured using\n+\t\t * \"filter.<name>.variable\".\n+\t\t */\n+\t\tfor (drv = user_convert; drv; drv = drv->next)\n+\t\t\tif (!strncmp(drv->name, name, namelen) && !drv->name[namelen])\n+\t\t\t\tbreak;\n+\t\tif (!drv) {\n+\t\t\tdrv = xcalloc(1, sizeof(struct convert_driver));\n+\t\t\tdrv->name = xmemdupz(name, namelen);\n+\t\t\t*user_convert_tail = drv;\n+\t\t\tuser_convert_tail = &(drv->next);\n+\t\t}\n \n-\t/*\n-\t * filter.<name>.smudge and filter.<name>.clean specifies\n-\t * the command line:\n-\t *\n-\t *\tcommand-line\n-\t *\n-\t * The command-line will not be interpolated in any way.\n-\t */\n+\t\t/*\n+\t\t * filter.<name>.smudge and filter.<name>.clean specifies\n+\t\t * the command line:\n+\t\t *\n+\t\t *\tcommand-line\n+\t\t *\n+\t\t * The command-line will not be interpolated in any way.\n+\t\t */\n \n-\tif (!strcmp(\"smudge\", key))\n-\t\treturn git_config_string(&drv->smudge, var, value);\n+\t\tif (!strcmp(\"smudge\", key))\n+\t\t\treturn git_config_string(&drv->smudge, var, value);\n \n-\tif (!strcmp(\"clean\", key))\n-\t\treturn git_config_string(&drv->clean, var, value);\n+\t\tif (!strcmp(\"clean\", key))\n+\t\t\treturn git_config_string(&drv->clean, var, value);\n \n-\tif (!strcmp(\"process\", key))\n-\t\treturn git_config_string(&drv->process, var, value);\n+\t\tif (!strcmp(\"process\", key))\n+\t\t\treturn git_config_string(&drv->process, var, value);\n \n-\tif (!strcmp(\"required\", key)) {\n-\t\tdrv->required = git_config_bool(var, value);\n-\t\treturn 0;\n+\t\tif (!strcmp(\"required\", key)) {\n+\t\t\tdrv->required = git_config_bool(var, value);\n+\t\t\treturn 0;\n+\t\t}\n \t}\n \n \treturn 0;\n-- \n2.18.0\n\n"},{"id":"351881","messageId":"20180708183036.29459-3-larsxschneider@gmail.com","threadId":"48840","inReplyTo":"20180708183036.29459-1-larsxschneider@gmail.com","subject":"[PATCH v1 2/2] convert: add alias support for 'working-tree-encoding' attributes","fromName":"","fromEmail":"larsxschneider@gmail.com","sentAt":"2018-07-08T18:30:36Z","receivedAt":"2018-07-08T18:31:57Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"From: Lars Schneider <larsxschneider@gmail.com>\n\nIn 107642fe26 (\"convert: add 'working-tree-encoding' attribute\",\n2018-04-15) we added an attribute which defines the working tree\nencoding of a file.\n\nSome platforms might spell the name of a certain encoding differently or\nsome users might want to use different encodings on different platforms.\nAdd the Git config \"encoding.<iconv-name>.insteadOf = <alias-name>\" to\nsupport these use-cases with a user specific mapping. If the alias\nmatches an existing encoding name, then the alias will take precedence.\nThe alias is case insensitive.\n\nExample:\n\n\t(in .gitattributes)\n\t*.c\tworking-tree-encoding=foo\n\n\t(in config)\n\t[encoding \"UTF-16\"]\n\t\tinsteadOf = foo\n\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\n---\n Documentation/gitattributes.txt  | 19 ++++++++++++\n convert.c                        | 50 ++++++++++++++++++++++++++++++++\n t/t0028-working-tree-encoding.sh | 28 ++++++++++++++++++\n 3 files changed, 97 insertions(+)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 92010b062e..3628f0e5cf 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -366,6 +366,25 @@ command to guess the encoding:\n file foo.ps1\n ------------------------\n \n+The encoding in all examples above was directly defined in the Git\n+attributes. In addition, it is possible to define encodings indirectly\n+using aliases set via Git config:\n+\n+------------------------\n+[encoding \"UTF-16\"]\n+    insteadOf = my-custom-alias\n+------------------------\n+\n+The alias name can be used in the Git attributes instead of the actual\n+encoding name:\n+\n+------------------------\n+*.ps1   text working-tree-encoding=my-custom-alias\n+------------------------\n+\n+This mapping can be useful if equivalent encodings are spelled\n+differently across platforms. It can also be useful if a user wants to\n+use different encodings on different platforms for the same file.\n \n `ident`\n ^^^^^^^\ndiff --git a/convert.c b/convert.c\nindex 949bc783e4..4f19ce1a04 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -997,6 +997,15 @@ static int apply_filter(const char *path, const char *src, size_t len,\n \treturn 0;\n }\n \n+struct alias2enc {\n+\tstruct hashmap_entry ent; /* must be the first member! */\n+\tconst char *alias;\n+\tconst char *encoding;\n+};\n+\n+static int encoding_aliases_initialized;\n+static struct hashmap encoding_map;\n+\n static int read_convert_config(const char *var, const char *value, void *cb)\n {\n \tconst char *key, *name;\n@@ -1040,6 +1049,36 @@ static int read_convert_config(const char *var, const char *value, void *cb)\n \t\t\tdrv->required = git_config_bool(var, value);\n \t\t\treturn 0;\n \t\t}\n+\t} else if (\n+\t\tparse_config_key(var, \"encoding\", &name, &namelen, &key) >= 0 &&\n+\t\tname &&\t!strcmp(key, \"insteadof\")) {\n+\t\t/*\n+\t\t * Encoding aliases are configured using\n+\t\t * \"encoding.<iconv-name>.insteadOf = <alias-name>\".\n+\t\t */\n+\t\tstruct alias2enc *entry;\n+\t\tif (!value)\n+\t\t\treturn config_error_nonbool(key);\n+\n+\t\tif (!encoding_aliases_initialized) {\n+\t\t\tencoding_aliases_initialized = 1;\n+\t\t\thashmap_init(&encoding_map, NULL, NULL, 0);\n+\t\t\tentry = NULL;\n+\t\t} else {\n+\t\t\tstruct alias2enc hashkey;\n+\t\t\thashmap_entry_init(&hashkey, strihash(value));\n+\t\t\thashkey.alias = value;\n+\t\t\tentry = hashmap_get(&encoding_map, &hashkey, NULL);\n+\t\t}\n+\n+\t\tif (!entry) {\n+\t\t\tentry = xmalloc(sizeof(*entry));\n+\t\t\tentry->encoding = xstrndup(name, namelen);\n+\t\t\tentry->alias = xstrdup(value);\n+\n+\t\t\thashmap_entry_init(entry, strihash(value));\n+\t\t\thashmap_add(&encoding_map, entry);\n+\t\t}\n \t}\n \n \treturn 0;\n@@ -1225,6 +1264,17 @@ static const char *git_path_check_encoding(struct attr_check_item *check)\n \t\tdie(_(\"true/false are no valid working-tree-encodings\"));\n \t}\n \n+\t/* Check if an alias was defined for the encoding in the Git config */\n+\tif (encoding_aliases_initialized) {\n+\t\tstruct alias2enc hashkey;\n+\t\tstruct alias2enc *entry;\n+\t\thashmap_entry_init(&hashkey, strihash(value));\n+\t\thashkey.alias = value;\n+\t\tentry = hashmap_get(&encoding_map, &hashkey, NULL);\n+\t\tif (entry)\n+\t\t\tvalue = entry->encoding;\n+\t}\n+\n \t/* Don't encode to the default encoding */\n \tif (same_encoding(value, default_encoding))\n \t\treturn NULL;\ndiff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh\nindex 12b8eb963a..d803e00cbe 100755\n--- a/t/t0028-working-tree-encoding.sh\n+++ b/t/t0028-working-tree-encoding.sh\n@@ -242,4 +242,32 @@ test_expect_success 'check roundtrip encoding' '\n \tgit reset\n '\n \n+test_expect_success 'encoding alias' '\n+\ttest_when_finished \"rm -f test.foo16.git test.foo8\" &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\n+\ttest_config encoding.UTF-16.InsteadOf foo16 &&\n+\n+\ttext=\"hallo there!\\ncan you read me with an alias?\" &&\n+\tprintf \"$text\" >test.foo8 &&\n+\tprintf \"$text\" | iconv -f UTF-8 -t UTF-16 >test.foo16 &&\n+\n+\techo \"*.foo16 text working-tree-encoding=fOO16\" >.gitattributes &&\n+\tgit add test.foo16 .gitattributes &&\n+\n+\tgit cat-file -p :test.foo16 >test.foo16.git &&\n+\ttest_cmp_bin test.foo8 test.foo16.git\n+'\n+\n+test_expect_success 'encoding alias overwrites existing encoding' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\n+\ttest_config encoding.CONFUSE.insteadOf UTF-16 &&\n+\n+\techo \"*.garbage text working-tree-encoding=UTF-16\" >.gitattributes &&\n+\tprintf \"garbage\" >t.garbage &&\n+\ttest_must_fail git add t.garbage 2>err.out &&\n+\ttest_i18ngrep \"failed to encode .* from CONFUSE to UTF-8\" err.out\n+'\n+\n test_done\n-- \n2.18.0\n\n"},{"id":"351882","messageId":"5D87BD79-983C-45D8-A284-1CFC65FBDDB8@gmail.com","threadId":"48840","inReplyTo":"20180708183036.29459-2-larsxschneider@gmail.com","subject":"Re: [PATCH v1 1/2] convert: refactor conversion driver config parsing","fromName":"Lars Schneider","fromEmail":"larsxschneider@gmail.com","sentAt":"2018-07-08T18:35:50Z","receivedAt":"2018-07-08T18:35:57Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"\n\n> On Jul 8, 2018, at 8:30 PM, larsxschneider@gmail.com wrote:\n> \n> From: Lars Schneider <larsxschneider@gmail.com>\n> \n> Refactor conversion driver config parsing to ease the parsing of new\n> configs in a subsequent patch.\n> \n> No functional change intended.\n> \n> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n> ---\n> convert.c | 64 +++++++++++++++++++++++++++----------------------------\n> 1 file changed, 32 insertions(+), 32 deletions(-)\n> \n> diff --git a/convert.c b/convert.c\n> index 64d0d30e08..949bc783e4 100644\n> --- a/convert.c\n> +++ b/convert.c\n> @@ -1003,43 +1003,43 @@ static int read_convert_config(const char *var, const char *value, void *cb)\n> \tint namelen;\n> \tstruct convert_driver *drv;\n> \n> ...\n> \n> -\t/*\n> -\t * filter.<name>.smudge and filter.<name>.clean specifies\n> -\t * the command line:\n> -\t *\n> -\t *\tcommand-line\n> -\t *\n> -\t * The command-line will not be interpolated in any way.\n> -\t */\n> +\t\t/*\n> +\t\t * filter.<name>.smudge and filter.<name>.clean specifies\n> +\t\t * the command line:\n> +\t\t *\n> +\t\t *\tcommand-line\n> +\t\t *\n> +\t\t * The command-line will not be interpolated in any way.\n> +\t\t */\n\nI stumbled over this comment introduced in aa4ed402c9 \n(\"Add 'filter' attribute and external filter driver definition.\", 2007-04-21).\n\nIs the middle \"command-line\" intentional?\n\n- Lars"},{"id":"351883","messageId":"9DAA19D0-AE1A-493B-B6F5-2FA38E876928@gmail.com","threadId":"48840","inReplyTo":"20180708183036.29459-3-larsxschneider@gmail.com","subject":"Re: [PATCH v1 2/2] convert: add alias support for 'working-tree-encoding' attributes","fromName":"Lars Schneider","fromEmail":"larsxschneider@gmail.com","sentAt":"2018-07-08T18:39:07Z","receivedAt":"2018-07-08T18:39:14Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"\n\n> On Jul 8, 2018, at 8:30 PM, larsxschneider@gmail.com wrote:\n> \n> From: Lars Schneider <larsxschneider@gmail.com>\n> \n> In 107642fe26 (\"convert: add 'working-tree-encoding' attribute\",\n> 2018-04-15) we added an attribute which defines the working tree\n> encoding of a file.\n> \n> Some platforms might spell the name of a certain encoding differently or\n> some users might want to use different encodings on different platforms.\n> Add the Git config \"encoding.<iconv-name>.insteadOf = <alias-name>\" to\n> support these use-cases with a user specific mapping. If the alias\n> matches an existing encoding name, then the alias will take precedence.\n> The alias is case insensitive.\n> \n> Example:\n> \n> \t(in .gitattributes)\n> \t*.c\tworking-tree-encoding=foo\n> \n> \t(in config)\n> \t[encoding \"UTF-16\"]\n> \t\tinsteadOf = foo\n> \n> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n> ---\n> Documentation/gitattributes.txt  | 19 ++++++++++++\n> convert.c                        | 50 ++++++++++++++++++++++++++++++++\n> t/t0028-working-tree-encoding.sh | 28 ++++++++++++++++++\n> 3 files changed, 97 insertions(+)\n> \n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 92010b062e..3628f0e5cf 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -366,6 +366,25 @@ command to guess the encoding:\n> file foo.ps1\n> ------------------------\n> \n> ...\n> \n> \treturn 0;\n> @@ -1225,6 +1264,17 @@ static const char *git_path_check_encoding(struct attr_check_item *check)\n> \t\tdie(_(\"true/false are no valid working-tree-encodings\"));\n> \t}\n> \n> +\t/* Check if an alias was defined for the encoding in the Git config */\n> +\tif (encoding_aliases_initialized) {\n> +\t\tstruct alias2enc hashkey;\n> +\t\tstruct alias2enc *entry;\n> +\t\thashmap_entry_init(&hashkey, strihash(value));\n> +\t\thashkey.alias = value;\n> +\t\tentry = hashmap_get(&encoding_map, &hashkey, NULL);\n> +\t\tif (entry)\n> +\t\t\tvalue = entry->encoding;\n\nHere I reuse the char* pointer from the hashmap.\nThe hashmap is static and no entry is ever removed.\nIs this OK or should I rather create a copy of the string?\n\nThanks,\nLars\n\n"},{"id":"352001","messageId":"xmqqtvp8ch54.fsf@gitster-ct.c.googlers.com","threadId":"48840","inReplyTo":"5D87BD79-983C-45D8-A284-1CFC65FBDDB8@gmail.com","subject":"Re: [PATCH v1 1/2] convert: refactor conversion driver config parsing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-09T20:01:59Z","receivedAt":"2018-07-09T20:02:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Schneider <larsxschneider@gmail.com> writes:\n\n>> On Jul 8, 2018, at 8:30 PM, larsxschneider@gmail.com wrote:\n>> \n>> From: Lars Schneider <larsxschneider@gmail.com>\n>> \n>> Refactor conversion driver config parsing to ease the parsing of new\n>> configs in a subsequent patch.\n>> \n>> No functional change intended.\n>> \n>> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n>> ---\n>> convert.c | 64 +++++++++++++++++++++++++++----------------------------\n>> 1 file changed, 32 insertions(+), 32 deletions(-)\n>> \n>> diff --git a/convert.c b/convert.c\n>> index 64d0d30e08..949bc783e4 100644\n>> --- a/convert.c\n>> +++ b/convert.c\n>> @@ -1003,43 +1003,43 @@ static int read_convert_config(const char *var, const char *value, void *cb)\n>> \tint namelen;\n>> \tstruct convert_driver *drv;\n>> \n>> ...\n>> \n>> -\t/*\n>> -\t * filter.<name>.smudge and filter.<name>.clean specifies\n>> -\t * the command line:\n>> -\t *\n>> -\t *\tcommand-line\n>> -\t *\n>> -\t * The command-line will not be interpolated in any way.\n>> -\t */\n>> +\t\t/*\n>> +\t\t * filter.<name>.smudge and filter.<name>.clean specifies\n>> +\t\t * the command line:\n>> +\t\t *\n>> +\t\t *\tcommand-line\n>> +\t\t *\n>> +\t\t * The command-line will not be interpolated in any way.\n>> +\t\t */\n>\n> I stumbled over this comment introduced in aa4ed402c9 \n> (\"Add 'filter' attribute and external filter driver definition.\", 2007-04-21).\n>\n> Is the middle \"command-line\" intentional?\n\nI think it was a deliberate but ineffective attempt to emphasize the\nfact that the command line is used as-is, and does not get split at\nSP nor goes through interpolation of placeholders using API such as\nstrbuf_expand().\n"},{"id":"352128","messageId":"xmqqa7qz9hws.fsf@gitster-ct.c.googlers.com","threadId":"48840","inReplyTo":"20180708183036.29459-2-larsxschneider@gmail.com","subject":"Re: [PATCH v1 1/2] convert: refactor conversion driver config parsing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-10T16:25:55Z","receivedAt":"2018-07-10T16:26:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"larsxschneider@gmail.com writes:\n\n> From: Lars Schneider <larsxschneider@gmail.com>\n>\n> Refactor conversion driver config parsing to ease the parsing of new\n> configs in a subsequent patch.\n>\n> No functional change intended.\n>\n> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n> ---\n\nThe change unfortunately makes everything indented one level deeper,\nbut I can see why \"we look for the only thing we are interested in\nand return early when given anything else\" that allowed us to avoid\nthe deep indentation would get in the way of the second patch.\n"},{"id":"352129","messageId":"xmqq601n9hn1.fsf@gitster-ct.c.googlers.com","threadId":"48840","inReplyTo":"20180708183036.29459-3-larsxschneider@gmail.com","subject":"Re: [PATCH v1 2/2] convert: add alias support for 'working-tree-encoding' attributes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-10T16:31:46Z","receivedAt":"2018-07-10T16:31:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"larsxschneider@gmail.com writes:\n\n> From: Lars Schneider <larsxschneider@gmail.com>\n>\n> In 107642fe26 (\"convert: add 'working-tree-encoding' attribute\",\n> 2018-04-15) we added an attribute which defines the working tree\n> encoding of a file.\n>\n> Some platforms might spell the name of a certain encoding differently or\n> some users might want to use different encodings on different platforms.\n> Add the Git config \"encoding.<iconv-name>.insteadOf = <alias-name>\" to\n> support these use-cases with a user specific mapping. If the alias\n> matches an existing encoding name, then the alias will take precedence.\n> The alias is case insensitive.\n>\n> Example:\n>\n> \t(in .gitattributes)\n> \t*.c\tworking-tree-encoding=foo\n>\n> \t(in config)\n> \t[encoding \"UTF-16\"]\n> \t\tinsteadOf = foo\n>\n> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>\n> ---\n\nHmph, when I was reading the discussion between you and Peff, I\ndidn't expect it end up with a change too specific to this single\nattribute.  I was instead imagining that a change would come closer\nto where we call iconv (perhaps we muck with in/out_encoding\nparameters to iconv_open()), so that places other than the\nworking-tree-encoding (e.g. commit log message encoding) would start\nhonoring the same configuration variable in a consistent way.\n"}]}