Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-04 Thread Junio C Hamano
Torsten Bögershausen writes: >>> enum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL >>> ? SAFE_CRLF_WARN >>> : safe_crlf); >>> + if (size_only) >>> + crlf_warn =

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-03 Thread Torsten Bögershausen
On 2017-03-03 18:47, Junio C Hamano wrote: > Torsten Bögershausen 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

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-03 Thread Junio C Hamano
Torsten Bögershausen 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) >

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-03 Thread Torsten Bögershausen
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

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-03 Thread Mike Crowe
Hi Torsten, Your patch has been superseded, but I thought I ought to answer your questions rather than leave them hanging. On Thursday 02 March 2017 at 19:17:00 +0100, Torsten Bögershausen wrote: > On 2017-03-01 22:25, Mike Crowe wrote: > > On Wednesday 01 March 2017 at 18:04:44 +0100,

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Mike Crowe
On Thursday 02 March 2017 at 10:33:59 -0800, Junio C Hamano wrote: > Mike Crowe writes: > > > All the solutions presented so far do cause a small change in behaviour > > when using git diff --quiet: they may now cause warning messages like: > > > > warning: CRLF will be

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Torsten Bögershausen
On 2017-03-02 15:20, Mike Crowe wrote: > ll the solutions presented so far do cause a small change in behaviour > when using git diff --quiet: they may now cause warning messages like: > > warning: CRLF will be replaced by LF in crlf.txt. > The file will have its original line endings in your

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Jeff King
On Thu, Mar 02, 2017 at 09:52:21AM -0800, Junio C Hamano wrote: > >> + * and is_binary check being that we want to avoid > >> + * opening the file and inspecting the contents, this > >> + * is probably fine. > >> + */ > >>if ((flags &

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Junio C Hamano
Jeff King writes: >> diff --git a/diff.c b/diff.c >> index 8c78fce49d..dc51dceb44 100644 >> --- a/diff.c >> +++ b/diff.c >> @@ -2792,8 +2792,25 @@ int diff_populate_filespec(struct diff_filespec *s, >> unsigned int flags) >> s->should_free = 1; >>

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Junio C Hamano
Mike Crowe writes: > All the solutions presented so far do cause a small change in behaviour > when using git diff --quiet: they may now cause warning messages like: > > warning: CRLF will be replaced by LF in crlf.txt. > The file will have its original line endings in your

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Torsten Bögershausen
On 2017-03-01 22:25, Mike Crowe wrote: > On Wednesday 01 March 2017 at 18:04:44 +0100, tbo...@web.de wrote: >> From: Junio C Hamano >> >> git diff --quiet may take a short-cut to see if a file is changed >> in the working tree: >> Whenever the file size differs from what is

git status reports file modified when only line-endings have changed (was git diff --quiet exits with 1 on clean tree with CRLF conversions)

2017-03-02 Thread Mike Crowe
On Tuesday 28 February 2017 at 19:06:44 +0100, Torsten Bögershausen wrote: > My understanding is that git diff --quiet should be quiet, when > git add will not do anything (but the file is "touched". > The touched means that Git will detect e.g a new mtime or inode > or file size when doing

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Mike Crowe
On Wednesday 01 March 2017 at 13:54:26 -0800, Junio C Hamano wrote: > Now I thought about it through a bit more thoroughly, I think this > is the right approach, so here is my (tenative) final version. > > I seem to be getty really rusty---after all the codepaths involved > are practically all my

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-02 Thread Jeff King
On Wed, Mar 01, 2017 at 01:54:26PM -0800, Junio C Hamano wrote: > -- >8 -- > Subject: [PATCH] diff: do not short-cut CHECK_SIZE_ONLY check in > diff_populate_filespec() Thanks, this is well-explained, and the new comments in the code really help. I wondered if we should be checking

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-01 Thread Junio C Hamano
Mike Crowe writes: > With the above patch, both "git diff" and "git diff --quiet" report that > there are no changes. Previously Git would report the extra newline > correctly. I sent an updated one that (I think) fixes the real issue, which the extra would_convert_to_git()

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-01 Thread Junio C Hamano
Now I thought about it through a bit more thoroughly, I think this is the right approach, so here is my (tenative) final version. I seem to be getty really rusty---after all the codepaths involved are practically all my code and I should have noticed the real culprit during my first attempt X-<.

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-01 Thread Mike Crowe
On Wednesday 01 March 2017 at 18:04:44 +0100, tbo...@web.de wrote: > From: Junio C Hamano > > git diff --quiet may take a short-cut to see if a file is changed > in the working tree: > Whenever the file size differs from what is recorded in the index, > the file is assumed to

Re: [PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-01 Thread Junio C Hamano
tbo...@web.de writes: > From: Junio C Hamano > > git diff --quiet may take a short-cut to see if a file is changed > in the working tree: > Whenever the file size differs from what is recorded in the index, > the file is assumed to be changed and git diff --quiet returns >

[PATCH v1 1/1] git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-03-01 Thread tboegi
From: Junio C Hamano git diff --quiet may take a short-cut to see if a file is changed in the working tree: Whenever the file size differs from what is recorded in the index, the file is assumed to be changed and git diff --quiet returns exit with code 1 This shortcut must be

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-28 Thread Junio C Hamano
Torsten Bögershausen writes: > On 2017-02-27 21:17, Junio C Hamano wrote: > >> Torsten, you've been quite active in fixing various glitches around >> the EOL conversion in the latter half of last year. Have any >> thoughts to share on this topic? >> >> Thanks. > > Sorry for the

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-28 Thread Torsten Bögershausen
On 2017-02-27 21:17, Junio C Hamano wrote: > Torsten, you've been quite active in fixing various glitches around > the EOL conversion in the latter half of last year. Have any > thoughts to share on this topic? > > Thanks. Sorry for the delay, being too busy with other things. I followed the

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-27 Thread Junio C Hamano
Torsten, you've been quite active in fixing various glitches around the EOL conversion in the latter half of last year. Have any thoughts to share on this topic? Thanks. Mike Crowe writes: > On Monday 20 February 2017 at 13:25:01 -0800, Junio C Hamano wrote: >> This almost

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-25 Thread Mike Crowe
On Monday 20 February 2017 at 13:25:01 -0800, Junio C Hamano wrote: > This almost makes me suspect that the place that checks lengths of > one and two in order to refrain from running more expensive content > comparison you found earlier need to ask would_convert_to_git() > before taking the

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-20 Thread Junio C Hamano
Mike Crowe writes: > I think that if there's a risk that file contents will undergo conversion > then this should force the diff to check the file contents. Something like: > > diff --git a/diff.c b/diff.c > index 051761b..bee1662 100644 > --- a/diff.c > +++ b/diff.c > @@

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-20 Thread Mike Crowe
On Friday 17 February 2017 at 22:19:58 +, Mike Crowe wrote: > On Friday 17 February 2017 at 14:05:17 -0800, Junio C Hamano wrote: > > Mike Crowe writes: > > > > > If "git diff --quiet" finds it necessary to compare actual file contents, > > > and a file requires CRLF

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-17 Thread Mike Crowe
On Friday 17 February 2017 at 14:05:17 -0800, Junio C Hamano wrote: > Mike Crowe writes: > > > If "git diff --quiet" finds it necessary to compare actual file contents, > > and a file requires CRLF conversion, then it incorrectly exits with an exit > > code of 1 even if there

Re: git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-17 Thread Junio C Hamano
Mike Crowe writes: > If "git diff --quiet" finds it necessary to compare actual file contents, > and a file requires CRLF conversion, then it incorrectly exits with an exit > code of 1 even if there have been no changes. > > The patch below adds a test file that shows the

git diff --quiet exits with 1 on clean tree with CRLF conversions

2017-02-17 Thread Mike Crowe
If "git diff --quiet" finds it necessary to compare actual file contents, and a file requires CRLF conversion, then it incorrectly exits with an exit code of 1 even if there have been no changes. The patch below adds a test file that shows the problem. The first test of diff without --quiet