Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:52:55+00:00 2026-05-14T15:52:55+00:00

I am just beginning to git for the first time and have git and

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:52:56+00:00Added an answer on May 14, 2026 at 3:52 pm

    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.c displays that message because its function gitg_utils_can_display_content_type() return an unknown type for text display purposes.

    gboolean
    gitg_utils_can_display_content_type(gchar const *content_type)
    {
            return g_content_type_is_a(content_type, "text/plain") || 
                       g_content_type_equals(content_type, "application/octet-stream");
    }
    

    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_a is a function of glib\gio\gcontenttype.c (project glib), and it calls get_registry_classes_key(), which read the registry (HKEY_CLASSES_ROOT for Windows, mime type registered for Unix).

    So if you register the go files, it should work:

    xdg-icon-resource install --context mimetypes --size 48 go-type.png plain/text
    

    The xml file to register (found by the OP Hotei, great work!)

    <?xml version="1.0" encoding="utf-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
      <mime-type type="application/x-extension-go">
        <sub-class-of type="text/plain"/>
        <comment>go for files</comment>
        <glob pattern="*.go"/>
      </mime-type>
    </mime-info>
    
    xdg-mime install go-mime.xml
    update-desktop-database
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.