1

I want to host a binary file on a web-based hosting service for git (i.e. GitHub) so I can easily see any changes made to it.

The binary file in question uses the common ASCII character encoding so that this binary

73 63 6F 70 65 20 68 75 72 72 72 20 69 6E 69 74 69 61 6C 69 7A 65 72 20 64 65 72 70 0D 0A 20 20 20 20 66 75 6E 63 74 69 6F 6E 20 64 65 72 70 20 74 61 6B 65 73 20 6E 6F 74 68 69 6E 67 20 72 65 74 75 72 6E 73 20 6E 6F 74 68 69 6E 67 0D 0A 20 20 20 20 20 20 20 20 63 61 6C 6C 20 53 65 74 53 74 61 72 74 4C 6F 63 50 72 69 6F 28 24 42 2C 24 41 2C 24 41 2C 4D 41 50 5F 4C 4F 43 5F 50 52 49 4F 5F 48 49 47 48 29 0D 0A 20 20 20 20 65 6E 64 66 75 6E 63 74 69 6F 6E 0D 0A 65 6E 64 73 63 6F 70 65

becomes this readable text (†)

scope hurrr initializer derp
    function derp takes nothing returns nothing
        call SetStartLocPrio($B,$A,$A,MAP_LOC_PRIO_HIGH)
    endfunction
endscope

The problem is that services like GitHub will only show me the raw binary when I want to view the file in-browser (or have me download and open it in a text editor):

GitHub's view of binary files

Right now, to have any changes made, I have to download the changed binary file, convert it to readable text, then use diff to see what changes have been made. This is tedious and loses the beautiful web interface that GitHub has.

So my question is this: Can I tell GitHub (or any equivalent service) to translate a binary file to readable text?

--

(†) For anyone interested in trivia, this is indeed vJass syntax for WarCraft III.

Mossmyr
  • 909
  • 2
  • 10
  • 26
  • 1
    Did you try with a `.gitattributes` file ? You may want to start with that: `*.ext text`. See https://www.git-scm.com/docs/gitattributes – NoDataFound Apr 08 '18 at 12:53
  • So, your binary file contains (ASCII-)encoded characters only? Isn't that the definition of a text file? What do you mean by "convert it to readable text", since it's *already* readable text? What is the extension of the file? What does it actually contain? – JB Nizet Apr 08 '18 at 12:56
  • @NoDataFound Thank you, I did not know about .gitattributes. After reading some of the documentation you linked, I tried adding a simple .gitattribute file `*.wct -text -diff`, but GitHub still only recognizes my .wct file as binary. @JBNizet The file format is .wct and contains only ASCII-encoded characters as far as I know. However, GitHub and any text editor I use does not recognize it as a text file. – Mossmyr Apr 08 '18 at 13:25
  • 1
    Try the diff option. Don't know if it work in github but this answer seem to indicate it works in git: https://stackoverflow.com/a/24381671/1023553 See also Linguist: https://github.com/github/linguist – NoDataFound Apr 08 '18 at 14:04
  • What does a text editor show when you open it then? And how do you convert it to text? – JB Nizet Apr 08 '18 at 14:17
  • @NoDataFound Thank you. It seems changing .gitattributes to `*.wct diff` makes the `$ git diff` command interpret the .wct file as text. It does not work for GitHub however. Do you know of any web-based git hosting service like GitHub that it works for? @JBNizet The two code blocks I used in my question post are what my .wct file shows up as in a text editor and what it looks like after conversion to ASCII respectively. – Mossmyr Apr 08 '18 at 14:34
  • I found this very related question: https://stackoverflow.com/questions/24212291/make-github-use-gitattributes-binary-attribute Quote: "So, for now Github does not support .gitattributes file to suppress any diff." I guess what I want is not possible for GitHub. – Mossmyr Apr 08 '18 at 14:36
  • @Mossmyr: play with the linguist from github. As far as I understand it, it is what handle how github determine binary files. – NoDataFound Apr 08 '18 at 17:51

0 Answers0