I am just beginning to “git” for the first time and have git and gitg installed from Ubuntu 10.4 / AMD64 distribution (i.e. maybe not ‘latest’ version but not ancient).
I am trying to look at the go code I’ve committed via gitg and in the “tree tab” it says:
Cannot display file content as text.
However, the “details tab” shows the diffs of the same file just fine.
I know gitg’s “tree tab” is working because I can use the tree view on *.c / *.html / *.txt, etc just fine.
<question> Is there a way to tweak gitg into understanding that “*.go” is just text? </question>
A little more context:
- Installed gitg version is 0.0.5 – ie a version behind latest – 0.0.6 – source of which I am looking thru now.
I do have a working /usr/share/gtksourceview-2.0/language-specs/go.lang.
It works just fine as highlighter in gedit.
It appears that gitg may require displayable files to have a mime type of “text/plain“, so I added that to go.lang
No joy. gitg still fails on *.go.
I’m relatively sure the fix is simple, just don’t know where to look.
When it comes to gitg alt text http://trac.novowork.com/gitg/chrome/site/logo.png (the git repository viewer targeting gtk+/GNOME), it may be interesting to look at its code (also here):
In particular,
gitg-commit-view.cdisplays that message because its functiongitg_utils_can_display_content_type()return an unknown type for text display purposes.So you do need to declare go file type as
text/plain(in gitg, not “to go.lang”) and it should work.Actually, the declaration is not in gitg:
g_content_type_is_ais a function ofglib\gio\gcontenttype.c(project glib), and it callsget_registry_classes_key(), which read the registry (HKEY_CLASSES_ROOTfor Windows, mime type registered for Unix).So if you register the go files, it should work:
The xml file to register (found by the OP Hotei, great work!)