From 752c0c24926aacbceca0d27de6ad22cbb7dd0709 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 19 Oct 2009 14:38:32 +0200 Subject: Add the --submodule option to the diff option family When you use the option --submodule=log you can see the submodule summaries inlined in the diff, instead of not-quite-helpful SHA-1 pairs. The format imitates what "git submodule summary" shows. To do that, /.git/objects/ is added to the alternate object databases (if that directory exists). This option was requested by Jens Lehmann at the GitTogether in Berlin. Signed-off-by: Johannes Schindelin Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 9276faeb11..e26b84706f 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -87,6 +87,13 @@ endif::git-format-patch[] Show only names and status of changed files. See the description of the `--diff-filter` option on what the status letters mean. +--submodule[=]:: + Chose the output format for submodule differences. can be one of + 'short' and 'log'. 'short' just shows pairs of commit names, this format + is used when this option is not given. 'log' is the default value for this + option and lists the commits in that commit range like the 'summary' + option of linkgit:git-submodule[1] does. + --color:: Show colored diff. -- cgit v1.2.3 From 02bc5b03f54b51f8b45c81cce74284ced602e6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 7 Nov 2009 10:51:56 +0100 Subject: format-patch: Always generate a patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jeff King recently reinstated -p to suppress the default diffstat (as -p used to work before 68daa64, about 14 months ago). However, -p is also needed in combination with certain options (e.g. --stat or --numstat) in order to produce any patch at all. The documentation does not mention this. Since the purpose of format-patch is to produce a patch that can be emailed, it does not make sense that certain combination of options will suppress the generation of the patch itself. Therefore: * Update 'git format-patch' to always generate a patch. * Since the --name-only, --name-status, and --check suppresses the generation of the patch, disallow those options, and remove the description of them in the documentation. * Remove the reference to -p in the description of -U. * Remove the descriptions of the options that are synonyms for -p plus another option (--patch-with-raw and --patch-with-stat). * While at it, slightly tweak the description of -p itself to say that it generates "plain patches", so that you can think of -p as "plain patch" as an mnemonic aid. Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 9276faeb11..c58d0853fc 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -14,7 +14,7 @@ endif::git-format-patch[] ifdef::git-format-patch[] -p:: - Generate patches without diffstat. + Generate plain patches without any diffstats. endif::git-format-patch[] ifndef::git-format-patch[] @@ -27,14 +27,19 @@ endif::git-format-patch[] -U:: --unified=:: Generate diffs with lines of context instead of - the usual three. Implies "-p". + the usual three. +ifndef::git-format-patch[] + Implies "-p". +endif::git-format-patch[] --raw:: Generate the raw format. {git-diff-core? This is the default.} +ifndef::git-format-patch[] --patch-with-raw:: Synonym for "-p --raw". +endif::git-format-patch[] --patience:: Generate a diff using the "patience diff" algorithm. @@ -71,21 +76,24 @@ endif::git-format-patch[] Output a condensed summary of extended header information such as creations, renames and mode changes. +ifndef::git-format-patch[] --patch-with-stat:: Synonym for "-p --stat". - {git-format-patch? This is the default.} +endif::git-format-patch[] -z:: NUL-line termination on output. This affects the --raw output field terminator. Also output from commands such as "git-log" will be delimited with NUL between commits. +ifndef::git-format-patch[] --name-only:: Show only names of changed files. --name-status:: Show only names and status of changed files. See the description of the `--diff-filter` option on what the status letters mean. +endif::git-format-patch[] --color:: Show colored diff. @@ -115,11 +123,13 @@ override configuration settings. Turn off rename detection, even when the configuration file gives the default to do so. +ifndef::git-format-patch[] --check:: Warn if changes introduce trailing whitespace or an indent that uses a space before a tab. Exits with non-zero status if problems are found. Not compatible with --exit-code. +endif::git-format-patch[] --full-index:: Instead of the first handful of characters, show the full -- cgit v1.2.3 From d4cb003fffe2af3b868f57d75a352714e7ab03ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 7 Nov 2009 10:52:29 +0100 Subject: format-patch documentation: Remove diff options that are not useful MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To simplify reading the documentation for format-patch, remove the description of common diff options that are not useful for the purpose of the command (i.e. "Prepare patches for e-mail submission"). Specifically, this removes the description of the following options: --raw -z --color --no-color --color-words --diff-filter -S --pickaxe-all --pickaxe-regex -R --relative --exit-code --quiet Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index c58d0853fc..a03f1a793c 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -32,9 +32,11 @@ ifndef::git-format-patch[] Implies "-p". endif::git-format-patch[] +ifndef::git-format-patch[] --raw:: Generate the raw format. {git-diff-core? This is the default.} +endif::git-format-patch[] ifndef::git-format-patch[] --patch-with-raw:: @@ -81,19 +83,18 @@ ifndef::git-format-patch[] Synonym for "-p --stat". endif::git-format-patch[] +ifndef::git-format-patch[] -z:: NUL-line termination on output. This affects the --raw output field terminator. Also output from commands such as "git-log" will be delimited with NUL between commits. -ifndef::git-format-patch[] --name-only:: Show only names of changed files. --name-status:: Show only names and status of changed files. See the description of the `--diff-filter` option on what the status letters mean. -endif::git-format-patch[] --color:: Show colored diff. @@ -118,6 +119,7 @@ The regex can also be set via a diff driver or configuration option, see linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly overrides any diff driver or configuration setting. Diff drivers override configuration settings. +endif::git-format-patch[] --no-renames:: Turn off rename detection, even when the configuration @@ -157,6 +159,7 @@ endif::git-format-patch[] -C:: Detect copies as well as renames. See also `--find-copies-harder`. +ifndef::git-format-patch[] --diff-filter=[ACDMRTUXB*]:: Select only files that are Added (`A`), Copied (`C`), Deleted (`D`), Modified (`M`), Renamed (`R`), have their @@ -168,6 +171,7 @@ endif::git-format-patch[] paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected. +endif::git-format-patch[] --find-copies-harder:: For performance reasons, by default, `-C` option finds copies only @@ -185,6 +189,7 @@ endif::git-format-patch[] the number of rename/copy targets exceeds the specified number. +ifndef::git-format-patch[] -S:: Look for differences that introduce or remove an instance of . Note that this is different than the string simply @@ -199,11 +204,13 @@ endif::git-format-patch[] --pickaxe-regex:: Make the not a plain string but an extended POSIX regex to match. +endif::git-format-patch[] -O:: Output the patch in the order specified in the , which has one shell glob pattern per line. +ifndef::git-format-patch[] -R:: Swap two inputs; that is, show differences from index or on-disk file to tree contents. @@ -215,6 +222,7 @@ endif::git-format-patch[] not in a subdirectory (e.g. in a bare repository), you can name which subdirectory to make the output relative to by giving a as an argument. +endif::git-format-patch[] -a:: --text:: @@ -239,6 +247,7 @@ endif::git-format-patch[] Show the context between diff hunks, up to the specified number of lines, thereby fusing hunks that are close to each other. +ifndef::git-format-patch[] --exit-code:: Make the program exit with codes similar to diff(1). That is, it exits with 1 if there were differences and @@ -246,6 +255,7 @@ endif::git-format-patch[] --quiet:: Disable all output of the program. Implies --exit-code. +endif::git-format-patch[] --ext-diff:: Allow an external diff helper to be executed. If you set an -- cgit v1.2.3 From dce5ef142046e107e20aa03ca5a353032bbf9653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 7 Nov 2009 10:53:07 +0100 Subject: format-patch documentation: Fix formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Format git commands and options consistently using back quotes (i.e. a fixed font in the resulting HTML document). Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index a03f1a793c..9398329706 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -29,7 +29,7 @@ endif::git-format-patch[] Generate diffs with lines of context instead of the usual three. ifndef::git-format-patch[] - Implies "-p". + Implies `-p`. endif::git-format-patch[] ifndef::git-format-patch[] @@ -40,7 +40,7 @@ endif::git-format-patch[] ifndef::git-format-patch[] --patch-with-raw:: - Synonym for "-p --raw". + Synonym for `-p --raw`. endif::git-format-patch[] --patience:: @@ -48,19 +48,19 @@ endif::git-format-patch[] --stat[=width[,name-width]]:: Generate a diffstat. You can override the default - output width for 80-column terminal by "--stat=width". + output width for 80-column terminal by `--stat=width`. The width of the filename part can be controlled by giving another width to it separated by a comma. --numstat:: - Similar to \--stat, but shows number of added and + Similar to `\--stat`, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly. For binary files, outputs two `-` instead of saying `0 0`. --shortstat:: - Output only the last line of the --stat format containing total + Output only the last line of the `--stat` format containing total number of modified files, as well as number of added and deleted lines. @@ -68,11 +68,11 @@ endif::git-format-patch[] Output the distribution of relative amount of changes (number of lines added or removed) for each sub-directory. Directories with changes below a cut-off percent (3% by default) are not shown. The cut-off percent - can be set with "--dirstat=limit". Changes in a child directory is not - counted for the parent directory, unless "--cumulative" is used. + can be set with `--dirstat=limit`. Changes in a child directory is not + counted for the parent directory, unless `--cumulative` is used. --dirstat-by-file[=limit]:: - Same as --dirstat, but counts changed files instead of lines. + Same as `--dirstat`, but counts changed files instead of lines. --summary:: Output a condensed summary of extended header information @@ -80,14 +80,14 @@ endif::git-format-patch[] ifndef::git-format-patch[] --patch-with-stat:: - Synonym for "-p --stat". + Synonym for `-p --stat`. endif::git-format-patch[] ifndef::git-format-patch[] -z:: - NUL-line termination on output. This affects the --raw + NUL-line termination on output. This affects the `--raw` output field terminator. Also output from commands such - as "git-log" will be delimited with NUL between commits. + as `git-log` will be delimited with NUL between commits. --name-only:: Show only names of changed files. @@ -139,16 +139,16 @@ endif::git-format-patch[] line when generating patch format output. --binary:: - In addition to --full-index, output "binary diff" that - can be applied with "git apply". + In addition to `--full-index`, output a binary diff that + can be applied with `git-apply`. --abbrev[=]:: Instead of showing the full 40-byte hexadecimal object name in diff-raw format output and diff-tree header lines, show only a partial prefix. This is - independent of --full-index option above, which controls + independent of the `--full-index` option above, which controls the diff-patch output format. Non default number of - digits can be specified with --abbrev=. + digits can be specified with `--abbrev=`. -B:: Break complete rewrite changes into pairs of delete and create. @@ -183,7 +183,7 @@ endif::git-format-patch[] `-C` option has the same effect. -l:: - -M and -C options require O(n^2) processing time where n + The `-M` and `-C` options require O(n^2) processing time where n is the number of potential rename/copy targets. This option prevents rename/copy detection from running if the number of rename/copy targets exceeds the specified @@ -197,7 +197,7 @@ ifndef::git-format-patch[] linkgit:gitdiffcore[7] for more details. --pickaxe-all:: - When -S finds a change, show all the changes in that + When `-S` finds a change, show all the changes in that changeset, not just the files that contain the change in . @@ -254,7 +254,7 @@ ifndef::git-format-patch[] 0 means no differences. --quiet:: - Disable all output of the program. Implies --exit-code. + Disable all output of the program. Implies `--exit-code`. endif::git-format-patch[] --ext-diff:: -- cgit v1.2.3 From 2cfa8330e414bc73b01d45f232f8566afc56dd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 7 Nov 2009 10:58:55 +0100 Subject: format-patch: Add "--no-stat" as a synonym for "-p" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "-p" means "generate patch" in 'git log' and 'git diff', so it's quite surprising that it means "suppress diffstat" in 'git format-patch'. Keep the "-p" option for backward compatibility, but add "--no-stat" as a more intuitive synonym. For backward compatibility with scripts, we must allow combinations of --stat and --no-stat. Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 9398329706..8f79382562 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -14,6 +14,7 @@ endif::git-format-patch[] ifdef::git-format-patch[] -p:: +--no-stat:: Generate plain patches without any diffstats. endif::git-format-patch[] -- cgit v1.2.3 From 64485b4aba98b39f2cf4528aed95b6ddca62f332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sun, 22 Nov 2009 20:43:20 +0100 Subject: Clarify and correct -z MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 2b37193a37..18366b1be6 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -85,10 +85,21 @@ ifndef::git-format-patch[] endif::git-format-patch[] ifndef::git-format-patch[] + -z:: - NUL-line termination on output. This affects the `--raw` - output field terminator. Also output from commands such - as `git-log` will be delimited with NUL between commits. +ifndef::git-log[] + When `--raw` or `--numstat` has been given, do not munge + pathnames and use NULs as output field terminators. ++ +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. +endif::git-log[] + +ifdef::git-log[] + Separate the commits with NULs instead of with new newlines. +endif::git-log[] --name-only:: Show only names of changed files. -- cgit v1.2.3 From 5c931c8da2db4a8e0b5713e97cce474b6596e2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 23 Nov 2009 08:40:24 +0100 Subject: Fix over-simplified documentation for 'git log -z' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit 64485b4a, the documentation for 'git log -z' was simplified too much. The -z option actually changes the behavior of 'git log' in two ways: commits will be ended with a NUL instead of a LF (correctly documented) and the --raw and --numstat will have NUL as field terminators (omitted in the documentation for 'git log'). Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Documentation/diff-options.txt') diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 18366b1be6..8707d0e740 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -87,19 +87,21 @@ endif::git-format-patch[] ifndef::git-format-patch[] -z:: +ifdef::git-log[] + Separate the commits with NULs instead of with new newlines. ++ +Also, when `--raw` or `--numstat` has been given, do not munge +pathnames and use NULs as output field terminators. +endif::git-log[] ifndef::git-log[] When `--raw` or `--numstat` has been 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. -endif::git-log[] - -ifdef::git-log[] - Separate the commits with NULs instead of with new newlines. -endif::git-log[] --name-only:: Show only names of changed files. -- cgit v1.2.3