<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/convert.c, branch v2.10.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.10.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.10.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-08-14T20:45:52Z</updated>
<entry>
<title>convert: Correct NNO tests and missing `LF will be replaced by CRLF`</title>
<updated>2016-08-14T20:45:52Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-08-13T21:29:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a0ad53c18100226cb1a138cb9b3bc3615170be8f'/>
<id>urn:sha1:a0ad53c18100226cb1a138cb9b3bc3615170be8f</id>
<content type='text'>
When a non-reversible CRLF conversion is done in "git add",
a warning is printed on stderr (or Git dies, depending on checksafe)

The function commit_chk_wrnNNO() in t0027 was written to test this,
but did the wrong thing: Instead of looking at the warning
from "git add", it looked at the warning from "git commit".

This is racy because "git commit" may not have to do CRLF conversion
at all if it can use the sha1 value from the index (which depends on
whether "add" and "commit" run in a single second).

Correct t0027 and replace the commit for each and every file with a commit
of all files in one go.
The function commit_chk_wrnNNO() should be renamed in a separate commit.

Now that t0027 does the right thing, it detects a bug in covert.c:
This sequence should generate the warning `LF will be replaced by CRLF`,
but does not:

$ git init
$ git config core.autocrlf false
$ printf "Line\r\n" &gt;file
$ git add file
$ git commit -m "commit with CRLF"
$ git config core.autocrlf true
$ printf "Line\n" &gt;file
$ git add file

"git add" calls crlf_to_git() in convert.c, which calls check_safe_crlf().
When has_cr_in_index(path) is true, crlf_to_git() returns too early and
check_safe_crlf() is not called at all.

Factor out the code which determines if "git checkout" converts LF-&gt;CRLF
into will_convert_lf_to_crlf().

Update the logic around check_safe_crlf() and "simulate" the possible
LF-&gt;CRLF conversion at "git checkout" with help of will_convert_lf_to_crlf().
Thanks to Jeff King &lt;peff@peff.net&gt; for analyzing t0027.

Reported-By: Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;
Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert: unify the "auto" handling of CRLF</title>
<updated>2016-07-06T18:53:51Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-06-28T08:01:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6523728499e77afaed0008875b19b308682c3f88'/>
<id>urn:sha1:6523728499e77afaed0008875b19b308682c3f88</id>
<content type='text'>
Before this change,
$ echo "* text=auto" &gt;.gitattributes
$ echo "* eol=crlf" &gt;&gt;.gitattributes

would have the same effect as
$ echo "* text" &gt;.gitattributes
$ git config core.eol crlf

Since the 'eol' attribute had higher priority than 'text=auto', this may
corrupt binary files and is not what most users expect to happen.

Make the 'eol' attribute to obey 'text=auto' and now
$ echo "* text=auto" &gt;.gitattributes
$ echo "* eol=crlf" &gt;&gt;.gitattributes
behaves the same as
$ echo "* text=auto" &gt;.gitattributes
$ git config core.eol crlf

In other words,
$ echo "* text=auto eol=crlf" &gt;.gitattributes
has the same effect as
$ git config core.autocrlf true

and
$ echo "* text=auto eol=lf" &gt;.gitattributes
has the same effect as
$ git config core.autocrlf input

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert.c: ident + core.autocrlf didn't work</title>
<updated>2016-04-25T19:12:03Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-04-25T16:56:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=caa47adc5a68045bfb9e88fcfee0e50589d129df'/>
<id>urn:sha1:caa47adc5a68045bfb9e88fcfee0e50589d129df</id>
<content type='text'>
When the ident attributes is set, get_stream_filter() did not obey
core.autocrlf=true, and the file was checked out with LF.

Change the rule when a streaming filter can be used:
- if an external filter is specified, don't use a stream filter.
- if the worktree eol is CRLF and "auto" is active, don't use a stream filter.
- Otherwise the stream filter can be used.

Add test cases in t0027.

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tb/conversion'</title>
<updated>2016-02-26T21:37:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-26T21:37:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c6b94eb0093216f7a02a8c7a350d1760478a52a1'/>
<id>urn:sha1:c6b94eb0093216f7a02a8c7a350d1760478a52a1</id>
<content type='text'>
Code simplification.

* tb/conversion:
  convert.c: correct attr_action()
  convert.c: simplify text_stat
  convert.c: refactor crlf_action
  convert.c: use text_eol_is_crlf()
  convert.c: remove input_crlf_action()
  convert.c: remove unused parameter 'path'
  t0027: add tests for get_stream_filter()
