{"thread":{"id":"21711","subject":"[PATCH 1/4] Clarify and correct -z","startedAt":"2009-11-22T19:43:20Z","lastAt":"2009-11-22T19:43:20Z","messageCount":1,"participants":["Björn Gustavsson"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"128120","messageId":"4B099458.6000909@gmail.com","threadId":"21711","inReplyTo":null,"subject":"[PATCH 1/4] Clarify and correct -z","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-11-22T19:43:20Z","receivedAt":"2009-11-22T19:43:20Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"The description for -z is too vague and general for the\napply, diff*, and log commands.\n\nChange the description of -z for 'git log' to note that\ncommits will be separated by NULs.\n\nChange the description of -z for 'git diff*' and 'git apply'\nto note that it applies to the --numstat option, and for\n'git diff*' also for --raw option.\n\nAlso correct the description of the \"munging\" of pathanmes that\ntakes place in the absence of -z for the 'git diff*' and\n'git apply' commands, namely that apart from the characters mentioned,\ndouble quotes will also be escaped and that the pathname will be\nenclosed in double quotes if any characters are escaped.\n\nSigned-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\nThe original documentation for -z in diff-options.txt says:\n\n\"Also output from commands such as `git-log` will be delimited\nwith NUL between commits.\"\n\nI am not sure about \"such as git-log\". What other command would\nthat be? In my patch, I have assumed that only 'git log' behaves\nin that way (i.e. that it is the only command -z will change\nthe behavior of even when no other options are given).\n\n\n Documentation/diff-options.txt |   17 ++++++++++++++---\n Documentation/git-apply.txt    |   12 +++++++-----\n 2 files changed, 21 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 2b37193..18366b1 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -85,10 +85,21 @@ ifndef::git-format-patch[]\n endif::git-format-patch[]\n \n ifndef::git-format-patch[]\n+\n -z::\n-\tNUL-line termination on output.  This affects the `--raw`\n-\toutput field terminator.  Also output from commands such\n-\tas `git-log` will be delimited with NUL between commits.\n+ifndef::git-log[]\n+\tWhen `--raw` or `--numstat` has been given, do not munge\n+\tpathnames and use NULs as output field terminators.\n++\n+Without this option, each pathname output will have TAB, LF, double quotes,\n+and backslash characters replaced with `\\t`, `\\n`, `\\\"`, and `\\\\`,\n+respectively, and the pathname will be enclosed in double quotes if\n+any of those replacements occurred.\n+endif::git-log[]\n+\n+ifdef::git-log[]\n+\tSeparate the commits with NULs instead of with new newlines.\n+endif::git-log[]\n \n --name-only::\n \tShow only names of changed files.\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex 5ee8c91..0156ca9 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -87,11 +87,13 @@ the information is read from the current index instead.\n \trejected hunks in corresponding *.rej files.\n \n -z::\n-\tWhen showing the index information, do not munge paths,\n-\tbut use NUL terminated machine readable format.  Without\n-\tthis flag, the pathnames output will have TAB, LF, and\n-\tbackslash characters replaced with `\\t`, `\\n`, and `\\\\`,\n-\trespectively.\n+\tWhen `--numstat` has been given, do not munge pathnames,\n+\tbut use a NUL-terminated machine-readable format.\n++\n+Without this option, each pathname output will have TAB, LF, double quotes,\n+and backslash characters replaced with `\\t`, `\\n`, `\\\"`, and `\\\\`,\n+respectively, and the pathname will be enclosed in double quotes if\n+any of those replacements occurred.\n \n -p<n>::\n \tRemove <n> leading slashes from traditional diff paths. The\n-- \n1.6.5.3.298.g39add\n"}]}