Re: Use of new .gitattributes working-tree-encoding attribute across different platform types
- From
Jeff King <peff@peff.net>
- Date
- Jun 28, 2018, 14:34 UTC
- Message-ID
- <20180628143405.GA16657@sigill.intra.peff.net>
- In-Reply-To
- <20180628024446.GD644867@genre.crustytoothpaste.net>
On Thu, Jun 28, 2018 at 02:44:47AM +0000, brian m. carlson wrote:
Show 8 quoted lines
> 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).
-Peff