git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Schneider <larsxschneider@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Steve Groeger <GROEGES@uk.ibm.com>,
	git@vger.kernel.org
Subject: Re: Use of new .gitattributes working-tree-encoding attribute across different platform types
Date: Thu, 28 Jun 2018 19:21:18 +0200	[thread overview]
Message-ID: <4E8CDDC9-2957-401F-9BBE-93276C026848@gmail.com> (raw)
In-Reply-To: <20180628143405.GA16657@sigill.intra.peff.net>



> On Jun 28, 2018, at 4:34 PM, Jeff King <peff@peff.net> wrote:
> 
> On Thu, Jun 28, 2018 at 02:44:47AM +0000, brian m. carlson wrote:
> 
>> On Wed, Jun 27, 2018 at 07:54:52AM +0000, Steve Groeger wrote:
>>> We have common code that is supposed to be usable across different platforms and hence different file encodings. With the full support of the working-tree-encoding in the latest version of git on all platforms, how do we have files converted to different encodings on different platforms?
>>> I could not find anything that would allow us to say 'if platform = z/OS then encoding=EBCDIC else encoding=ASCII'.   Is there a way this can be done?
>> 
>> I don't believe there is such functionality.  Git doesn't have
>> attributes that are conditional on the platform in that sort of way.
>> You could use a smudge/clean filter and adjust the filter for the
>> platform you're on, which might meet your needs.
> 
> We do have prior art in the line-ending code, though. There the
> attributes say either that a file needs a specific line-ending type
> (which is relatively rare), or that it should follow the system type,
> which is then set separately in the config.
> 
> I have the impression that the working-tree-encoding stuff was made to
> handle the first case, but not the second. It doesn't seem like an
> outrageous thing to eventually add.
> 
> (Though I agree that clean/smudge filters would work, and can even
> implement the existing working-tree-encoding feature, albeit less
> efficiently and conveniently).

Thanks for the suggestion Peff! 
How about this:

1) We allow users to set the encoding "auto". Example:

	*.txt working-tree-encoding=auto

2) We define a new variable `core.autoencoding`. By default the value is 
UTF-8 (== no re-encoding) but user can set to any value in their Git config. 
Example:

    git config --global core.autoencoding UTF-16

All files marked with the value "auto" will use the encoding defined in
`core.autoencoding`.

Would that work?

@steve: Would that fix your problem?

- Lars

  reply	other threads:[~2018-06-28 17:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  7:54 Use of new .gitattributes working-tree-encoding attribute across different platform types Steve Groeger
2018-06-27 17:38 ` Torsten Bögershausen
2018-06-28  2:44 ` brian m. carlson
2018-06-28 14:34   ` Jeff King
2018-06-28 17:21     ` Lars Schneider [this message]
2018-06-28 17:27       ` Jeff King
2018-07-01 17:56         ` brian m. carlson
2018-07-02 18:17           ` Jeff King
2018-07-03 16:01             ` Junio C Hamano
2018-07-02 12:13     ` Steve Groeger
2018-07-02 14:09       ` Lars Schneider
2018-07-02 18:20         ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2018-06-27  7:50 Steve Groeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8CDDC9-2957-401F-9BBE-93276C026848@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=GROEGES@uk.ibm.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).