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>
This commit is contained in:
parent
d5a4164140
commit
91af7ae54f
@ -293,6 +293,20 @@ core.pager::
|
|||||||
The command that git will use to paginate output. Can be overridden
|
The command that git will use to paginate output. Can be overridden
|
||||||
with the `GIT_PAGER` environment variable.
|
with the `GIT_PAGER` environment variable.
|
||||||
|
|
||||||
|
core.whitespace::
|
||||||
|
A comma separated list of common whitespace problems to
|
||||||
|
notice. `git diff` will use `color.diff.whitespace` to
|
||||||
|
highlight them, and `git apply --whitespace=error` will
|
||||||
|
consider them as errors:
|
||||||
|
+
|
||||||
|
* `trailing-space` treats trailing whitespaces at the end of the line
|
||||||
|
as an error (enabled by default).
|
||||||
|
* `space-before-tab` treats a space character that appears immediately
|
||||||
|
before a tab character in the initial indent part of the line as an
|
||||||
|
error (enabled by default).
|
||||||
|
* `indent-with-non-tab` treats a line that is indented with 8 or more
|
||||||
|
space characters that can be replaced with tab characters.
|
||||||
|
|
||||||
alias.*::
|
alias.*::
|
||||||
Command aliases for the gitlink:git[1] command wrapper - e.g.
|
Command aliases for the gitlink:git[1] command wrapper - e.g.
|
||||||
after defining "alias.last = cat-file commit HEAD", the invocation
|
after defining "alias.last = cat-file commit HEAD", the invocation
|
||||||
@ -378,8 +392,8 @@ color.diff.<slot>::
|
|||||||
which part of the patch to use the specified color, and is one
|
which part of the patch to use the specified color, and is one
|
||||||
of `plain` (context text), `meta` (metainformation), `frag`
|
of `plain` (context text), `meta` (metainformation), `frag`
|
||||||
(hunk header), `old` (removed lines), `new` (added lines),
|
(hunk header), `old` (removed lines), `new` (added lines),
|
||||||
`commit` (commit headers), or `whitespace` (highlighting dubious
|
`commit` (commit headers), or `whitespace` (highlighting
|
||||||
whitespace). The values of these variables may be specified as
|
whitespace errors). The values of these variables may be specified as
|
||||||
in color.branch.<slot>.
|
in color.branch.<slot>.
|
||||||
|
|
||||||
color.pager::
|
color.pager::
|
||||||
|
@ -13,7 +13,7 @@ SYNOPSIS
|
|||||||
[--apply] [--no-add] [--build-fake-ancestor <file>] [-R | --reverse]
|
[--apply] [--no-add] [--build-fake-ancestor <file>] [-R | --reverse]
|
||||||
[--allow-binary-replacement | --binary] [--reject] [-z]
|
[--allow-binary-replacement | --binary] [--reject] [-z]
|
||||||
[-pNUM] [-CNUM] [--inaccurate-eof] [--cached]
|
[-pNUM] [-CNUM] [--inaccurate-eof] [--cached]
|
||||||
[--whitespace=<nowarn|warn|error|error-all|strip>]
|
[--whitespace=<nowarn|warn|fix|error|error-all>]
|
||||||
[--exclude=PATH] [--verbose] [<patch>...]
|
[--exclude=PATH] [--verbose] [<patch>...]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@ -135,25 +135,32 @@ discouraged.
|
|||||||
be useful when importing patchsets, where you want to exclude certain
|
be useful when importing patchsets, where you want to exclude certain
|
||||||
files or directories.
|
files or directories.
|
||||||
|
|
||||||
--whitespace=<option>::
|
--whitespace=<action>::
|
||||||
When applying a patch, detect a new or modified line
|
When applying a patch, detect a new or modified line that has
|
||||||
that ends with trailing whitespaces (this includes a
|
whitespace errors. What are considered whitespace errors is
|
||||||
line that solely consists of whitespaces). By default,
|
controlled by `core.whitespace` configuration. By default,
|
||||||
the command outputs warning messages and applies the
|
trailing whitespaces (including lines that solely consist of
|
||||||
patch.
|
whitespaces) and a space character that is immediately followed
|
||||||
When gitlink:git-apply[1] is used for statistics and not applying a
|
by a tab character inside the initial indent of the line are
|
||||||
patch, it defaults to `nowarn`.
|
considered whitespace errors.
|
||||||
You can use different `<option>` to control this
|
+
|
||||||
behavior:
|
By default, the command outputs warning messages but applies the patch.
|
||||||
|
When gitlink:git-apply[1] is used for statistics and not applying a
|
||||||
|
patch, it defaults to `nowarn`.
|
||||||
|
+
|
||||||
|
You can use different `<action>` to control this
|
||||||
|
behavior:
|
||||||
+
|
+
|
||||||
* `nowarn` turns off the trailing whitespace warning.
|
* `nowarn` turns off the trailing whitespace warning.
|
||||||
* `warn` outputs warnings for a few such errors, but applies the
|
* `warn` outputs warnings for a few such errors, but applies the
|
||||||
patch (default).
|
patch as-is (default).
|
||||||
|
* `fix` outputs warnings for a few such errors, and applies the
|
||||||
|
patch after fixing them (`strip` is a synonym --- the tool
|
||||||
|
used to consider only trailing whitespaces as errors, and the
|
||||||
|
fix involved 'stripping' them, but modern gits do more).
|
||||||
* `error` outputs warnings for a few such errors, and refuses
|
* `error` outputs warnings for a few such errors, and refuses
|
||||||
to apply the patch.
|
to apply the patch.
|
||||||
* `error-all` is similar to `error` but shows all errors.
|
* `error-all` is similar to `error` but shows all errors.
|
||||||
* `strip` outputs warnings for a few such errors, strips out the
|
|
||||||
trailing whitespaces and applies the patch.
|
|
||||||
|
|
||||||
--inaccurate-eof::
|
--inaccurate-eof::
|
||||||
Under certain circumstances, some versions of diff do not correctly
|
Under certain circumstances, some versions of diff do not correctly
|
||||||
|
@ -45,7 +45,7 @@ static const char *fake_ancestor;
|
|||||||
static int line_termination = '\n';
|
static int line_termination = '\n';
|
||||||
static unsigned long p_context = ULONG_MAX;
|
static unsigned long p_context = ULONG_MAX;
|
||||||
static const char apply_usage[] =
|
static const char apply_usage[] =
|
||||||
"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>...";
|
"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>...";
|
||||||
|
|
||||||
static enum ws_error_action {
|
static enum ws_error_action {
|
||||||
nowarn_ws_error,
|
nowarn_ws_error,
|
||||||
|
Loading…
Reference in New Issue
Block a user