<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/convert.c, branch v1.6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.6.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2008-10-12T19:36:19Z</updated>
<entry>
<title>Replace calls to strbuf_init(&amp;foo, 0) with STRBUF_INIT initializer</title>
<updated>2008-10-12T19:36:19Z</updated>
<author>
<name>Brandon Casey</name>
<email>casey@nrlssc.navy.mil</email>
</author>
<published>2008-10-09T19:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f285a2d7ed6548666989406de8f0e7233eb84368'/>
<id>urn:sha1:f285a2d7ed6548666989406de8f0e7233eb84368</id>
<content type='text'>
Many call sites use strbuf_init(&amp;foo, 0) to initialize local
strbuf variable "foo" which has not been accessed since its
declaration. These can be replaced with a static initialization
using the STRBUF_INIT macro which is just as readable, saves a
function call, and takes up fewer lines.

Signed-off-by: Brandon Casey &lt;casey@nrlssc.navy.mil&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Fixed text file auto-detection: treat EOF character 032 at the end of file as printable</title>
<updated>2008-07-12T04:14:27Z</updated>
<author>
<name>Dmitry Kakurin</name>
<email>Dmitry.Kakurin@gmail.com</email>
</author>
<published>2008-07-11T16:48:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f9dd4bf4e58af0b4828c7e7013080dba59f8a6b9'/>
<id>urn:sha1:f9dd4bf4e58af0b4828c7e7013080dba59f8a6b9</id>
<content type='text'>
Signed-off-by: Dmitry Kakurin &lt;Dmitry.Kakurin@gmail.com&gt;
Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert.c: Use 'git_config_string' to get 'smudge' and 'clean'</title>
<updated>2008-07-06T00:42:30Z</updated>
<author>
<name>Brian Hetro</name>
<email>whee@smaertness.net</email>
</author>
<published>2008-07-05T05:24:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cd8be6c9b64adcb7744aba89bac8ef4261ccacc5'/>
<id>urn:sha1:cd8be6c9b64adcb7744aba89bac8ef4261ccacc5</id>
<content type='text'>
Signed-off-by: Brian Hetro &lt;whee@smaertness.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Provide git_config with a callback-data parameter</title>
<updated>2008-05-14T19:34:44Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>Johannes.Schindelin@gmx.de</email>
</author>
<published>2008-05-14T17:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ef90d6d4208a5130185b04f06e5f90a5f9959fe3'/>
<id>urn:sha1:ef90d6d4208a5130185b04f06e5f90a5f9959fe3</id>
<content type='text'>
git_config() only had a function parameter, but no callback data
parameter.  This assumes that all callback functions only modify
global variables.

With this patch, every callback gets a void * parameter, and it is hoped
that this will help the libification effort.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sp/safecrlf'</title>
<updated>2008-02-17T01:59:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-02-17T01:59:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2ac4b4b2228f3ef996db7b07aea74c4b1a796f38'/>
<id>urn:sha1:2ac4b4b2228f3ef996db7b07aea74c4b1a796f38</id>
<content type='text'>
* sp/safecrlf:
  safecrlf: Add mechanism to warn about irreversible crlf conversions
</content>
</entry>
<entry>
<title>convert.c: guard config parser from value=NULL</title>
<updated>2008-02-11T21:11:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-02-11T18:53:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7269e5cb703083efb084ba19bc703ebc915aa5c'/>
<id>urn:sha1:a7269e5cb703083efb084ba19bc703ebc915aa5c</id>
<content type='text'>
filter.*.smudge and filter.*.clean configuration variables expect a
string value.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>safecrlf: Add mechanism to warn about irreversible crlf conversions</title>
<updated>2008-02-06T21:07:28Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2008-02-06T11:25:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=21e5ad50fc5e7277c74cfbb3cf6502468e840f86'/>
<id>urn:sha1:21e5ad50fc5e7277c74cfbb3cf6502468e840f86</id>
<content type='text'>
CRLF conversion bears a slight chance of corrupting data.
autocrlf=true will convert CRLF to LF during commit and LF to
CRLF during checkout.  A file that contains a mixture of LF and
CRLF before the commit cannot be recreated by git.  For text
files this is the right thing to do: it corrects line endings
such that we have only LF line endings in the repository.
But for binary files that are accidentally classified as text the
conversion can corrupt data.

If you recognize such corruption early you can easily fix it by
setting the conversion type explicitly in .gitattributes.  Right
after committing you still have the original file in your work
tree and this file is not yet corrupted.  You can explicitly tell
git that this file is binary and git will handle the file
appropriately.

