Re: [PATCH 2/2] "diff --check" should affect exit status

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] "diff --check" should affect exit status

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:58

Wincent Colaiuta [off-list ref] writes:
"git diff" has a --check option that can be used to check for whitespace
problems but it only reported by printing warnings to the
console.
The primary use of this option used to be to see where the breakages are
in order to fix them up (IOW, the option was not about seeing if
breakage exists or not), but that is much easier with --color output
these days.

It is probably a good idea to do this, although I do not care much about
it either way.  It probably could replace the sample pre-commit hook
currently implemented in Perl.  As I happen to be fairly familiar with
the area, I'll take a look at the patch if/when I find time.

Thanks.

Re: [PATCH 2/2] "diff --check" should affect exit status

From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:43:58

El 12/12/2007, a las 10:16, Junio C Hamano escribió:
Wincent Colaiuta [off-list ref] writes:
quoted
"git diff" has a --check option that can be used to check for  
whitespace
problems but it only reported by printing warnings to the
console.
The primary use of this option used to be to see where the breakages  
are
in order to fix them up (IOW, the option was not about seeing if
breakage exists or not), but that is much easier with --color output
these days.

It is probably a good idea to do this, although I do not care much  
about
it either way.  It probably could replace the sample pre-commit hook
currently implemented in Perl.
Actually, that's exactly why I prepared this patch; I was looking at  
the pre-commit hook and though, surely there must be a simpler way  
than this... And was surprised when I saw that "git diff --check"  
didn't alter the exit code...
As I happen to be fairly familiar with
the area, I'll take a look at the patch if/when I find time.
Thanks. I'm about to resend this patch with more tests, and one fix  
discovered while adding the tests ("git diff-tree" was only setting  
the exit status with --stdin set), as well as a new version of the pre- 
commit hook.

One nice thing about this change is that when "diff --check" learns  
about the new core.whitespace stuff, the hook will automatically  
inherit the new behaviour.

Cheers,
Wincent
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help