From: Junio C Hamano Date: Wed, 16 Jan 2008 01:21:41 GMT Subject: Re: [PATCH] treat any file with NUL as binary Message-ID: <7vr6gibm56.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1200407309-10992-1-git-send-email-dpotapov@gmail.com> Dmitry Potapov 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. > 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". > 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.