From: "Torsten Bögershausen" <tboegi@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Mike Crowe <mac@mcrowe.com>,
git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions
Date: Sat, 4 Mar 2017 07:25:52 +0100 [thread overview]
Message-ID: <9c9eeb35-e1c1-ec46-1d85-ef6a05886880@web.de> (raw)
In-Reply-To: <xmqq37eu2qxl.fsf@junio-linux.mtv.corp.google.com>
On 2017-03-03 18:47, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
>
>> Understood, thanks for the explanation.
>>
>> quiet is not quite any more..
>>
>> Does the following fix help ?
>>
>> --- a/diff.c
>> +++ b/diff.c
>> @@ -2826,6 +2826,8 @@ int diff_populate_filespec(struct diff_filespec *s,
>> unsigned int flags)
>> enum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL
>> ? SAFE_CRLF_WARN
>> : safe_crlf);
>> + if (size_only)
>> + crlf_warn = SAFE_CRLF_FALSE;
>
> If you were to go this route, it may be sufficient to change its
> initialization from WARN to FALSE _unconditionally_, because this
> function uses the convert_to_git() only to _show_ the differences by
> computing canonical form out of working tree contents, and the
> conversion is not done to _write_ into object database to create a
> new object.
Hm, since when (is it not used) ?
I thought that it is needed to support the safecrlf handling introduced in
21e5ad50fc5e7277c74cfbb3cf6502468e840f86
Author: Steffen Prohaska <prohaska@zib.de>
Date: Wed Feb 6 12:25:58 2008 +0100
safecrlf: Add mechanism to warn about irreversible crlf conversions
-------------
The SAFE_CRLF_FAIL was converted into WARN here:
commit 5430bb283b478991a979437a79e10dcbb6f20e28
Author: Junio C Hamano <gitster@pobox.com>
Date: Mon Jun 24 14:35:04 2013 -0700
diff: demote core.safecrlf=true to core.safecrlf=warn
Otherwise the user will not be able to start to guess where in the
contents in the working tree the offending unsafe CR lies.
------------
My understanding is that we don't want to break the safecrlf feature,
but after applying
diff --git a/diff.c b/diff.c
index a628ac3a95..a05d88dd9f 100644
--- a/diff.c
+++ b/diff.c
@@ -2820,12 +2820,10 @@ int diff_populate_filespec(struct diff_filespec *s,
unsigned int flags)
int size_only = flags & CHECK_SIZE_ONLY;
int err = 0;
/*
- * demote FAIL to WARN to allow inspecting the situation
- * instead of refusing.
+ * Don't use FAIL or WARN as this code is not called when _writing_
+ * into object database to create a new object.
*/
- enum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL
- ? SAFE_CRLF_WARN
- : safe_crlf);
+ enum safe_crlf crlf_warn = SAFE_CRLF_FALSE;
None of the test cases in t0020--t0027 fails or complain about missing warnings.
Does this all means that, looking back, 5430bb283b478991 could have been more
aggressive and could have used SAFE_CRLF_FALSE ?
And we can do this change now?
(If the answer is yes, we don't need to deal with the problem below)
> Having size_only here is not a sign of getting --quiet passed from
> the command line, by the way.
>
next prev parent reply other threads:[~2017-03-04 6:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 21:26 git diff --quiet exits with 1 on clean tree with CRLF conversions Mike Crowe
2017-02-17 22:05 ` Junio C Hamano
2017-02-17 22:19 ` Mike Crowe
2017-02-20 15:33 ` Mike Crowe
2017-02-20 21:25 ` Junio C Hamano
2017-02-25 15:32 ` Mike Crowe
2017-02-27 20:17 ` Junio C Hamano
2017-02-28 18:06 ` Torsten Bögershausen
2017-02-28 21:50 ` Junio C Hamano
2017-03-01 17:04 ` [PATCH v1 1/1] " tboegi
2017-03-01 21:14 ` Junio C Hamano
2017-03-01 21:54 ` Junio C Hamano
2017-03-02 8:53 ` Jeff King
2017-03-02 17:52 ` Junio C Hamano
2017-03-02 19:12 ` Jeff King
2017-03-02 18:51 ` [PATCH v2] diff: do not short-cut CHECK_SIZE_ONLY check in diff_populate_filespec() Junio C Hamano
2017-03-02 14:20 ` [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions Mike Crowe
2017-03-02 18:20 ` Torsten Bögershausen
2017-03-02 18:33 ` Junio C Hamano
2017-03-02 20:03 ` Mike Crowe
2017-03-03 17:02 ` Torsten Bögershausen
2017-03-03 17:47 ` Junio C Hamano
2017-03-04 6:25 ` Torsten Bögershausen [this message]
2017-03-04 19:59 ` Junio C Hamano
2017-03-01 21:25 ` Mike Crowe
2017-03-01 23:29 ` Junio C Hamano
2017-03-02 18:17 ` Torsten Bögershausen
2017-03-03 17:01 ` Mike Crowe
2017-03-02 15:38 ` git status reports file modified when only line-endings have changed (was git diff --quiet exits with 1 on clean tree with CRLF conversions) Mike Crowe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c9eeb35-e1c1-ec46-1d85-ef6a05886880@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mac@mcrowe.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).