Skip to contentSkip to conversation

Documentation: move options of git-diff-tree to a separate file.

PATCH In review Miklos Vajna 3 participants 11 messages Jun 15, 2016 1 message not in the archive Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Documentation: move options of git-diff-tree to a separate file.

These options are used by high-level commands, like git-show; moving the options to a separate file makes it possible to include the options in the high-level manges as well.

---
 Documentation/diff-tree-options.txt |   64 +++++++++++++++++++++++++++++++++
 Documentation/git-diff-tree.txt     |   66 +---------------------------------
 2 files changed, 66 insertions(+), 64 deletions(-)
 create mode 100644 Documentation/diff-tree-options.txt
Documentation/diff-tree-options.txt new file +64 -0
new file mode 100644
index 0000000..24a47f4
@@ -0,0 +1,64 @@
+-r::
+        recurse into sub-trees
+
+-t::
+	show tree entry itself as well as subtrees.  Implies -r.
+
+--root::
+	When '--root' is specified the initial commit will be showed as a big
+	creation event. This is equivalent to a diff against the NULL tree.
+
+--stdin::
+	When '--stdin' is specified, the command does not take
+	<tree-ish> arguments from the command line.  Instead, it
+	reads either one <commit> or a pair of <tree-ish>
+	separated with a single space from its standard input.
++
+When a single commit is given on one line of such input, it compares
+the commit with its parents.  The following flags further affects its
+behavior.  This does not apply to the case where two <tree-ish>
+separated with a single space are given.
+
+-m::
+	By default, "--stdin" does not show
+	differences for merge commits.  With this flag, it shows
+	differences to that commit from all of its parents. See
+	also '-c'.
+
+-s::
+	By default, "--stdin" shows differences,
+	either in machine-readable form (without '-p') or in patch
+	form (with '-p').  This output can be suppressed.  It is
+	only useful with '-v' flag.
+
+-v::
+	This flag causes "--stdin" to also show
+	the commit message before the differences.
+
+--no-commit-id::
+	The output contains a line with the commit ID when
+	applicable.  This flag suppressed the commit ID output.
+
+-c::
+	This flag changes the way a merge commit is displayed
+	(which means it is useful only when the command is given
+	one <tree-ish>, or '--stdin').  It shows the differences
+	from each of the parents to the merge result simultaneously
+	instead of showing pairwise diff between a parent and the
+	result one at a time (which is what the '-m' option does).
+	Furthermore, it lists only files which were modified
+	from all parents.
+
+--cc::
+	This flag changes the way a merge commit patch is displayed,
+	in a similar way to the '-c' option. It implies the '-c'
+	and '-p' options and further compresses the patch output
+	by omitting hunks that show differences from only one
+	parent, or show the same change from all but one parent
+	for an Octopus merge.  When this optimization makes all
+	hunks disappear, the commit itself and the commit log
+	message is not shown, just like in any other "empty diff" case.
+
+--always::
+	Show the commit itself and the commit log message even
+	if the diff itself is empty.
Documentation/git-diff-tree.txt +2 -64

74 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 2/2 Documentation: include diff-tree-options in git-show manpage.

---
 Documentation/git-show.txt |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
Documentation/git-show.txt +3 -6
index dccf0e2..b1fa879 100644
@@ -25,12 +25,6 @@ with \--name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
-control how the changes the commit introduces are shown.
-
-This manual page describes only the most frequently used options.
-
-
 OPTIONS
 -------
 <object>::
@@ -38,6 +32,9 @@ OPTIONS
 	For a more complete list of ways to spell object names, see
 	"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
 
+include::diff-tree-options.txt[]
+
+
 include::pretty-options.txt[]
 
 
Signature · 1 line
1.5.5.1
#2 lore raw
In reply to Miklos Vajna

Documentation/diff-tree-options.txt line 15

Quoted 5 lines · Miklos Vajna

+--stdin::

Documentation/diff-tree-options.txt new file +4 -0
+	When '--stdin' is specified, the command does not take
+	<tree-ish> arguments from the command line.  Instead, it
+	reads either one <commit> or a pair of <tree-ish>
+	separated with a single space from its standard input.

Are you sure "git show" takes --stdin?

Also for "show", listing --cc as one of the options does not make much sense, as that is an unoverridable default.

And no, making it overridable so that it can take -m to show independent diff against each parent of a merge commit do not make much sense in the context of "git show".

#3 lore raw

PATCH 1/1 Documentation: move options of git-diff-tree to a separate file.

These options are used by high-level commands, like git-show; moving the options to a separate file makes it possible to include the options in the high-level manges as well.

---

Quoted 10 lines · Junio C Hamano

Are you sure "git show" takes --stdin?

Also for "show", listing --cc as one of the options does not make much sense, as that is an unoverridable default.

And no, making it overridable so that it can take -m to show independent
diff against each parent of a merge commit do not make much sense in the
context of "git show".

Right, --stdin and --cc is not something I should move to diff-tree-options.txt. Updated patch below.

 Documentation/diff-tree-options.txt |   43 ++++++++++++++++++++++++++++++
 Documentation/git-diff-tree.txt     |   49 +++--------------------------------
 2 files changed, 47 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/diff-tree-options.txt
Documentation/diff-tree-options.txt new file +43 -0
new file mode 100644
index 0000000..3049ede
@@ -0,0 +1,43 @@
+-r::
+        recurse into sub-trees
+
+-t::
+	show tree entry itself as well as subtrees.  Implies -r.
+
+--root::
+	When '--root' is specified the initial commit will be showed as a big
+	creation event. This is equivalent to a diff against the NULL tree.
+
+-m::
+	By default, "--stdin" does not show
+	differences for merge commits.  With this flag, it shows
+	differences to that commit from all of its parents. See
+	also '-c'.
+
+-s::
+	By default, "--stdin" shows differences,
+	either in machine-readable form (without '-p') or in patch
+	form (with '-p').  This output can be suppressed.  It is
+	only useful with '-v' flag.
+
+-v::
+	This flag causes "--stdin" to also show
+	the commit message before the differences.
+
+--no-commit-id::
+	The output contains a line with the commit ID when
+	applicable.  This flag suppressed the commit ID output.
+
+-c::
+	This flag changes the way a merge commit is displayed
+	(which means it is useful only when the command is given
+	one <tree-ish>, or '--stdin').  It shows the differences
+	from each of the parents to the merge result simultaneously
+	instead of showing pairwise diff between a parent and the
+	result one at a time (which is what the '-m' option does).
+	Furthermore, it lists only files which were modified
+	from all parents.
+
+--always::
+	Show the commit itself and the commit log message even
+	if the diff itself is empty.
Documentation/git-diff-tree.txt +4 -45

67 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#4 lore raw

Quoting Miklos Vajna <[email protected]>:

Quoted 6 lines · Junio C Hamano
Quoted 5 lines

Are you sure "git show" takes --stdin?

Also for "show", listing --cc as one of the options does not make much sense, as that is an unoverridable default.

Quoted 8 lines
Quoted 5 lines

And no, making it overridable so that it can take -m to show independent
diff against each parent of a merge commit do not make much sense in the
context of "git show".

Right, --stdin and --cc is not something I should move to diff-tree-options.txt. Updated patch below.

I do not know if the updated patch is correct either.

Did you try "git show" with the options you have in the new "tree-options" file, for example "git show --root HEAD", and checked to make sure they make sense?

I think "git show -s" makes sense as it is easier to type than "git log -1" but I do not think any other options you listed makes sense with "git show".

Quoted 131 lines
 Documentation/diff-tree-options.txt |   43 ++++++++++++++++++++++++++++++
 Documentation/git-diff-tree.txt     |   49 +++--------------------------------
 2 files changed, 47 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/diff-tree-options.txt
Documentation/diff-tree-options.txt new file +43 -0
new file mode 100644
index 0000000..3049ede
@@ -0,0 +1,43 @@
+-r::
+        recurse into sub-trees
+
+-t::
+	show tree entry itself as well as subtrees.  Implies -r.
+
+--root::
+	When '--root' is specified the initial commit will be showed as a big
+	creation event. This is equivalent to a diff against the NULL tree.
+
+-m::
+	By default, "--stdin" does not show
+	differences for merge commits.  With this flag, it shows
+	differences to that commit from all of its parents. See
+	also '-c'.
+
+-s::
+	By default, "--stdin" shows differences,
+	either in machine-readable form (without '-p') or in patch
+	form (with '-p').  This output can be suppressed.  It is
+	only useful with '-v' flag.
+
+-v::
+	This flag causes "--stdin" to also show
+	the commit message before the differences.
+
+--no-commit-id::
+	The output contains a line with the commit ID when
+	applicable.  This flag suppressed the commit ID output.
+
+-c::
+	This flag changes the way a merge commit is displayed
+	(which means it is useful only when the command is given
+	one <tree-ish>, or '--stdin').  It shows the differences
+	from each of the parents to the merge result simultaneously
+	instead of showing pairwise diff between a parent and the
+	result one at a time (which is what the '-m' option does).
+	Furthermore, it lists only files which were modified
+	from all parents.
+
+--always::
+	Show the commit itself and the commit log message even
+	if the diff itself is empty.
Documentation/git-diff-tree.txt +4 -45
index 58d02c6..55345df 100644
@@ -36,16 +36,6 @@ include::diff-options.txt[]
 	Note that this parameter does not provide any wildcard or regexp
 	features.
 
--r::
-        recurse into sub-trees
-
--t::
-	show tree entry itself as well as subtrees.  Implies -r.
-
---root::
-	When '--root' is specified the initial commit will be showed as a big
-	creation event. This is equivalent to a diff against the NULL tree.
-
 --stdin::
 	When '--stdin' is specified, the command does not take
 	<tree-ish> arguments from the command line.  Instead, it
@@ -57,38 +47,6 @@ the commit with its parents.  The following flags further affects its
 behavior.  This does not apply to the case where two <tree-ish>
 separated with a single space are given.
 
--m::
-	By default, "git-diff-tree --stdin" does not show
-	differences for merge commits.  With this flag, it shows
-	differences to that commit from all of its parents. See
-	also '-c'.
-
--s::
-	By default, "git-diff-tree --stdin" shows differences,
-	either in machine-readable form (without '-p') or in patch
-	form (with '-p').  This output can be suppressed.  It is
-	only useful with '-v' flag.
-
--v::
-	This flag causes "git-diff-tree --stdin" to also show
-	the commit message before the differences.
-
-include::pretty-options.txt[]
-
---no-commit-id::
-	git-diff-tree outputs a line with the commit ID when
-	applicable.  This flag suppressed the commit ID output.
-
--c::
-	This flag changes the way a merge commit is displayed
-	(which means it is useful only when the command is given
-	one <tree-ish>, or '--stdin').  It shows the differences
-	from each of the parents to the merge result simultaneously
-	instead of showing pairwise diff between a parent and the
-	result one at a time (which is what the '-m' option does).
-	Furthermore, it lists only files which were modified
-	from all parents.
-
 --cc::
 	This flag changes the way a merge commit patch is displayed,
 	in a similar way to the '-c' option. It implies the '-c'
@@ -99,9 +57,10 @@ include::pretty-options.txt[]
 	hunks disappear, the commit itself and the commit log
 	message is not shown, just like in any other "empty diff" case.
 
---always::
-	Show the commit itself and the commit log message even
-	if the diff itself is empty.
+include::diff-tree-options.txt[]
+
+
+include::pretty-options.txt[]
 
 
 include::pretty-formats.txt[]
Signature · 1 line
1.5.5.1
Signature · 6 lines
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 1/1 git show documentation: no longer refer to git-diff-tree options

The only git-diff-tree option that makes sense with git-show is '-s', but (from a user's point of view) it has sightly different meaning, since you don't have a --stdin option when using git-show.

This patch removes the reference to git-diff-tree options and adds documentation for '-s', in the context of git-show.

---

Quoted 5 lines · On Sun, Apr 27, 2008 at 04:29:55PM +0900, [email protected] wrote:

I do not know if the updated patch is correct either.

Did you try "git show" with the options you have in the new "tree-options" file, for example "git show --root HEAD", and checked to make sure they make sense?

The initial problem I tried to solve with this patch is to avoid the situation, when you try to figure out what 'git show --foo' does and you can't find that option in man git-show, which is a usability problem, I think.

Quoted 3 lines

I think "git show -s" makes sense as it is easier to type than "git log -1" but I do not think any other options you listed makes sense with "git show".

I just checked each option one by one and right, I haven't found any other option that could be useful for git-show either. Given that the wording of -s for git-show is quite different, I think it would be easier to just document -s in git-show as well. Like this?

Thanks.

 Documentation/git-show.txt |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
Documentation/git-show.txt +3 -6
index dccf0e2..299b611 100644
@@ -25,12 +25,6 @@ with \--name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
-control how the changes the commit introduces are shown.
-
-This manual page describes only the most frequently used options.
-
-
 OPTIONS
 -------
 <object>::
@@ -38,6 +32,9 @@ OPTIONS
 	For a more complete list of ways to spell object names, see
 	"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
 
+-s::
+	Don't show a textural diff for commits.
+
 include::pretty-options.txt[]
 
 
Signature · 1 line
1.5.5.1.91.g499fc.dirty
#7 lore raw

Re: [PATCH] git show documentation: no longer refer to git-diff-tree options

Quoted 4 lines · Miklos Vajna

I just checked each option one by one and right, I haven't found any other option that could be useful for git-show either. Given that the wording of -s for git-show is quite different, I think it would be easier to just document -s in git-show as well. Like this?

Hmm, yes but not exactly.

You lost --stat, --name-only and friends that were implied by mentioning "diff-tree".

I agree your _motivation_ behind your original patch is good. Saying "see also that page if you want to do very exotic and rarely useful operation" is one thing, but saying "described are most often used ones" and not describing enough is bad.

Perhaps we would want to include diff-options.txt. There may be some options that are no-op or always-on in the context of "git show" in the file, but we already have an infrastracture to turn parts of the inclusion on and off depending on which manual page includes it.

Quoted 29 lines
Documentation/git-show.txt +3 -6
index dccf0e2..299b611 100644
@@ -25,12 +25,6 @@ with \--name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
-control how the changes the commit introduces are shown.
-
-This manual page describes only the most frequently used options.
-
-
 OPTIONS
 -------
 <object>::
@@ -38,6 +32,9 @@ OPTIONS
 	For a more complete list of ways to spell object names, see
 	"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
 
+-s::
+	Don't show a textural diff for commits.
+
 include::pretty-options.txt[]
 
 
Signature · 1 line
1.5.5.1.91.g499fc.dirty
#8 lore raw

PATCH 1/1 git show documentation: no longer refer to git-diff-tree options

The only git-diff-tree option that makes sense with git-show is '-s', but (from a user's point of view) it has sightly different meaning, since you don't have a --stdin option when using git-show.

This patch removes the reference to git-diff-tree options and adds documentation for '-s', in the context of git-show.

It also includes git-diff options, but excludes the ones which are not relevant for this command.

---

Quoted 13 lines · Junio C Hamano

Hmm, yes but not exactly.

You lost --stat, --name-only and friends that were implied by mentioning
"diff-tree".

I agree your _motivation_ behind your original patch is good. Saying "see
also that page if you want to do very exotic and rarely useful operation"
is one thing, but saying "described are most often used ones" and not describing enough is bad.

Quoted 6 lines

Perhaps we would want to include diff-options.txt. There may be some options that are no-op or always-on in the context of "git show" in the
file, but we already have an infrastracture to turn parts of the inclusion
on and off depending on which manual page includes it.

This patch implements this, I hope.

(Sorry for the delay, BTW.)

 Documentation/diff-options.txt |   10 ++++++++++
 Documentation/git-show.txt     |   14 ++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
Documentation/diff-options.txt +10 -0
index 13234fa..af7846d 100644
@@ -17,6 +17,7 @@ ifdef::git-format-patch[]
 	Generate patches without diffstat.
 endif::git-format-patch[]
 
+ifndef::git-show[]
 ifndef::git-format-patch[]
 -p::
 	Generate patch (see section on generating patches).
@@ -25,6 +26,7 @@ endif::git-format-patch[]
 
 -u::
 	Synonym for "-p".
+endif::git-show[]
 
 -U<n>::
 	Shorthand for "--unified=<n>".
@@ -37,8 +39,10 @@ endif::git-format-patch[]
 	Generate the raw format.
 	{git-diff-core? This is the default.}
 
+ifndef::git-show[]
 --patch-with-raw::
 	Synonym for "-p --raw".
+endif::git-show[]
 
 --stat[=width[,name-width]]::
 	Generate a diffstat.  You can override the default
@@ -70,6 +74,7 @@ endif::git-format-patch[]
 	Output a condensed summary of extended header information
 	such as creations, renames and mode changes.
 
+ifndef::git-show[]
 --patch-with-stat::
 	Synonym for "-p --stat".
 	{git-format-patch? This is the default.}
@@ -78,6 +83,7 @@ endif::git-format-patch[]
 	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.
+endif::git-show[]
 
 --name-only::
 	Show only names of changed files.
@@ -159,6 +165,7 @@ endif::git-format-patch[]
 	the number of rename/copy targets exceeds the specified
 	number.
 
+ifndef::git-show[]
 -S<string>::
 	Look for differences that contain the change in <string>.
 
@@ -170,6 +177,7 @@ endif::git-format-patch[]
 --pickaxe-regex::
 	Make the <string> not a plain string but an extended POSIX
 	regex to match.
+endif::git-show[]
 
 -O<orderfile>::
 	Output the patch in the order specified in the
@@ -212,6 +220,7 @@ endif::git-format-patch[]
 -w::
 	Shorthand for "--ignore-all-space".
 
+ifndef::git-show[]
 --exit-code::
 	Make the program exit with codes similar to diff(1).
 	That is, it exits with 1 if there were differences and
@@ -219,6 +228,7 @@ endif::git-format-patch[]
 
 --quiet::
 	Disable all output of the program. Implies --exit-code.
+endif::git-show[]
 
 --ext-diff::
 	Allow an external diff helper to be executed. If you set an
Documentation/git-show.txt +8 -6
index dccf0e2..6b5c3fb 100644
@@ -25,12 +25,6 @@ with \--name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
-control how the changes the commit introduces are shown.
-
-This manual page describes only the most frequently used options.
-
-
 OPTIONS
 -------
 <object>::
@@ -38,6 +32,14 @@ OPTIONS
 	For a more complete list of ways to spell object names, see
 	"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
 
+-s, --quiet::
+	Don't show a textural diff for commits.
+
+
+:git-show: 1
+include::diff-options.txt[]
+
+
 include::pretty-options.txt[]
 
 
Signature · 1 line
1.5.5.1
#9 lore raw

Re: [PATCH] git show documentation: no longer refer to git-diff-tree options

Quoted 3 lines · Miklos Vajna

This patch implements this, I hope.

(Sorry for the delay, BTW.)

No problem. Thanks.

Documentation/diff-options.txt ifdef::git-format-patch[] · line 18

Quoted 7 lines
Documentation/diff-options.txt +0 -0
index 13234fa..af7846d 100644
@@ -17,6 +17,7 @@ ifdef::git-format-patch[]
 	Generate patches without diffstat.
 endif::git-format-patch[]

Hmm. The symbol git-diff-core is defined for git-show and we say --raw is the default for git-show because of it?

How about doing it this way instead?

---
 Documentation/diff-options.txt |   22 +++++++++++++++++-----
 Documentation/git-show.txt     |   14 ++++++++------
 2 files changed, 25 insertions(+), 11 deletions(-)
Documentation/diff-options.txt +17 -5
index 13234fa..a478612 100644
@@ -7,21 +7,33 @@
 ifndef::git-format-patch[]
 ifndef::git-diff[]
 ifndef::git-log[]
+ifndef::git-show[]
 :git-diff-core: 1
+endif::git-show[]
 endif::git-log[]
 endif::git-diff[]
 endif::git-format-patch[]
 
+ifdef::git-diff[]
+:git-diff-p-is-default: 1
+endif::git-diff[]
+ifdef::git-show[]
+:git-diff-p-is-default: 1
+endif::git-show[]
 ifdef::git-format-patch[]
+:git-diff-p-stat-is-default: 1
+endif::git-format-patch[]
+
+ifdef::git-diff-p-stat-is-default[]
 -p::
 	Generate patches without diffstat.
-endif::git-format-patch[]
+endif::git-diff-p-stat-is-default[]
 
-ifndef::git-format-patch[]
+ifndef::git-diff-p-stat-is-default[]
 -p::
 	Generate patch (see section on generating patches).
-	{git-diff? This is the default.}
-endif::git-format-patch[]
+	{git-diff-p-is-default? This is the default.}
+endif::git-diff-p-stat-is-default[]
 
 -u::
 	Synonym for "-p".
@@ -72,7 +84,7 @@ endif::git-format-patch[]
 
 --patch-with-stat::
 	Synonym for "-p --stat".
-	{git-format-patch? This is the default.}
+	{git-diff-p-stat-is-default? This is the default.}
 
 -z::
 	NUL-line termination on output.  This affects the --raw
Documentation/git-show.txt +8 -6
index dccf0e2..6b5c3fb 100644
@@ -25,12 +25,6 @@ with \--name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
-control how the changes the commit introduces are shown.
-
-This manual page describes only the most frequently used options.
-
-
 OPTIONS
 -------
 <object>::
@@ -38,6 +32,14 @@ OPTIONS
 	For a more complete list of ways to spell object names, see
 	"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
 
+-s, --quiet::
+	Don't show a textural diff for commits.
+
+
+:git-show: 1
+include::diff-options.txt[]
+
+
 include::pretty-options.txt[]
 
 
#10 lore raw

Re: [PATCH] git show documentation: no longer refer to git-diff-tree options

Quoted 2 lines · Junio C Hamano

Hmm. The symbol git-diff-core is defined for git-show and we say --raw is the default for git-show because of it?

Ouch, somehow I read infdef: as ifdef: so I intenionally did not add git-show, but it was a mistake.

Quoted 1 line

How about doing it this way instead?

Sure, I like the idea of introducing the git-diff-p-stat-is-default define.

#11 lore raw

Re: [PATCH] git show documentation: no longer refer to git-diff-tree options

Quoted 1 line · Miklos Vajna

Ouch, somehow I read infdef: as ifdef: so I intenionally did not add

                       ^^^^^^ ifndef, to be correct.