<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/convert.c, branch v2.12.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.12.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.12.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-12-19T22:45:30Z</updated>
<entry>
<title>Merge branch 'jc/renormalize-merge-kill-safer-crlf'</title>
<updated>2016-12-19T22:45:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-12-19T22:45:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1749053d0278f2a533f79915f03c379e5f738b39'/>
<id>urn:sha1:1749053d0278f2a533f79915f03c379e5f738b39</id>
<content type='text'>
Fix a corner case in merge-recursive regression that crept in
during 2.10 development cycle.

* jc/renormalize-merge-kill-safer-crlf:
  convert: git cherry-pick -Xrenormalize did not work
  merge-recursive: handle NULL in add_cacheinfo() correctly
  cherry-pick: demonstrate a segmentation fault
</content>
</entry>
<entry>
<title>convert: git cherry-pick -Xrenormalize did not work</title>
<updated>2016-12-01T19:27:08Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2016-11-30T17:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1c25d2d8ed4c5154c9059918e20e75cda3bede81'/>
<id>urn:sha1:1c25d2d8ed4c5154c9059918e20e75cda3bede81</id>
<content type='text'>
Working with a repo that used to be all CRLF. At some point it
was changed to all LF, with `text=auto` in .gitattributes.
Trying to cherry-pick a commit from before the switchover fails:

    $ git cherry-pick -Xrenormalize &lt;commit&gt;
    fatal: CRLF would be replaced by LF in [path]

Commit 65237284 "unify the "auto" handling of CRLF" introduced
a regression:

Whenever crlf_action is CRLF_TEXT_XXX and not CRLF_AUTO_XXX,
SAFE_CRLF_RENORMALIZE was feed into check_safe_crlf().  This is
wrong because here everything else than SAFE_CRLF_WARN is treated as
SAFE_CRLF_FAIL.

Call check_safe_crlf() only if checksafe is SAFE_CRLF_WARN or
SAFE_CRLF_FAIL.

Reported-by: Eevee (Lexy Munroe) &lt;eevee@veekun.com&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>Merge branch 'ls/filter-process'</title>
<updated>2016-10-31T20:15:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-31T20:15:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dbaa6bdce22914843e956e36d41d328547514342'/>
<id>urn:sha1:dbaa6bdce22914843e956e36d41d328547514342</id>
<content type='text'>
The smudge/clean filter API expect an external process is spawned
to filter the contents for each path that has a filter defined.  A
new type of "process" filter API has been added to allow the first
request to run the filter for a path to spawn a single process, and
all filtering need is served by this single process for multiple
paths, reducing the process creation overhead.

* ls/filter-process:
  contrib/long-running-filter: add long running filter example
  convert: add filter.&lt;driver&gt;.process option
  convert: prepare filter.&lt;driver&gt;.process option
  convert: make apply_filter() adhere to standard Git error handling
  pkt-line: add functions to read/write flush terminated packet streams
  pkt-line: add packet_write_gently()
  pkt-line: add packet_flush_gently()
  pkt-line: add packet_write_fmt_gently()
  pkt-line: extract set_packet_header()
  pkt-line: rename packet_write() to packet_write_fmt()
  run-command: add clean_on_exit_handler
  run-command: move check_pipe() from write_or_die to run_command
  convert: modernize tests
  convert: quote filter names in error messages
</content>
</entry>
<entry>
<title>i18n: convert mark error messages for translation</title>
<updated>2016-10-17T21:51:45Z</updated>
<author>
<name>Vasco Almeida</name>
<email>vascomalmeida@sapo.pt</email>
</author>
<published>2016-10-17T13:15:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=87cb7845fee4f23434da8b601583dab225dd85d6'/>
<id>urn:sha1:87cb7845fee4f23434da8b601583dab225dd85d6</id>
<content type='text'>
Mark error messages about CRLF for translation.

Update test to reflect changes.

Signed-off-by: Vasco Almeida &lt;vascomalmeida@sapo.pt&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert: add filter.&lt;driver&gt;.process option</title>
<updated>2016-10-17T18:45:52Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=edcc85814c87ebd7f3b1b7d3979fac3dfb84d308'/>
<id>urn:sha1:edcc85814c87ebd7f3b1b7d3979fac3dfb84d308</id>
<content type='text'>
Git's clean/smudge mechanism invokes an external filter process for
every single blob that is affected by a filter. If Git filters a lot of
blobs then the startup time of the external filter processes can become
a significant part of the overall Git execution time.

In a preliminary performance test this developer used a clean/smudge
filter written in golang to filter 12,000 files. This process took 364s
with the existing filter mechanism and 5s with the new mechanism. See
details here: https://github.com/github/git-lfs/pull/1382

This patch adds the `filter.&lt;driver&gt;.process` string option which, if
used, keeps the external filter process running and processes all blobs
with the packet format (pkt-line) based protocol over standard input and
standard output. The full protocol is explained in detail in
`Documentation/gitattributes.txt`.

A few key decisions:

* The long running filter process is referred to as filter protocol
  version 2 because the existing single shot filter invocation is
  considered version 1.
* Git sends a welcome message and expects a response right after the
  external filter process has started. This ensures that Git will not
  hang if a version 1 filter is incorrectly used with the
  filter.&lt;driver&gt;.process option for version 2 filters. In addition,
  Git can detect this kind of error and warn the user.
* The status of a filter operation (e.g. "success" or "error) is set
  before the actual response and (if necessary!) re-set after the
  response. The advantage of this two step status response is that if
  the filter detects an error early, then the filter can communicate
  this and Git does not even need to create structures to read the
  response.
* All status responses are pkt-line lists terminated with a flush
  packet. This allows us to send other status fields with the same
  protocol in the future.

Helped-by: Martin-Louis Bright &lt;mlbright@gmail.com&gt;
Reviewed-by: Jakub Narebski &lt;jnareb@gmail.com&gt;
Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert: prepare filter.&lt;driver&gt;.process option</title>
<updated>2016-10-17T18:36:50Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=234fa07e066d6bc0728c3d9b92686c69a811e5ac'/>
<id>urn:sha1:234fa07e066d6bc0728c3d9b92686c69a811e5ac</id>
<content type='text'>
Refactor the existing 'single shot filter mechanism' and prepare the
new 'long running filter mechanism'.

Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert: make apply_filter() adhere to standard Git error handling</title>
<updated>2016-10-17T18:36:50Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b84be553548b6d493d6eff728f3e11b5b5f9a254'/>
<id>urn:sha1:b84be553548b6d493d6eff728f3e11b5b5f9a254</id>
<content type='text'>
apply_filter() returns a boolean that tells the caller if it
"did convert or did not convert". The variable `ret` was used throughout
the function to track errors whereas `1` denoted success and `0`
failure. This is unusual for the Git source where `0` denotes success.

Rename the variable and flip its value to make the function easier
readable for Git developers.

Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert: quote filter names in error messages</title>
<updated>2016-10-17T18:36:49Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=255f04d604dbb331933c2354b5d15ed6715e7d6a'/>
<id>urn:sha1:255f04d604dbb331933c2354b5d15ed6715e7d6a</id>
<content type='text'>
Git filter driver commands with spaces (e.g. `filter.sh foo`) are hard
to read in error messages. Quote them to improve the readability.

Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<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>
</feed>
