I'm working in the environment of abas-ERP, which uses - for historical reasons - an esoteric charset named abas-s3. We use Git with local repositories on the ERP-server for versioning our programs.
Naturally Git doesn't support abas-s3. On the erp-servers there is a program called s3_conv, which converts from abas-s3 to the outside world (e.g. UTF-8 and UTF-16) and the other way round.
Is there any way to use this program, to use UTF-8 for the repository and s3 for the worktree?
I appreciate any feedback! Thanks in advance!
If the problem is with file contents, you can use clean/smudge filters (see gitattributes) to have Git convert to UTF-8 when storing to repository, and to abas-s3 when checking out the contents into the working area.
You can find explanation also in Pro Git book.
Summary:
You need to define in the config file (per repository, per user, or system-wide) a filter consisting of two commands:
cleanthat transforms from working area representation to repository representation, andsmudgethat works in reverse. Assuming thats3_convworks likeiconv, it could look like this (this is a fragment of appropriate config file):Declare with gitattributes file (inside repository, or per-repository, or per-user, or system-wide) which files should be transformed using this operation. Assuming that you want to transform files with SQL, using
*.sqlextension, appropriate fragment of a file could look like this (note that there cannot be whitespace around=here):Note that Git is encoding-agnostic, and you don't need to convert the contents of files... unless you need it for interop?
If you need to have
git diffdisplay changes correctly (assuming that you don't have pager that can display abas-s3 encoding, and could be used incore.pager), you might want to configuretextconvfilter INSTEAD:In config file:
This assumes that terminal and pager is configured to display utf-8
In gitattributes file: