aboutsummaryrefslogtreecommitdiff
path: root/t/t4019-diff-wserror.sh
Commit message (Collapse)AuthorAge
* diff: Help "less" hide ^M from the outputJunio C Hamano2008-08-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the tracked contents have CRLF line endings, colored diff output shows "^M" at the end of output lines, which is distracting, even though the pager we use by default ("less") knows to hide them. The problem is that "less" hides a carriage-return only at the end of the line, immediately before a line feed. The colored diff output does not take this into account, and emits four element sequence for each line: - force this color; - the line up to but not including the terminating line feed; - reset color - line feed. By including the carriage return at the end of the line in the second item, we are breaking the smart our pager has in order not to show "^M". This can be fixed by changing the sequence to: - force this color; - the line up to but not including the terminating end-of-line; - reset color - end-of-line. where end-of-line is either a single linefeed or a CRLF pair. When the output is not colored, "force this color" and "reset color" sequences are both empty, so we won't have this problem with or without this patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff --check: do not unconditionally complain about trailing empty linesJunio C Hamano2008-08-11
| | | | | | | | | Recently "git diff --check" learned to detect new trailing blank lines just like "git apply --whitespace" does. However this check should not trigger unconditionally. This patch makes it honor the whitespace settings from core.whitespace and gitattributes. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* core.whitespace: cr-at-eolJunio C Hamano2008-02-05
| | | | | | | | | | | | | This new error mode allows a line to have a carriage return at the end of the line when checking and fixing trailing whitespace errors. Some people like to keep CRLF line ending recorded in the repository, and still want to take advantage of the automated trailing whitespace stripping. We still show ^M in the diff output piped to "less" to remind them that they do have the CR at the end, but these carriage return characters at the end are no longer flagged as errors. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Use gitattributes to define per-path whitespace ruleJunio C Hamano2007-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | The `core.whitespace` configuration variable allows you to define what `diff` and `apply` should consider whitespace errors for all paths in the project (See gitlink:git-config[1]). This attribute gives you finer control per path. For example, if you have these in the .gitattributes: frotz whitespace nitfol -whitespace xyzzy whitespace=-trailing all types of whitespace problems known to git are noticed in path 'frotz' (i.e. diff shows them in diff.whitespace color, and apply warns about them), no whitespace problem is noticed in path 'nitfol', and the default types of whitespace problems except "trailing whitespace" are noticed for path 'xyzzy'. A project with mixed Python and C might want to have: *.c whitespace *.py whitespace=-indent-with-non-tab in its toplevel .gitattributes file. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* core.whitespace: add test for diff whitespace error highlightingJunio C Hamano2007-11-02
This tests seletive enabling/disabling of whitespace error highlighting done by colored diff output. Signed-off-by: Junio C Hamano <gitster@pobox.com>