git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 4/7] doc/git-log: move "Diff Formatting" from rev-list-options

From
Jeff King <peff@peff.net>
Date
Jul 29, 2020, 20:11 UTC
Message-ID
<20200729201116.GD2989342@coredump.intra.peff.net>
In-Reply-To
<20200729201002.GA2989059@coredump.intra.peff.net>

Our rev-list-options.txt include has a "Diff Formatting" section, but it is ifndef'd out for all manpages except git-log. And a few bits of the text are rather out of date.

We say "some of these options are specific to git-rev-list". That's obviously silly since we (even before this patch) show the content only for git-log. But moreover, it's not true; each of the listed options is meaningful for other diff commands.

We also say "...however other diff options may be given. See git-diff-files for more options." But there's no need to do so; git-log already has a "Common Diff Options" section which includes diff-options.txt.

So let's move these options over to git-log and put them with the other diff options, giving a single "diff" section for the git-log documentation. We'll call it "Diff Formatting" but use the all-caps top-level header to match its sibling sections. And we'll rewrite the section intro to remove the useless bits and give a more generic overview of the section which can be later extended.

Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/git-log.txt          | 42 +++++++++++++++++++++++++--
 Documentation/rev-list-options.txt | 46 ------------------------------
 2 files changed, 40 insertions(+), 48 deletions(-)
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 20e6d21a74..fb3998d8e0 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -111,8 +111,46 @@ include::rev-list-options.txt[]
 
 include::pretty-formats.txt[]
 
-COMMON DIFF OPTIONS
--------------------
+DIFF FORMATTING
+---------------
+
+By default, `git log` does not generate any diff output. The options
+below can be used to show the changes made by each commit.
+
+-c::
+	With this option, diff output for a merge commit
+	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. Furthermore, it lists only files
+	which were modified from all parents.
+
+--cc::
+	This flag implies the `-c` option and further compresses the
+	patch output by omitting uninteresting hunks whose contents in
+	the parents have only two variants and the merge result picks
+	one of them without modification.
+
+--combined-all-paths::
+	This flag causes combined diffs (used for merge commits) to
+	list the name of the file from all parents.  It thus only has
+	effect when -c or --cc are specified, and is likely only
+	useful if filename changes are detected (i.e. when either
+	rename or copy detection have been requested).
+
+-m::
+--diff-merges::
+	This flag makes the merge commits show the full diff like
+	regular commits; for each merge parent, a separate log entry
+	and diff is generated. An exception is that only diff against
+	the first parent is shown when `--first-parent` option is given;
+	in that case, the output represents the changes the merge
+	brought _into_ the then-current branch.
+
+-r::
+	Show recursive diffs.
+
+-t::
+	Show the tree objects in the diff output. This implies `-r`.
 
 :git-log: 1
 include::diff-options.txt[]
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 0785a0cfe9..398178d72a 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -1117,49 +1117,3 @@ ifdef::git-rev-list[]
 	by a tab.
 endif::git-rev-list[]
 endif::git-shortlog[]
-
-ifndef::git-shortlog[]
-ifndef::git-rev-list[]
-Diff Formatting
-~~~~~~~~~~~~~~~
-
-Listed below are options that control the formatting of diff output.
-Some of them are specific to linkgit:git-rev-list[1], however other diff
-options may be given. See linkgit:git-diff-files[1] for more options.
-
--c::
-	With this option, diff output for a merge commit
-	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. Furthermore, it lists only files
-	which were modified from all parents.
-
---cc::
-	This flag implies the `-c` option and further compresses the
-	patch output by omitting uninteresting hunks whose contents in
-	the parents have only two variants and the merge result picks
-	one of them without modification.
-
---combined-all-paths::
-	This flag causes combined diffs (used for merge commits) to
-	list the name of the file from all parents.  It thus only has
-	effect when -c or --cc are specified, and is likely only
-	useful if filename changes are detected (i.e. when either
-	rename or copy detection have been requested).
-
--m::
---diff-merges::
-	This flag makes the merge commits show the full diff like
-	regular commits; for each merge parent, a separate log entry
-	and diff is generated. An exception is that only diff against
-	the first parent is shown when `--first-parent` option is given;
-	in that case, the output represents the changes the merge
-	brought _into_ the then-current branch.
-
--r::
-	Show recursive diffs.
-
--t::
-	Show the tree objects in the diff output. This implies `-r`.
-endif::git-rev-list[]
-endif::git-shortlog[]
-- 
2.28.0.465.gd2839157e3
Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 86 in “making --first-parent imply -m”
  1. 0/3 making --first-parent imply -mJeff King, Jul 28, 2020
  2. 1/3 log: drop "--cc implies -m" logicJeff King, Jul 28, 2020
  3. 2/3 revision: add "--ignore-merges" option to counteract "-m"Jeff King, Jul 28, 2020
  4. Chris TorekJul 28, 2020
  5. Jeff KingJul 29, 2020
  6. Junio C HamanoJul 28, 2020
  7. Jeff KingJul 29, 2020
  8. Jeff KingJul 29, 2020
  9. Junio C HamanoJul 29, 2020
  10. 3/3 log: enable "-m" automatically with "--first-parent"Jeff King, Jul 28, 2020
  11. Jeff KingJul 28, 2020
  12. Junio C HamanoJul 28, 2020
  13. Jeff KingJul 28, 2020
  14. Taylor BlauJul 28, 2020
  15. 0/7 making log --first-parent imply -mJeff King, Jul 29, 2020
  16. 1/7 log: drop "--cc implies -m" logicJeff King, Jul 29, 2020
  17. 2/7 revision: add "--no-diff-merges" option to counteract "-m"Jeff King, Jul 29, 2020
  18. 3/7 log: enable "-m" automatically with "--first-parent"Jeff King, Jul 29, 2020
  19. Junio C HamanoJul 29, 2020
  20. 4/7 doc/git-log: move "Diff Formatting" from rev-list-optionsJeff King, Jul 29, 2020
  21. Junio C HamanoJul 29, 2020
  22. Jeff KingJul 29, 2020
  23. 5/7 doc/git-log: drop "-r" diff optionJeff King, Jul 29, 2020
  24. 6/7 doc/git-log: move "-t" into diff-options listJeff King, Jul 29, 2020
  25. Junio C HamanoJul 29, 2020
  26. Jeff KingJul 29, 2020
  27. 7/7 doc/git-log: clarify handling of merge commit diffsJeff King, Jul 29, 2020
  28. Chris TorekJul 29, 2020
  29. Sergey OrganovJul 29, 2020
  30. Jeff KingJul 31, 2020
  31. Sergey OrganovAug 2, 2020
  32. Junio C HamanoAug 2, 2020
  33. Sergey OrganovAug 3, 2020
  34. Junio C HamanoAug 3, 2020
  35. Sergey OrganovAug 3, 2020
  36. Junio C HamanoAug 3, 2020
  37. Sergey OrganovAug 3, 2020
  38. Jeff KingAug 3, 2020
  39. Sergey OrganovAug 3, 2020
  40. Jeff KingAug 3, 2020
  41. Sergey OrganovAug 3, 2020
  42. Jeff KingAug 3, 2020
  43. Sergey OrganovAug 3, 2020
  44. Sergey OrganovAug 4, 2020
  45. Junio C HamanoAug 4, 2020
  46. Jeff KingAug 4, 2020
  47. Sergey OrganovAug 4, 2020
  48. Jeff KingAug 4, 2020
  49. Junio C HamanoAug 4, 2020
  50. Sergey OrganovAug 4, 2020
  51. Jeff KingAug 4, 2020
  52. Junio C HamanoAug 4, 2020
  53. Jeff KingAug 7, 2020
  54. Sergey OrganovAug 7, 2020
  55. Junio C HamanoAug 7, 2020
  56. Sergey OrganovAug 7, 2020
  57. Junio C HamanoAug 7, 2020
  58. Sergey OrganovAug 7, 2020
  59. Jeff KingAug 7, 2020
  60. Sergey OrganovAug 7, 2020
  61. Junio C HamanoAug 7, 2020
  62. Sergey OrganovAug 7, 2020
  63. Junio C HamanoAug 7, 2020
  64. Sergey OrganovAug 7, 2020
  65. Junio C HamanoAug 7, 2020
  66. Sergey OrganovAug 7, 2020
  67. Sergey OrganovAug 4, 2020
  68. Sergey OrganovAug 4, 2020
  69. Jeff KingAug 4, 2020
  70. Jeff KingAug 4, 2020
  71. Sergey OrganovAug 4, 2020
  72. Jeff KingAug 4, 2020
  73. Sergey OrganovAug 4, 2020
  74. Jeff KingAug 4, 2020
  75. Sergey OrganovAug 4, 2020
  76. Junio C HamanoAug 4, 2020
  77. Sergey OrganovAug 4, 2020
  78. Sergey OrganovAug 4, 2020
  79. Jeff KingAug 4, 2020
  80. revision: fix die() message for "--unpacked="Sergey Organov, Aug 4, 2020
  81. Junio C HamanoAug 5, 2020
  82. Sergey OrganovAug 5, 2020
  83. Junio C HamanoAug 5, 2020
  84. Sergey OrganovAug 5, 2020
  85. Junio C HamanoAug 5, 2020
  86. Sergey OrganovAug 5, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.