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 6361933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:50:30+00:00 2026-05-24T23:50:30+00:00

Looking for articles, documentation or straight head knowledge of how different source control systems

  • 0

Looking for articles, documentation or straight head knowledge of how different source control systems differentiate (or detect) the type of file (binary vs. text). Of particular interest is how Git does it vs Mercurial.

Do they look at:
File extensions?
File signatures or content (ie. is this file UTF8)?
A mix of things?

  • 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-24T23:50:31+00:00Added an answer on May 24, 2026 at 11:50 pm

    SVN:

    When you first add or import a file into Subversion, the file is examined to determine if it is a binary file. Currently, Subversion just looks at the first 1024 bytes of the file; if any of the bytes are zero, or if more than 15% are not ASCII printing characters, then Subversion calls the file binary. This heuristic might be improved in the future, however.

    http://subversion.apache.org/faq.html#binary-files

    Git works in a similar way. Git usually guesses correctly whether a blob contains text or binary data by examining the beginning of the contents – It checks for any occurrence of a zero byte (NUL “character”) in the first 8000 bytes.

    http://git-scm.com/docs/gitattributes

    And from Git source:

     #define FIRST_FEW_BYTES 8000
     int buffer_is_binary(const char *ptr, unsigned long size)
     {
             if (FIRST_FEW_BYTES < size)
                     size = FIRST_FEW_BYTES;
             return !!memchr(ptr, 0, size);
     }
    

    http://git.kernel.org/?p=git/git.git;a=blob;f=xdiff-interface.c;h=0e2c169227ad29b5bf546c6c1b97e1a1d8ed7409;hb=HEAD

    And @tonfa makes a good point that “Also note that the only place where it cares about a file being text vs. binary is for diplaying diff, and for doing merges. The storage format does not care about it.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are looking for a way to publish articles in different languages, including differences
This is a request for pointers to good documentation/good articles. I'm looking for information
I'm looking for articles, forum or blog posts dealing with SharePoint and thread safety?
I'm looking for books / articles / papers on Javascript engine internals along the
I'm looking for strategies and articles on making Carbon code 64-bit ready. Carbon for
I have been looking around on the web and found some articles about the
I have been writing articles on the wordpress.com blog , now I am looking
I am looking for documentation for the Blackhen threading library and am unable to
I've been looking at the re documentation and at other questions but I keep
I'm looking for a way to translate http://www.mysite.com/articles.php?id=1 into http://www.mysite.com/articles/name_of_article_from_field_in_database_with_id_1 I'm ok with doing

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.