Products Resources Support About Us

Git: any ascii to ebcdic conversion for repo contents?

Is there any facility in beta or planned to do codepage conversion on repositories? We have an option like this in the java SVN client, the requirement and impl is described here:

https://issues.tmatesoft.com/issue/SVNKIT-22

This allows a 7-bit safe ASCII repo to:

  • checkout on z/OS
  • implicitly convert text files to IBM-1047 (SVN has the benefit of mimetypes for files)
  • use/build projects that expect to be in 1047
  • check in changes and have it work the way you’d want

Yes, the encoding of checked-out files can be controlled via the git attributes mechanism. The release notes describe how to use this, but briefly, there are two new attributes available on a per-file basis:

  • git-encoding sets the encoding used in the repository
  • working-tree-encoding sets the encoding to be used in the checked-out working directory

Conversion is done only if both attributes are set for a file. Here is an example that causes all .h and .c files to be checked out as EBCDIC:

*.[hc] git-encoding=iso8859-1 working-tree-encoding=ibm-1047

This allows an open source repo cloned from (say) github to be used bi-directionally.

– Jerry

Thanks Jerry. I’m starting to think there’s a third doc I haven’t seen yet, the release notes PDF. I was only looking at the README and the share/doc/git/*

Here they are.

git_2.3.5_release_notes.pdf (51.4 KB)

Awesome, exactly the content I needed.