Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of mixed-codepage files in git #78

Open
stevchen-ibm opened this issue Aug 3, 2023 · 1 comment
Open

Handling of mixed-codepage files in git #78

stevchen-ibm opened this issue Aug 3, 2023 · 1 comment

Comments

@stevchen-ibm
Copy link

We have some mixed-codepage files that are in mostly ibm-1047 but mixed with other codepage such as Japanese.
We can use -text in .gitattributes to check in the files, however using this approach we will lose the ability to do blame/diff the part that are in text (ibm-1047 code).
Perhaps a solution will be to support zos-working-tree-encoding=ibm-1047 -text in .gitattributes?

@nickrayjones
Copy link

nickrayjones commented Jan 23, 2025

I'm having a similar issue with -text. It appears that using -text in .gitattributes results in a binary tagged file on z/OS.

I recently discovered this when .gitattributes has:
* -text git-encoding=utf-8 zos-working-tree-encoding=ibm-1047 working-tree-encoding=utf-8

Normally we have this set
* text git-encoding=utf-8 zos-working-tree-encoding=ibm-1047 working-tree-encoding=utf-8
And the file is tagged as text with the expected code page ibm-1047 on z/OS

While not intuitive, that the meaning of -text is not 'load this file as binary'. -- https://git-scm.com/docs/gitattributes#_effects
The -text should mean

Unsetting the text attribute on a path tells Git not to attempt any end-of-line conversion upon checkin or checkout.

I think -text could be honored by using the chattr command to set the desired flags (along with chtag).

To get files as binary the suggestion is to unset the diff attribute (-diff) but the binary attribute was later added to mean -text -diff
https://git-scm.com/docs/gitattributes#_marking_files_as_binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants