Skip to content

Commit 64485b4

Browse files
bjornggitster
authored andcommitted
Clarify and correct -z
The description for -z is too vague and general for the apply, diff*, and log commands. Change the description of -z for 'git log' to note that commits will be separated by NULs. Change the description of -z for 'git diff*' and 'git apply' to note that it applies to the --numstat option, and for 'git diff*' also for --raw option. Also correct the description of the "munging" of pathanmes that takes place in the absence of -z for the 'git diff*' and 'git apply' commands, namely that apart from the characters mentioned, double quotes will also be escaped and that the pathname will be enclosed in double quotes if any characters are escaped. Signed-off-by: Björn Gustavsson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 39add7a commit 64485b4

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

Documentation/diff-options.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,21 @@ ifndef::git-format-patch[]
8585
endif::git-format-patch[]
8686

8787
ifndef::git-format-patch[]
88+
8889
-z::
89-
NUL-line termination on output. This affects the `--raw`
90-
output field terminator. Also output from commands such
91-
as `git-log` will be delimited with NUL between commits.
90+
ifndef::git-log[]
91+
When `--raw` or `--numstat` has been given, do not munge
92+
pathnames and use NULs as output field terminators.
93+
+
94+
Without this option, each pathname output will have TAB, LF, double quotes,
95+
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
96+
respectively, and the pathname will be enclosed in double quotes if
97+
any of those replacements occurred.
98+
endif::git-log[]
99+
100+
ifdef::git-log[]
101+
Separate the commits with NULs instead of with new newlines.
102+
endif::git-log[]
92103

93104
--name-only::
94105
Show only names of changed files.

Documentation/git-apply.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ the information is read from the current index instead.
8787
rejected hunks in corresponding *.rej files.
8888

8989
-z::
90-
When showing the index information, do not munge paths,
91-
but use NUL terminated machine readable format. Without
92-
this flag, the pathnames output will have TAB, LF, and
93-
backslash characters replaced with `\t`, `\n`, and `\\`,
94-
respectively.
90+
When `--numstat` has been given, do not munge pathnames,
91+
but use a NUL-terminated machine-readable format.
92+
+
93+
Without this option, each pathname output will have TAB, LF, double quotes,
94+
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
95+
respectively, and the pathname will be enclosed in double quotes if
96+
any of those replacements occurred.
9597

9698
-p<n>::
9799
Remove <n> leading slashes from traditional diff paths. The

0 commit comments

Comments
 (0)