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

[PATCH 2/2] git(1) docs: create a "Git file and wire formats" section

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 15, 2021, 02:05 UTC
Message-ID
<patch-2.2-5e80ee09523-20211015T020351Z-avarab@gmail.com>
In-Reply-To
<cover-0.2-00000000000-20211015T020351Z-avarab@gmail.com>

Create a new "Git file and wire formats" section in the main "git(1)" manual page and start moving the documentation that now lives in "Documentation/technical/*.git" over to it. This compliments the newly added and adjacent "User-facing file formats" section.

This makes the technical documentation more accessible and discoverable. Before this we wouldn't install it by default, and had no ability to build man page versions of them. The links to them from our existing documentation link to the generated HTML version of these docs.

So let's start moving those over, starting with just the "bundle-format.txt" documentation added in 7378ec90e1c (doc: describe Git bundle format, 2020-02-07). We'll now have a new gitformat-bundle(5) man page.

Unfortunately the syntax of the current Documentation/technical/*.txt is not the same (when it comes to section headings etc.) as our Documentation/*.txt documentation, so change the relevant bits of syntax as we're moving this over.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/Makefile                        |  3 +-
 Documentation/git-bundle.txt                  | 12 +++--
 Documentation/git.txt                         |  8 ++++
 ...bundle-format.txt => gitformat-bundle.txt} | 44 ++++++++++++++++---
 Documentation/lint-man-section-order.perl     |  3 ++
 builtin/help.c                                |  8 ++++
 command-list.txt                              |  5 +++
 help.c                                        | 11 +++++
 help.h                                        |  1 +
 9 files changed, 83 insertions(+), 12 deletions(-)
 rename Documentation/{technical/bundle-format.txt => gitformat-bundle.txt} (78%)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 8efed2e23e1..cc4761df82e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -21,6 +21,7 @@ MAN1_TXT += gitweb.txt
 
 # man5 / man7 guides (note: new guides should also be added to command-list.txt)
 MAN5_TXT += gitattributes.txt
+MAN5_TXT += gitformat-bundle.txt
 MAN5_TXT += githooks.txt
 MAN5_TXT += gitignore.txt
 MAN5_TXT += gitmailmap.txt
@@ -90,7 +91,6 @@ SP_ARTICLES += $(API_DOCS)
 TECH_DOCS += MyFirstContribution
 TECH_DOCS += MyFirstObjectWalk
 TECH_DOCS += SubmittingPatches
-TECH_DOCS += technical/bundle-format
 TECH_DOCS += technical/hash-function-transition
 TECH_DOCS += technical/http-protocol
 TECH_DOCS += technical/index-format
@@ -312,6 +312,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
 	cmds-synchelpers.txt \
 	cmds-guide.txt \
 	cmds-userformats.txt \
+	cmds-gitformats.txt \
 	cmds-purehelpers.txt \
 	cmds-foreignscminterface.txt
 
diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index 71b5ecabd1f..cc3c32f5c0d 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -56,10 +56,9 @@ using "thin packs" bundles created using exclusions are smaller in
 size. That they're "thin" under the hood is merely noted here as a
 curiosity, and as a reference to other documentation
 
-See link:technical/bundle-format.html[the `bundle-format`
-documentation] for more details and the discussion of "thin pack" in
-link:technical/pack-format.html[the pack format documentation] for
-further details.
+See linkgit:gitformat-bundle[5] for more details and the discussion of
+"thin pack" in link:technical/pack-format.html[the pack format
+documentation] for further details.
 
 OPTIONS
 -------
@@ -334,6 +333,11 @@ You can also see what references it offers:
 $ git ls-remote mybundle
 ----------------
 
+FILE FORMAT
+-----------
+
+See linkgit:gitformat-bundle[5].
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 823977595c5..0c77475d7a0 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -345,6 +345,14 @@ edit. These can also be listed with 'git help --user-formats'.
 
 include::cmds-userformats.txt[]
 
+Git file and wire formats
+-------------------------
+
+This documentation discusses the file and wire formats that git itself
+uses. These can also be listed with 'git help --git-formats'.
+
+include::cmds-gitformats.txt[]
+
 Configuration Mechanism
 -----------------------
 
diff --git a/Documentation/technical/bundle-format.txt b/Documentation/gitformat-bundle.txt
similarity index 78%
rename from Documentation/technical/bundle-format.txt
rename to Documentation/gitformat-bundle.txt
index bac558d049a..3aa2242eb9d 100644
--- a/Documentation/technical/bundle-format.txt
+++ b/Documentation/gitformat-bundle.txt
@@ -1,11 +1,33 @@
-= Git bundle v2 format
+gitformat-bundle(5)
+===================
 
-The Git bundle format is a format that represents both refs and Git objects.
+NAME
+----
+gitformat-bundle - The bundle file format
+
+
+SYNOPSIS
+--------
+[verse]
+*.bundle
+*.bdl
+
+DESCRIPTION
+-----------
+
+The Git bundle format is a format that represents both refs and Git
+objects. A bundle is a header in a format similar to
+linkgit:git-show-ref[1] followed by a pack in *.pack format.
 
-== Format
+The format is created and read by the linkgit:git-bundle[1] command,
+and supported by e.g. linkgit:git-fetch[1] and linkgit:git-clone[1].
+
+
+FORMAT
+------
 
 We will use ABNF notation to define the Git bundle format. See
-protocol-common.txt for the details.
+link:technical/protocol-common.html for the details.
 
 A v2 bundle looks like this:
 
@@ -36,7 +58,9 @@ value        = *(%01-09 / %0b-FF)
 pack         = ... ; packfile
 ----
 
-== Semantics
+
+SEMANTICS
+---------
 
 A Git bundle consists of several parts.
 
@@ -62,15 +86,21 @@ In the bundle format, there can be a comment following a prerequisite obj-id.
 This is a comment and it has no specific meaning. The writer of the bundle MAY
 put any string here. The reader of the bundle MUST ignore the comment.
 
-=== Note on the shallow clone and a Git bundle
+Note on the shallow clone and a Git bundle
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Note that the prerequisites does not represent a shallow-clone boundary. The
 semantics of the prerequisites and the shallow-clone boundaries are different,
 and the Git bundle v2 format cannot represent a shallow clone repository.
 
-== Capabilities
+CAPABILITIES
+------------
 
 Because there is no opportunity for negotiation, unknown capabilities cause 'git
 bundle' to abort.  The only known capability is `object-format`, which specifies
 the hash algorithm in use, and can take the same values as the
 `extensions.objectFormat` configuration value.
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/Documentation/lint-man-section-order.perl b/Documentation/lint-man-section-order.perl
index b05f9156dd9..81f04b6f3a2 100755
--- a/Documentation/lint-man-section-order.perl
+++ b/Documentation/lint-man-section-order.perl
@@ -32,6 +32,9 @@
 		'SEE ALSO' => {
 			order => $order++,
 		},
+		'FILE FORMAT' => {
+			order => $order++,
+		},
 		'GIT' => {
 			required => 1,
 			order => $order++,
diff --git a/builtin/help.c b/builtin/help.c
index 5e842ea5a26..54ff30a0d37 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -44,6 +44,7 @@ static enum help_action {
 	HELP_ACTION_GUIDES,
 	HELP_ACTION_CONFIG,
 	HELP_ACTION_USER_FORMATS,
+	HELP_ACTION_GIT_FORMATS,
 	HELP_ACTION_CONFIG_FOR_COMPLETION,
 	HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION,
 } cmd_mode;
@@ -67,6 +68,8 @@ static struct option builtin_help_options[] = {
 		    HELP_ACTION_GUIDES),
 	OPT_CMDMODE(0, "user-formats", &cmd_mode, N_("print list of user-facing file formats"),
 		    HELP_ACTION_USER_FORMATS),
+	OPT_CMDMODE(0, "git-formats", &cmd_mode, N_("print list of Git's own file and network formats"),
+		    HELP_ACTION_GIT_FORMATS),
 	OPT_CMDMODE('c', "config", &cmd_mode, N_("print all configuration variable names"),
 		    HELP_ACTION_CONFIG),
 	OPT_CMDMODE_F(0, "config-for-completion", &cmd_mode, "",
@@ -83,6 +86,7 @@ static const char * const builtin_help_usage[] = {
 	N_("git help [-g|--guides]"),
 	N_("git help [-c|--config]"),
 	N_("git help [--user-formats]"),
+	N_("git help [--git-formats]"),
 	NULL
 };
 
@@ -621,6 +625,10 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 		no_extra_argc(argc);
 		list_user_formats_help();
 		return 0;
+	case HELP_ACTION_GIT_FORMATS:
+		no_extra_argc(argc);
+		list_git_formats_help();
+		return 0;
 	case HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION:
 		no_extra_argc(argc);
 		list_config_help(SHOW_CONFIG_SECTIONS);
diff --git a/command-list.txt b/command-list.txt
index 5732ea437a8..3cf09b9d9eb 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -47,6 +47,10 @@
 # .mailmap etc. files lives in man section 5. These entries can only
 # have the "userformats" attribute and nothing else.
 #
+# Git's own file and network formats such as documentation for the
+# *.bundle format lives in mn section 5. These entries can only have
+# the "gitformats" attribute and nothing else.
+#
 ### command list (do not change this line, also do not change alignment)
 # command name                          category [category] [category]
 git-add                                 mainporcelain           worktree
@@ -210,6 +214,7 @@ githooks                                userformats
 gitignore                               userformats
 gitmailmap                              userformats
 gitmodules                              userformats
+gitformat-bundle                        gitformats
 gitnamespaces                           guide
 gitremote-helpers                       guide
 gitrepository-layout                    userformats
diff --git a/help.c b/help.c
index a7b5c909056..7b97867cb96 100644
--- a/help.c
+++ b/help.c
@@ -38,6 +38,7 @@ static struct category_description main_categories[] = {
 	{ CAT_synchingrepositories, N_("Low-level Commands / Syncing Repositories") },
 	{ CAT_purehelpers, N_("Low-level Commands / Internal Helpers") },
 	{ CAT_userformats, N_("User-facing file formats") },
+	{ CAT_gitformats, N_("Internal file- and wire formats formats") },
 	{ 0, NULL }
 };
 
@@ -433,6 +434,16 @@ void list_user_formats_help(void)
 	putchar('\n');
 }
 
+void list_git_formats_help(void)
+{
+	struct category_description catdesc[] = {
+		{ CAT_gitformats, N_("Git's internal file and network formats are:") },
+		{ 0, NULL }
+	};
+	print_cmd_by_category(catdesc, NULL);
+	putchar('\n');
+}
+
 static int get_alias(const char *var, const char *value, void *data)
 {
 	struct string_list *list = data;
diff --git a/help.h b/help.h
index d01908078dc..1075235f367 100644
--- a/help.h
+++ b/help.h
@@ -23,6 +23,7 @@ void list_common_cmds_help(void);
 void list_all_cmds_help(void);
 void list_guides_help(void);
 void list_user_formats_help(void);
+void list_git_formats_help(void);
 
 void list_all_main_cmds(struct string_list *list);
 void list_all_other_cmds(struct string_list *list);
-- 
2.33.1.1338.g20da966911a
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 112 in “git(1) doc + "git help": split-out user & git format docs”
  1. 0/2 git(1) doc + "git help": split-out user & git format docsÆvar Arnfjörð Bjarmason, Oct 15, 2021
  2. 1/2 git(1) docs: split "User-facing file formats" off from "Guides"Ævar Arnfjörð Bjarmason, Oct 15, 2021
  3. 2/2 git(1) docs: create a "Git file and wire formats" sectionÆvar Arnfjörð Bjarmason, Oct 15, 2021
  4. 0/5 git doc + "git help": move "format" docs from technical/*Ævar Arnfjörð Bjarmason, Dec 12, 2021
  5. 1/5 git docs: split "User-facing file formats" off from "Guides"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  6. 2/5 git docs: create a "Git file and wire formats" sectionÆvar Arnfjörð Bjarmason, Dec 12, 2021
  7. Eric SunshineDec 12, 2021
  8. Ævar Arnfjörð BjarmasonDec 13, 2021
  9. 3/5 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Dec 12, 2021
  10. 4/5 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Dec 12, 2021
  11. 5/5 docs: move {index,signature,bitmap,chunk}-format docs to man section 5Ævar Arnfjörð Bjarmason, Dec 12, 2021
  12. 0/7 git doc + "git help": move "format" docs from technical/*Ævar Arnfjörð Bjarmason, Jul 12, 2022
  13. 1/7 git docs: split "User-facing file formats" off from "Guides"Ævar Arnfjörð Bjarmason, Jul 12, 2022
  14. Ævar Arnfjörð BjarmasonJul 13, 2022
  15. 2/7 git docs: create a "Git file formats and protocols" sectionÆvar Arnfjörð Bjarmason, Jul 12, 2022
  16. 3/7 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 12, 2022
  17. 4/7 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Jul 12, 2022
  18. 5/7 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 12, 2022
  19. 6/7 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Jul 12, 2022
  20. 7/7 docs: move multi-pack-index docs to man section 5Ævar Arnfjörð Bjarmason, Jul 12, 2022
  21. 0/8 git doc + "git help": move "format" docs from technical/*Ævar Arnfjörð Bjarmason, Jul 18, 2022
  22. 1/8 help.c: BUG() out if "help --guides" can't remove "git" prefixesÆvar Arnfjörð Bjarmason, Jul 18, 2022
  23. Junio C HamanoJul 18, 2022
  24. 2/8 git docs: split "User-facing file formats" off from "Guides"Ævar Arnfjörð Bjarmason, Jul 18, 2022
  25. Junio C HamanoJul 18, 2022
  26. Ævar Arnfjörð BjarmasonJul 18, 2022
  27. Junio C HamanoJul 19, 2022
  28. Ævar Arnfjörð BjarmasonJul 21, 2022
  29. 3/8 git docs: create a "Git file formats and protocols" sectionÆvar Arnfjörð Bjarmason, Jul 18, 2022
  30. 4/8 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 18, 2022
  31. 5/8 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Jul 18, 2022
  32. 7/8 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Jul 18, 2022
  33. 8/8 docs: move multi-pack-index docs to man section 5Ævar Arnfjörð Bjarmason, Jul 18, 2022
  34. 6/8 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 18, 2022
  35. Junio C HamanoJul 18, 2022
  36. Ævar Arnfjörð BjarmasonJul 18, 2022
  37. Ævar Arnfjörð BjarmasonJul 21, 2022
  38. 0/9 docs: create & use "(user|developer) interfaces" categoriesÆvar Arnfjörð Bjarmason, Jul 21, 2022
  39. 1/9 help.c: BUG() out if "help --guides" can't remove "git" prefixesÆvar Arnfjörð Bjarmason, Jul 21, 2022
  40. 2/9 git help doc: use "<doc>" instead of "<guide>"Ævar Arnfjörð Bjarmason, Jul 21, 2022
  41. 3/9 git docs: add a category for user-facing file, repo and command UXÆvar Arnfjörð Bjarmason, Jul 21, 2022
  42. 4/9 git docs: add a category for file formats, protocols and interfacesÆvar Arnfjörð Bjarmason, Jul 21, 2022
  43. Eric SunshineJul 21, 2022
  44. 5/9 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 21, 2022
  45. 6/9 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Jul 21, 2022
  46. 7/9 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 21, 2022
  47. 8/9 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Jul 21, 2022
  48. 9/9 docs: move multi-pack-index docs to man section 5Ævar Arnfjörð Bjarmason, Jul 21, 2022
  49. Junio C HamanoJul 21, 2022
  50. 0/9 docs: create & use "(user|developer) interfaces" categoriesÆvar Arnfjörð Bjarmason, Jul 28, 2022
  51. 1/9 help.c: BUG() out if "help --guides" can't remove "git" prefixesÆvar Arnfjörð Bjarmason, Jul 28, 2022
  52. Junio C HamanoJul 30, 2022
  53. Ævar Arnfjörð BjarmasonAug 1, 2022
  54. Junio C HamanoAug 1, 2022
  55. 2/9 git help doc: use "<doc>" instead of "<guide>"Ævar Arnfjörð Bjarmason, Jul 28, 2022
  56. 3/9 git docs: add a category for user-facing file, repo and command UXÆvar Arnfjörð Bjarmason, Jul 28, 2022
  57. 4/9 git docs: add a category for file formats, protocols and interfacesÆvar Arnfjörð Bjarmason, Jul 28, 2022
  58. 5/9 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 28, 2022
  59. 6/9 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Jul 28, 2022
  60. 7/9 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Jul 28, 2022
  61. 8/9 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Jul 28, 2022
  62. 9/9 docs: move multi-pack-index docs to man section 5Ævar Arnfjörð Bjarmason, Jul 28, 2022
  63. Junio C HamanoJul 28, 2022
  64. 00/10 docs: create & use "(user|developer) interfaces" categoriesÆvar Arnfjörð Bjarmason, Aug 2, 2022
  65. 01/10 help.c: refactor drop_prefix() to use a "switch" statement"Ævar Arnfjörð Bjarmason, Aug 2, 2022
  66. Junio C HamanoAug 2, 2022
  67. 02/10 help.c: remove common category behavior from drop_prefix() behaviorÆvar Arnfjörð Bjarmason, Aug 2, 2022
  68. 03/10 git help doc: use "<doc>" instead of "<guide>"Ævar Arnfjörð Bjarmason, Aug 2, 2022
  69. 04/10 git docs: add a category for user-facing file, repo and command UXÆvar Arnfjörð Bjarmason, Aug 2, 2022
  70. 05/10 git docs: add a category for file formats, protocols and interfacesÆvar Arnfjörð Bjarmason, Aug 2, 2022
  71. Junio C HamanoAug 2, 2022
  72. 06/10 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Aug 2, 2022
  73. Junio C HamanoAug 3, 2022
  74. 07/10 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Aug 2, 2022
  75. Junio C HamanoAug 3, 2022
  76. Ævar Arnfjörð BjarmasonAug 4, 2022
  77. Junio C HamanoAug 4, 2022
  78. Ævar Arnfjörð BjarmasonAug 5, 2022
  79. 09/10 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Aug 2, 2022
  80. Junio C HamanoAug 3, 2022
  81. 08/10 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Aug 2, 2022
  82. Junio C HamanoAug 3, 2022
  83. 10/10 docs: move multi-pack-index docs to man section 5Ævar Arnfjörð Bjarmason, Aug 2, 2022
  84. Junio C HamanoAug 3, 2022
  85. 00/12 docs: create & use "(user|developer) interfaces" categoriesÆvar Arnfjörð Bjarmason, Aug 4, 2022
  86. 01/12 help.c: refactor drop_prefix() to use a "switch" statement"Ævar Arnfjörð Bjarmason, Aug 4, 2022
  87. Junio C HamanoAug 4, 2022
  88. 02/12 help.c: remove common category behavior from drop_prefix() behaviorÆvar Arnfjörð Bjarmason, Aug 4, 2022
  89. 03/12 git help doc: use "<doc>" instead of "<guide>"Ævar Arnfjörð Bjarmason, Aug 4, 2022
  90. 04/12 git docs: add a category for user-facing file, repo and command UXÆvar Arnfjörð Bjarmason, Aug 4, 2022
  91. 05/12 git docs: add a category for file formats, protocols and interfacesÆvar Arnfjörð Bjarmason, Aug 4, 2022
  92. 06/12 docs: move commit-graph format docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  93. Junio C HamanoAug 4, 2022
  94. SZEDER GáborNov 8, 2022
  95. Ævar Arnfjörð BjarmasonNov 8, 2022
  96. SZEDER GáborNov 8, 2022
  97. Ævar Arnfjörð BjarmasonNov 9, 2022
  98. docs: de-indent first paragraph of gitformat-* to flow the textÆvar Arnfjörð Bjarmason, Nov 21, 2022
  99. Jeff KingNov 21, 2022
  100. Junio C HamanoNov 22, 2022
  101. 08/12 docs: move index format docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  102. Junio C HamanoAug 4, 2022
  103. 09/12 docs: move signature docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  104. Junio C HamanoAug 4, 2022
  105. 07/12 docs: move protocol-related docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  106. 10/12 docs: move pack format docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  107. 11/12 docs: move cruft pack docs to gitformat-packÆvar Arnfjörð Bjarmason, Aug 4, 2022
  108. Junio C HamanoAug 4, 2022
  109. Ævar Arnfjörð BjarmasonAug 5, 2022
  110. Junio C HamanoAug 5, 2022
  111. 12/12 docs: move http-protocol docs to man section 5Ævar Arnfjörð Bjarmason, Aug 4, 2022
  112. Junio C HamanoAug 4, 2022

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.