git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] treat any file with NUL as binary

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 16, 2008, 01:21 UTC
Message-ID
<7vr6gibm56.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1200407309-10992-1-git-send-email-dpotapov@gmail.com>
Dmitry Potapov <dpotapov@gmail.com> writes:
> There are two heuristics in Git to detect whether a file is binary
> or text. One in xdiff-interface.c relied on existing NUL byte at

"relies on" (not past tense); we may want to say that it is stolen from GNU diff to be compatible.

Show 6 quoted lines
> the beginning. However, convert.c used a different heuristic, which
> relied that the number of non-printable symbols is less than 1%.
>
> Due to difference in approaches whether a file is binary or not,
> it was possible that a file that diff treats as binary will not be
> treated as text by CRLF conversation. This is very confusing for
"conversion".
> a user who seeing that 'git diff' shows file as binary expects it
"sees".
Show 7 quoted lines
> to be added as binary.
>
> This patch makes is_binary to consider any file that contains at
> least one NUL character as binary.
> ---
>
> So, please, consider it for inclusion as a bug fix.

Please typofix and apply "s/.$/, to ensure that the heuristics used for CRLF conversion is tighter than what is used by diff./" or something like that at the end.

Also please add sign-off.  The patch looks correct.
Previous: Junio C HamanoNext: Dmitry Potapov
Message 6 of 7 in “treat any file with NUL as binary”
  1. treat any file with NUL as binaryDmitry Potapov, Jan 15, 2008
  2. Steffen ProhaskaJan 15, 2008
  3. Junio C HamanoJan 15, 2008
  4. Dmitry PotapovJan 16, 2008
  5. Junio C HamanoJan 16, 2008
  6. Junio C HamanoJan 16, 2008
  7. treat any file with NUL as binaryDmitry Potapov, Jan 16, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.