From f8f28ed9a0229ce19aed3ca516d8ec9a5e66d0c3 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:43 +0000 Subject: [PATCH 1/6] git-log.txt: add links to 'rev-list' and 'diff' docs Add links to the documentation for `git rev-list` and `git diff` instead of simply mentioning them, to make it easier for readers to reach these documentation pages. Let's link to `git diff` as this is the porcelain command, and the rest of the family (`diff-index`, `diff-tree` and `diff-files`) are mentioned in the "Raw output format" section of the `git diff` documentation. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/git-log.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 20e6d21a74..0fcaf34d62 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -15,9 +15,9 @@ DESCRIPTION ----------- Shows the commit logs. -The command takes options applicable to the `git rev-list` +The command takes options applicable to the linkgit:git-rev-list[1] command to control what is shown and how, and options applicable to -the `git diff-*` commands to control how the changes +the linkgit:git-diff[1] command to control how the changes each commit introduces are shown. From f5d9e91ea0b31fa008e807ff14ac7fa1ad413bd8 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:44 +0000 Subject: [PATCH 2/6] revisions.txt: describe 'rev1 rev2 ...' meaning for ranges The "Specifying ranges" section does not mention explicitly that several commits can be specified to form a range. Add a mention to that effect. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/revisions.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt index 1ad95065c1..d9169c062e 100644 --- a/Documentation/revisions.txt +++ b/Documentation/revisions.txt @@ -254,6 +254,9 @@ specifying a single revision, using the notation described in the previous section, means the set of commits `reachable` from the given commit. +Specifying several revisions means the set of commits reachable from +any of the given commits. + A commit's reachable set is the commit itself and the commits in its ancestry chain. From 8560723266f2cb49faf42710c7c380af8d7c0ffd Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:45 +0000 Subject: [PATCH 3/6] git-rev-list.txt: fix Asciidoc syntax Using '{caret}' inside double quotes and immediately following with a single quoted word does not create the desired output: '' appears verbatim instead of being emphasized. Use a litteral caret ('^') instead. Also, remove the leading tabs in shell examples to bring them more in line with the rest of the documentation. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/git-rev-list.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index 025c911436..aa95334a79 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -29,19 +29,19 @@ to further limit the result. Thus, the following command: ----------------------------------------------------------------------- - $ git rev-list foo bar ^baz +$ git rev-list foo bar ^baz ----------------------------------------------------------------------- means "list all the commits which are reachable from 'foo' or 'bar', but not from 'baz'". A special notation "''..''" can be used as a -short-hand for "{caret}'' ''". For example, either of +short-hand for "^'' ''". For example, either of the following may be used interchangeably: ----------------------------------------------------------------------- - $ git rev-list origin..HEAD - $ git rev-list HEAD ^origin +$ git rev-list origin..HEAD +$ git rev-list HEAD ^origin ----------------------------------------------------------------------- Another special notation is "''...''" which is useful @@ -49,8 +49,8 @@ for merges. The resulting set of commits is the symmetric difference between the two operands. The following two commands are equivalent: ----------------------------------------------------------------------- - $ git rev-list A B --not $(git merge-base --all A B) - $ git rev-list A...B +$ git rev-list A B --not $(git merge-base --all A B) +$ git rev-list A...B ----------------------------------------------------------------------- 'rev-list' is a very essential Git command, since it From 6001a1d5e3732cb63438ce2c7852773d3c0eab9a Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:46 +0000 Subject: [PATCH 4/6] git-rev-list.txt: tweak wording in set operations Tweak a sentence to make it a little more readable. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/git-rev-list.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index aa95334a79..f2b83df2fa 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -19,12 +19,12 @@ given commit(s), but exclude commits that are reachable from the one(s) given with a '{caret}' in front of them. The output is given in reverse chronological order by default. -You can think of this as a set operation. Commits given on the command -line form a set of commits that are reachable from any of them, and then -commits reachable from any of the ones given with '{caret}' in front are -subtracted from that set. The remaining commits are what comes out in the -command's output. Various other options and paths parameters can be used -to further limit the result. +You can think of this as a set operation. Commits reachable from any of +the commits given on the command line form a set, and then commits reachable +from any of the ones given with '{caret}' in front are subtracted from that +set. The remaining commits are what comes out in the command's output. +Various other options and paths parameters can be used to further limit the +result. Thus, the following command: From 6be6b171a7dc4d901f21b0f24d63147c32ecc008 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:47 +0000 Subject: [PATCH 5/6] git-rev-list.txt: move description to separate file A following commit will reuse the description of the `git rev-list` command in the `git log` manpage. Move this description to a separate file. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/git-rev-list.txt | 39 +------------------------- Documentation/rev-list-description.txt | 38 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 Documentation/rev-list-description.txt diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index f2b83df2fa..b06e11ae56 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -14,44 +14,7 @@ SYNOPSIS DESCRIPTION ----------- -List commits that are reachable by following the `parent` links from the -given commit(s), but exclude commits that are reachable from the one(s) -given with a '{caret}' in front of them. The output is given in reverse -chronological order by default. - -You can think of this as a set operation. Commits reachable from any of -the commits given on the command line form a set, and then commits reachable -from any of the ones given with '{caret}' in front are subtracted from that -set. The remaining commits are what comes out in the command's output. -Various other options and paths parameters can be used to further limit the -result. - -Thus, the following command: - ------------------------------------------------------------------------ -$ git rev-list foo bar ^baz ------------------------------------------------------------------------ - -means "list all the commits which are reachable from 'foo' or 'bar', but -not from 'baz'". - -A special notation "''..''" can be used as a -short-hand for "^'' ''". For example, either of -the following may be used interchangeably: - ------------------------------------------------------------------------ -$ git rev-list origin..HEAD -$ git rev-list HEAD ^origin ------------------------------------------------------------------------ - -Another special notation is "''...''" which is useful -for merges. The resulting set of commits is the symmetric difference -between the two operands. The following two commands are equivalent: - ------------------------------------------------------------------------ -$ git rev-list A B --not $(git merge-base --all A B) -$ git rev-list A...B ------------------------------------------------------------------------ +include::rev-list-description.txt[] 'rev-list' is a very essential Git command, since it provides the ability to build and traverse commit ancestry graphs. For diff --git a/Documentation/rev-list-description.txt b/Documentation/rev-list-description.txt new file mode 100644 index 0000000000..14d78b91aa --- /dev/null +++ b/Documentation/rev-list-description.txt @@ -0,0 +1,38 @@ +List commits that are reachable by following the `parent` links from the +given commit(s), but exclude commits that are reachable from the one(s) +given with a '{caret}' in front of them. The output is given in reverse +chronological order by default. + +You can think of this as a set operation. Commits reachable from any of +the commits given on the command line form a set, and then commits reachable +from any of the ones given with '{caret}' in front are subtracted from that +set. The remaining commits are what comes out in the command's output. +Various other options and paths parameters can be used to further limit the +result. + +Thus, the following command: + +----------------------------------------------------------------------- +$ git rev-list foo bar ^baz +----------------------------------------------------------------------- + +means "list all the commits which are reachable from 'foo' or 'bar', but +not from 'baz'". + +A special notation "''..''" can be used as a +short-hand for "^'' ''". For example, either of +the following may be used interchangeably: + +----------------------------------------------------------------------- +$ git rev-list origin..HEAD +$ git rev-list HEAD ^origin +----------------------------------------------------------------------- + +Another special notation is "''...''" which is useful +for merges. The resulting set of commits is the symmetric difference +between the two operands. The following two commands are equivalent: + +----------------------------------------------------------------------- +$ git rev-list A B --not $(git merge-base --all A B) +$ git rev-list A...B +----------------------------------------------------------------------- From bea866587c7639fac4146cadfdee30fcc9815c36 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 9 Jul 2020 02:16:48 +0000 Subject: [PATCH 6/6] git-log.txt: include rev-list-description.txt The `git log` synopsis mentions ``, and the description of this option links to gitrevisions(7), but a nice explanation of how a revision range can be constructed from individual commits, optionnally prefixed with `^`, also exists in `rev-list-description.txt`. Include this description in the man page for `git log`. Add Asciidoc 'ifdef's to `rev-list-description.txt` so that either `git rev-list` or `git log` appears in the respective man pages. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano --- Documentation/git-log.txt | 3 +++ Documentation/git-rev-list.txt | 1 + Documentation/rev-list-description.txt | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 0fcaf34d62..3fd26d5212 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -15,6 +15,9 @@ DESCRIPTION ----------- Shows the commit logs. +:git-log: 1 +include::rev-list-description.txt[] + The command takes options applicable to the linkgit:git-rev-list[1] command to control what is shown and how, and options applicable to the linkgit:git-diff[1] command to control how the changes diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index b06e11ae56..5da66232dc 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -14,6 +14,7 @@ SYNOPSIS DESCRIPTION ----------- +:git-rev-list: 1 include::rev-list-description.txt[] 'rev-list' is a very essential Git command, since it diff --git a/Documentation/rev-list-description.txt b/Documentation/rev-list-description.txt index 14d78b91aa..a9efa7fa27 100644 --- a/Documentation/rev-list-description.txt +++ b/Documentation/rev-list-description.txt @@ -12,9 +12,16 @@ result. Thus, the following command: +ifdef::git-rev-list[] ----------------------------------------------------------------------- $ git rev-list foo bar ^baz ----------------------------------------------------------------------- +endif::git-rev-list[] +ifdef::git-log[] +----------------------------------------------------------------------- +$ git log foo bar ^baz +----------------------------------------------------------------------- +endif::git-log[] means "list all the commits which are reachable from 'foo' or 'bar', but not from 'baz'". @@ -23,16 +30,32 @@ A special notation "''..''" can be used as a short-hand for "^'' ''". For example, either of the following may be used interchangeably: +ifdef::git-rev-list[] ----------------------------------------------------------------------- $ git rev-list origin..HEAD $ git rev-list HEAD ^origin ----------------------------------------------------------------------- +endif::git-rev-list[] +ifdef::git-log[] +----------------------------------------------------------------------- +$ git log origin..HEAD +$ git log HEAD ^origin +----------------------------------------------------------------------- +endif::git-log[] Another special notation is "''...''" which is useful for merges. The resulting set of commits is the symmetric difference between the two operands. The following two commands are equivalent: +ifdef::git-rev-list[] ----------------------------------------------------------------------- $ git rev-list A B --not $(git merge-base --all A B) $ git rev-list A...B ----------------------------------------------------------------------- +endif::git-rev-list[] +ifdef::git-log[] +----------------------------------------------------------------------- +$ git log A B --not $(git merge-base --all A B) +$ git log A...B +----------------------------------------------------------------------- +endif::git-log[]