</content>
</entry>
<entry>
<title>convert.c: correct attr_action()</title>
<updated>2016-02-23T20:53:15Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-02-23T17:07:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=817a0c7968c1d7e0f574b6d07451445832f781aa'/>
<id>urn:sha1:817a0c7968c1d7e0f574b6d07451445832f781aa</id>
<content type='text'>
df747b81 (convert.c: refactor crlf_action, 2016-02-10) introduced a
bug to "git ls-files --eol".

The "text" attribute was shown as "text eol=lf" or "text eol=crlf",
depending on core.autocrlf or core.eol.

Correct this and add test cases in t0027.

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert.c: simplify text_stat</title>
<updated>2016-02-10T23:54:20Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-02-10T16:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e336a530b0dd98d1c751440ca5666a6999ab020'/>
<id>urn:sha1:6e336a530b0dd98d1c751440ca5666a6999ab020</id>
<content type='text'>
Simplify the statistics:
lonecr counts the CR which is not followed by a LF,
lonelf counts the LF which is not preceded by a CR,
crlf counts CRLF combinations.
This simplifies the evaluation of the statistics.

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert.c: refactor crlf_action</title>
<updated>2016-02-10T23:53:35Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-02-10T16:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=df747b818f0c9b7d0db1d7e3837b78e5d48b6fde'/>
<id>urn:sha1:df747b818f0c9b7d0db1d7e3837b78e5d48b6fde</id>
<content type='text'>
Refactor the determination and usage of crlf_action.
Today, when no "crlf" attribute are set on a file, crlf_action is set to
CRLF_GUESS. Use CRLF_UNDEFINED instead, and search for "text" or "eol" as
before.
After searching for line ending attributes, save the value in
struct conv_attrs.crlf_action attr_action,
so that get_convert_attr_ascii() is able report the attributes.

Replace the old CRLF_GUESS usage:
CRLF_GUESS &amp;&amp; core.autocrlf=true -&gt; CRLF_AUTO_CRLF
CRLF_GUESS &amp;&amp; core.autocrlf=false -&gt; CRLF_BINARY
CRLF_GUESS &amp;&amp; core.autocrlf=input -&gt; CRLF_AUTO_INPUT

Save the action in conv_attrs.crlf_action (as before) and change
all callers.

Make more clear, what is what, by defining:

- CRLF_UNDEFINED : No attributes set. Temparally used, until core.autocrlf
                   and core.eol is evaluated and one of CRLF_BINARY,
                   CRLF_AUTO_INPUT or CRLF_AUTO_CRLF is selected
- CRLF_BINARY    : No processing of line endings.
- CRLF_TEXT      : attribute "text" is set, line endings are processed.
- CRLF_TEXT_INPUT: attribute "input" or "eol=lf" is set. This implies text.
- CRLF_TEXT_CRLF : attribute "eol=crlf" is set. This implies text.
- CRLF_AUTO      : attribute "auto" is set.
- CRLF_AUTO_INPUT: core.autocrlf=input (no attributes)
- CRLF_AUTO_CRLF : core.autocrlf=true  (no attributes)

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ls/clean-smudge-override-in-config'</title>
<updated>2016-02-10T22:20:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-10T22:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a3764e7da7ae2c30e2e1bbeaa0961a17bced2078'/>
<id>urn:sha1:a3764e7da7ae2c30e2e1bbeaa0961a17bced2078</id>
<content type='text'>
Clean/smudge filters defined in a configuration file of lower
precedence can now be overridden to be a pass-through no-op by
setting the variable to an empty string.

* ls/clean-smudge-override-in-config:
  convert: treat an empty string for clean/smudge filters as "cat"
</content>
</entry>
<entry>
<title>convert.c: use text_eol_is_crlf()</title>
<updated>2016-02-08T18:02:12Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-02-05T16:13:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4b4024f5ddca2ac14c2b15158d7cca888a8ae25e'/>
<id>urn:sha1:4b4024f5ddca2ac14c2b15158d7cca888a8ae25e</id>
<content type='text'>
Add a helper function to find out, which line endings text files
should get at checkout, depending on core.autocrlf and core.eol
configuration variables.

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert.c: remove input_crlf_action()</title>
<updated>2016-02-08T18:01:40Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-02-05T16:13:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bb211b4de83b7cbc93049bc0d73883083a6a8b0b'/>
<id>urn:sha1:bb211b4de83b7cbc93049bc0d73883083a6a8b0b</id>
<content type='text'>
Integrate the code of input_crlf_action() into convert_attrs(),
so that ca.crlf_action is always valid after calling convert_attrs().
Keep a copy of crlf_action in attr_action, this is needed for
get_convert_attr_ascii().

Remove eol_attr from struct conv_attrs, as it is now used temporally.

Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
