@matheusbsbs / matheus-bagliano / commits / 91af7ae54f
Fork 0

core.whitespace: documentation updates.

This adds description of core.whitespace to the manual page of git-config, and updates the stale description of whitespace handling in the manual page of git-apply. Also demote "strip" to a synonym status for "fix" as the value of --whitespace option given to git-apply. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 24, 2007 at 11:57 UTC 91af7ae54f2a0af453c3a5ac612ed613b38b4fdf
3 files changed +38 -17
Documentation/config.txt
+16 -2
@@ -293,6 +293,20 @@ core.pager::
293 The command that git will use to paginate output. Can be overridden
294 with the `GIT_PAGER` environment variable.
295
296 +core.whitespace::
297 + A comma separated list of common whitespace problems to
298 + notice. `git diff` will use `color.diff.whitespace` to
299 + highlight them, and `git apply --whitespace=error` will
300 + consider them as errors:
301 ++
302 +* `trailing-space` treats trailing whitespaces at the end of the line
303 + as an error (enabled by default).
304 +* `space-before-tab` treats a space character that appears immediately
305 + before a tab character in the initial indent part of the line as an
306 + error (enabled by default).
307 +* `indent-with-non-tab` treats a line that is indented with 8 or more
308 + space characters that can be replaced with tab characters.
309 +
310 alias.*::
311 Command aliases for the gitlink:git[1] command wrapper - e.g.
312 after defining "alias.last = cat-file commit HEAD", the invocation
@@ -378,8 +392,8 @@ color.diff.<slot>::
392 which part of the patch to use the specified color, and is one
393 of `plain` (context text), `meta` (metainformation), `frag`
394 (hunk header), `old` (removed lines), `new` (added lines),
381 - `commit` (commit headers), or `whitespace` (highlighting dubious
382 - whitespace). The values of these variables may be specified as
395 + `commit` (commit headers), or `whitespace` (highlighting
396 + whitespace errors). The values of these variables may be specified as
397 in color.branch.<slot>.
398
399 color.pager::
Documentation/git-apply.txt
+21 -14
@@ -13,7 +13,7 @@ SYNOPSIS
13 [--apply] [--no-add] [--build-fake-ancestor <file>] [-R | --reverse]
14 [--allow-binary-replacement | --binary] [--reject] [-z]
15 [-pNUM] [-CNUM] [--inaccurate-eof] [--cached]
16 - [--whitespace=<nowarn|warn|error|error-all|strip>]
16 + [--whitespace=<nowarn|warn|fix|error|error-all>]
17 [--exclude=PATH] [--verbose] [<patch>...]
18
19 DESCRIPTION
@@ -135,25 +135,32 @@ discouraged.
135 be useful when importing patchsets, where you want to exclude certain
136 files or directories.
137
138 ---whitespace=<option>::
139 - When applying a patch, detect a new or modified line
140 - that ends with trailing whitespaces (this includes a
141 - line that solely consists of whitespaces). By default,
142 - the command outputs warning messages and applies the
143 - patch.
144 - When gitlink:git-apply[1] is used for statistics and not applying a
145 - patch, it defaults to `nowarn`.
146 - You can use different `<option>` to control this
147 - behavior:
138 +--whitespace=<action>::
139 + When applying a patch, detect a new or modified line that has
140 + whitespace errors. What are considered whitespace errors is
141 + controlled by `core.whitespace` configuration. By default,
142 + trailing whitespaces (including lines that solely consist of
143 + whitespaces) and a space character that is immediately followed
144 + by a tab character inside the initial indent of the line are
145 + considered whitespace errors.
146 ++
147 +By default, the command outputs warning messages but applies the patch.
148 +When gitlink:git-apply[1] is used for statistics and not applying a
149 +patch, it defaults to `nowarn`.
150 ++
151 +You can use different `<action>` to control this
152 +behavior:
153 +
154 * `nowarn` turns off the trailing whitespace warning.
155 * `warn` outputs warnings for a few such errors, but applies the
151 - patch (default).
156 + patch as-is (default).
157 +* `fix` outputs warnings for a few such errors, and applies the
158 + patch after fixing them (`strip` is a synonym --- the tool
159 + used to consider only trailing whitespaces as errors, and the
160 + fix involved 'stripping' them, but modern gits do more).
161 * `error` outputs warnings for a few such errors, and refuses
162 to apply the patch.
163 * `error-all` is similar to `error` but shows all errors.
155 -* `strip` outputs warnings for a few such errors, strips out the
156 - trailing whitespaces and applies the patch.
164
165 --inaccurate-eof::
166 Under certain circumstances, some versions of diff do not correctly
builtin-apply.c
+1 -1
@@ -45,7 +45,7 @@ static const char *fake_ancestor;
45 static int line_termination = '\n';
46 static unsigned long p_context = ULONG_MAX;
47 static const char apply_usage[] =
48 -"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...";
48 +"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|fix|error|error-all>] <patch>...";
49
50 static enum ws_error_action {
51 nowarn_ws_error,