Skip to content

Commit

Permalink
Documentation: improve description for core.quotePath
Browse files Browse the repository at this point in the history
Linking the description for pathname quoting to the configuration
variable "core.quotePath" removes inconstistent and incomplete
sections while also giving two hints how to deal with it: Either with
"-c core.quotePath=false" or with "-z".

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
asheiduk authored and gitster committed Mar 2, 2017
1 parent 3bc5322 commit 860cd69
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 39 deletions.
23 changes: 13 additions & 10 deletions Documentation/config.txt
Expand Up @@ -350,16 +350,19 @@ core.checkStat::
all fields, including the sub-second part of mtime and ctime.

core.quotePath::
The commands that output paths (e.g. 'ls-files',
'diff'), when not given the `-z` option, will quote
"unusual" characters in the pathname by enclosing the
pathname in a double-quote pair and with backslashes the
same way strings in C source code are quoted. If this
variable is set to false, the bytes higher than 0x80 are
not quoted but output as verbatim. Note that double
quote, backslash and control characters are always
quoted without `-z` regardless of the setting of this
variable.
Commands that output paths (e.g. 'ls-files', 'diff'), will
quote "unusual" characters in the pathname by enclosing the
pathname in double-quotes and escaping those characters with
backslashes in the same way C escapes control characters (e.g.
`\t` for TAB, `\n` for LF, `\\` for backslash) or bytes with
values larger than 0x80 (e.g. octal `\302\265` for "micro" in
UTF-8). If this variable is set to false, bytes higher than
0x80 are not considered "unusual" any more. Double-quotes,
backslash and control characters are always escaped regardless
of the setting of this variable. A simple space character is
not considered "unusual". Many commands can output pathnames
completely verbatim using the `-z` option. The default value
is true.

core.eol::
Sets the line ending type to use in the working directory for
Expand Down
7 changes: 4 additions & 3 deletions Documentation/diff-format.txt
Expand Up @@ -78,9 +78,10 @@ Example:
:100644 100644 5be4a4...... 000000...... M file.c
------------------------------------------------

When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
respectively.
Without the `-z` option, pathnames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). Using `-z` the filename is output
verbatim and the line is terminated by a NUL byte.

diff format for merges
----------------------
Expand Down
7 changes: 3 additions & 4 deletions Documentation/diff-generate-patch.txt
Expand Up @@ -53,10 +53,9 @@ The index line includes the SHA-1 checksum before and after the change.
The <mode> is included if the file mode does not change; otherwise,
separate lines indicate the old and the new mode.

3. TAB, LF, double quote and backslash characters in pathnames
are represented as `\t`, `\n`, `\"` and `\\`, respectively.
If there is need for such substitution then the whole
pathname is put in double quotes.
3. Pathnames with "unusual" characters are quoted as explained for
the configuration variable `core.quotePath` (see
linkgit:git-config[1]).

4. All the `file1` files in the output refer to files before the
commit, and all the `file2` files refer to files after the commit.
Expand Down
7 changes: 3 additions & 4 deletions Documentation/diff-options.txt
Expand Up @@ -192,10 +192,9 @@ ifndef::git-log[]
given, do not munge pathnames and use NULs as output field terminators.
endif::git-log[]
+
Without this option, each pathname output will have TAB, LF, double quotes,
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
respectively, and the pathname will be enclosed in double quotes if
any of those replacements occurred.
Without this option, pathnames with "unusual" characters are quoted as
explained for the configuration variable `core.quotePath` (see
linkgit:git-config[1]).

--name-only::
Show only names of changed files.
Expand Down
7 changes: 3 additions & 4 deletions Documentation/git-apply.txt
Expand Up @@ -108,10 +108,9 @@ the information is read from the current index instead.
When `--numstat` has been given, do not munge pathnames,
but use a NUL-terminated machine-readable format.
+
Without this option, each pathname output will have TAB, LF, double quotes,
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
respectively, and the pathname will be enclosed in double quotes if
any of those replacements occurred.
Without this option, pathnames with "unusual" characters are quoted as
explained for the configuration variable `core.quotePath` (see
linkgit:git-config[1]).

-p<n>::
Remove <n> leading slashes from traditional diff paths. The
Expand Down
9 changes: 6 additions & 3 deletions Documentation/git-commit.txt
Expand Up @@ -117,9 +117,12 @@ OPTIONS

-z::
--null::
When showing `short` or `porcelain` status output, terminate
entries in the status output with NUL, instead of LF. If no
format is given, implies the `--porcelain` output format.
When showing `short` or `porcelain` status output, print the
filename verbatim and terminate the entries with NUL, instead of LF.
If no format is given, implies the `--porcelain` output format.
Without the `-z` option, filenames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]).

-F <file>::
--file=<file>::
Expand Down
10 changes: 6 additions & 4 deletions Documentation/git-ls-files.txt
Expand Up @@ -77,7 +77,8 @@ OPTIONS
succeed.

-z::
\0 line termination on output.
\0 line termination on output and do not quote filenames.
See OUTPUT below for more information.

-x <pattern>::
--exclude=<pattern>::
Expand Down Expand Up @@ -196,9 +197,10 @@ the index records up to three such pairs; one from tree O in stage
the user (or the porcelain) to see what should eventually be recorded at the
path. (see linkgit:git-read-tree[1] for more information on state)

When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
respectively.
Without the `-z` option, pathnames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). Using `-z` the filename is output
verbatim and the line is terminated by a NUL byte.


Exclude Patterns
Expand Down
10 changes: 7 additions & 3 deletions Documentation/git-ls-tree.txt
Expand Up @@ -53,7 +53,8 @@ OPTIONS
Show object size of blob (file) entries.

-z::
\0 line termination on output.
\0 line termination on output and do not quote filenames.
See OUTPUT FORMAT below for more information.

--name-only::
--name-status::
Expand Down Expand Up @@ -82,8 +83,6 @@ Output Format
-------------
<mode> SP <type> SP <object> TAB <file>

Unless the `-z` option is used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
This output format is compatible with what `--index-info --stdin` of
'git update-index' expects.

Expand All @@ -95,6 +94,11 @@ Object size identified by <object> is given in bytes, and right-justified
with minimum width of 7 characters. Object size is given only for blobs
(file) entries; for other entries `-` character is used in place of size.

Without the `-z` option, pathnames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). Using `-z` the filename is output
verbatim and the line is terminated by a NUL byte.

GIT
---
Part of the linkgit:git[1] suite
7 changes: 3 additions & 4 deletions Documentation/git-status.txt
Expand Up @@ -322,10 +322,9 @@ When the `-z` option is given, pathnames are printed as is and
without any quoting and lines are terminated with a NUL (ASCII 0x00)
byte.

Otherwise, all pathnames will be "C-quoted" if they contain any tab,
linefeed, double quote, or backslash characters. In C-quoting, these
characters will be replaced with the corresponding C-style escape
sequences and the resulting pathname will be double quoted.
Without the `-z` option, pathnames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]).


CONFIGURATION
Expand Down

0 comments on commit 860cd69

Please sign in to comment.