git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] .gitattributes: CR at the end of the line is an error
@ 2009-06-19 10:42 Nanako Shiraishi
  2009-06-21  9:31 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Nanako Shiraishi @ 2009-06-19 10:42 UTC (permalink / raw)
  To: git

When a CR is accidentally added at the end of a C source file in the git
project tree, "git diff --check" doesn't detect it as an error.

    $ echo abQ | tr Q '\015' >>fast-import.c
    $ git diff --check

I think this is because the "whitespace" attribute is set to *.[ch] files
without specifying what kind of errors are caught. It makes git "notice
all types of errors" (as described in the documentation), but I think it
is incorrectly setting cr-at-eol, too, and hides this error.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---

diff --git a/.gitattributes b/.gitattributes
index 6b9c715..bb03350 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
 * whitespace=!indent,trail,space
-*.[ch] whitespace
+*.[ch] whitespace=indent,trail,space

-- 
1.6.2.GIT

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-21  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 10:42 [PATCH] .gitattributes: CR at the end of the line is an error Nanako Shiraishi
2009-06-21  9:31 ` Junio C Hamano
2009-06-21  9:35   ` [PATCH] attribute: whitespace set to true detects all errors known to git Junio C Hamano

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 NNTP newsgroup(s).