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

[PATCH 3/3] git.txt: add list of guides

From
Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 2, 2020, 15:20 UTC
Message-ID
<9374d80f0c37a6b6a7f5f76601ee757f89712d0c.1596381647.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.691.git.1596381647.gitgitgadget@gmail.com>
From: Philippe Blain <levraiphilippeblain@gmail.com>

Not all guides are mentioned in the 'git(1)' documentation, which makes the missing ones somewhat hard to find.

Add a list of the guides to git(1).

Tweak `Documentation/cmd-list.perl` so that it also generates a file `cmds-guide.txt` which gets included in git.txt.

Also, do not hard-code the manual section '1'. Instead, use a regex so that the manual section is discovered from the first line of each `git*.txt` file.

This addition was hinted at in 1b81d8cb19 (help: use command-list.txt for the source of guides, 2018-05-20).

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/cmd-list.perl | 10 ++++++++--
 Documentation/git.txt       |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 5aa73cfe45..99f01a0910 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -6,9 +6,14 @@ sub format_one {
 	my ($out, $nameattr) = @_;
 	my ($name, $attr) = @$nameattr;
 	my ($state, $description);
+	my $mansection;
 	$state = 0;
 	open I, '<', "$name.txt" or die "No such file $name.txt";
 	while (<I>) {
+		if (/^git[a-z0-9-]*\(([0-9])\)$/) {
+			$mansection = $1;
+			next;
+		}
 		if (/^NAME$/) {
 			$state = 1;
 			next;
@@ -27,7 +32,7 @@ sub format_one {
 		die "No description found in $name.txt";
 	}
 	if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
-		print $out "linkgit:$name\[1\]::\n\t";
+		print $out "linkgit:$name\[$mansection\]::\n\t";
 		if ($attr =~ / deprecated /) {
 			print $out "(deprecated) ";
 		}
@@ -60,7 +65,8 @@ sub format_one {
 		synchingrepositories
 		foreignscminterface
 		purehelpers
-		synchelpers)) {
+		synchelpers
+		guide)) {
 	my $out = "cmds-$cat.txt";
 	open O, '>', "$out+" or die "Cannot open output file $out+";
 	for (@{$cmds{$cat}}) {
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 3e50065198..81349a84e7 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -304,6 +304,13 @@ users typically do not use them directly.
 
 include::cmds-purehelpers.txt[]
 
+Guides
+------
+
+The following documentation pages are guides about Git concepts.
+
+include::cmds-guide.txt[]
+
 
 Configuration Mechanism
 -----------------------
-- 
gitgitgadget
Previous: Philippe Blain via GitGitGadgetNext: Junio C Hamano
Message 3 of 18 in “[RFC] List all guides in git(1)”
  1. 0/3 [RFC] List all guides in git(1)Philippe Blain via GitGitGadget, Aug 2, 2020
  2. 1/3 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 2, 2020
  3. 3/3 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 2, 2020
  4. Junio C HamanoAug 2, 2020
  5. Junio C HamanoAug 2, 2020
  6. Philippe BlainAug 3, 2020
  7. 2/3 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 2, 2020
  8. 0/3 List all guides in git(1)Philippe Blain via GitGitGadget, Aug 4, 2020
  9. 1/3 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 4, 2020
  10. 2/3 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 4, 2020
  11. 3/3 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 4, 2020
  12. Junio C HamanoAug 4, 2020
  13. Philippe BlainAug 4, 2020
  14. 0/4 List all guides in git(1)Philippe Blain via GitGitGadget, Aug 5, 2020
  15. 1/4 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 5, 2020
  16. 2/4 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 5, 2020
  17. 4/4 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 5, 2020
  18. 3/4 Documentation: don't hardcode command categories twiceJunio C Hamano via GitGitGadget, Aug 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.