2
votes

I have a program that is written in PostScript. While GitHub allows me to view PostScript files as text, it says "Binary file not shown" when comparing commits. Adding .ps diff in the .gitattributes file doesn't make a difference.

All the desktop tools like git gui or meld have no problem diffing the PostScript code. The code is plain ASCII:

$ file -bi fdf2xfdf.ps 
text/plain; charset=us-ascii
1
This seems like something that would be better directed towards GitHub's support staff. - jwodder

1 Answers

0
votes

GitHub describes how it detects file types and decides how to handle them at https://github.com/github/linguist/ . The way it handles PostScript language files is described at language.yml#L3504-L3515:

PostScript:
  type: markup
  color: "#da291c"
  extensions:
  - ".ps"
  - ".eps"
  - ".pfa"
  tm_scope: source.postscript
  aliases:
  - postscr
  ace_mode: text
  language_id: 291

The type: markup is perhaps what is preventing you from getting the handling you want. Programming languages have type: programming.

Github respects .gitattributes as a way of controlling how its language processing happens. You might need to set the file path as non-documentation, and as detectable as programming code.

$ cat .gitattributes
*.ps linguist-documentation=false
*.ps linguist-detectable=true

I have not tested this myself, because I don't want to take the time now to set up a GitHub repository with a PostScript language file in it, then clean it up.