Unfortunately, the desired effect of cleaning up text files with
mixed line endings and the undesired effect of corrupting binary
files cannot be distinguished.  In both cases CRLFs are removed
in an irreversible way.  For text files this is the right thing
to do because CRLFs are line endings, while for binary files
converting CRLFs corrupts data.

This patch adds a mechanism that can either warn the user about
an irreversible conversion or can even refuse to convert.  The
mechanism is controlled by the variable core.safecrlf, with the
following values:

 - false: disable safecrlf mechanism
 - warn: warn about irreversible conversions
 - true: refuse irreversible conversions

The default is to warn.  Users are only affected by this default
if core.autocrlf is set.  But the current default of git is to
leave core.autocrlf unset, so users will not see warnings unless
they deliberately chose to activate the autocrlf mechanism.

The safecrlf mechanism's details depend on the git command.  The
general principles when safecrlf is active (not false) are:

 - we warn/error out if files in the work tree can modified in an
   irreversible way without giving the user a chance to backup the
   original file.

 - for read-only operations that do not modify files in the work tree
   we do not not print annoying warnings.

There are exceptions.  Even though...

 - "git add" itself does not touch the files in the work tree, the
   next checkout would, so the safety triggers;

 - "git apply" to update a text file with a patch does touch the files
   in the work tree, but the operation is about text files and CRLF
   conversion is about fixing the line ending inconsistencies, so the
   safety does not trigger;

 - "git diff" itself does not touch the files in the work tree, it is
   often run to inspect the changes you intend to next "git add".  To
   catch potential problems early, safety triggers.

The concept of a safety check was originally proposed in a similar
way by Linus Torvalds.  Thanks to Dimitry Potapov for insisting
on getting the naked LF/autocrlf=true case right.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
</content>
</entry>
<entry>
<title>treat any file with NUL as binary</title>
<updated>2008-01-16T17:10:34Z</updated>
<author>
<name>Dmitry Potapov</name>
<email>dpotapov@gmail.com</email>
</author>
<published>2008-01-16T01:59:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=28624193b2ce622144136d373e136455b6b13967'/>
<id>urn:sha1:28624193b2ce622144136d373e136455b6b13967</id>
<content type='text'>
There are two heuristics in Git to detect whether a file is binary
or text. One in xdiff-interface.c (which is taken from GNU diff)
relies on existence of the NUL byte at the beginning. However,
convert.c used a different heuristic, which relied on the percent
of non-printable symbols (less than 1% for text files).

Due to differences in detection whether a file is binary or not,
it was possible that a file that diff treats as binary could be
treated as text by CRLF conversion. This is very confusing for a
user who sees that 'git diff' shows the file as binary expects it
to be added as binary.

This patch makes is_binary to consider any file that contains at
least one NUL character as binary, to ensure that the heuristics
used for CRLF conversion is tighter than what is used by diff.

Signed-off-by: Dmitry Potapov &lt;dpotapov@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Use the asyncronous function infrastructure to run the content filter.</title>
<updated>2007-10-21T05:30:42Z</updated>
<author>
<name>Johannes Sixt</name>
<email>johannes.sixt@telecom.at</email>
</author>
<published>2007-10-19T19:48:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=546bb5823249678bc6ad11e65661d896ed83448a'/>
<id>urn:sha1:546bb5823249678bc6ad11e65661d896ed83448a</id>
<content type='text'>
Signed-off-by: Johannes Sixt &lt;johannes.sixt@telecom.at&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Avoid a dup2(2) in apply_filter() - start_command() can do it for us.</title>
<updated>2007-10-21T05:30:42Z</updated>
<author>
<name>Johannes Sixt</name>
<email>johannes.sixt@telecom.at</email>
</author>
<published>2007-10-19T19:48:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7683b6e81fa0f1f55d4974d69fb87c7c7b6b394e'/>
<id>urn:sha1:7683b6e81fa0f1f55d4974d69fb87c7c7b6b394e</id>
<content type='text'>
When apply_filter() runs the external (clean or smudge) filter program, it
needs to pass the writable end of a pipe as its stdout. For this purpose,
it used to dup2(2) the file descriptor explicitly to stdout. Now we use
the facilities of start_command() to do it for us.

Furthermore, the path argument of a subordinate function, filter_buffer(),
was not used, so here we replace it to pass the fd instead.

Signed-off-by: Johannes Sixt &lt;johannes.sixt@telecom.at&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
</feed>
