git.txt: add list of guides
Not all man5/man7 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) by leveraging the existing `Documentation/cmd-list.perl` script to generate 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). Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philippe Blain committed
Aug 5, 2020 at 01:19 UTC
f442f28a81b56d99b803be221ba397f2a586c88e
3 files changed
+14
-1
Documentation/Makefile
+1
@@ -295,6 +295,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
295
cmds-plumbingmanipulators.txt \
296
cmds-synchingrepositories.txt \
297
cmds-synchelpers.txt \
298
+ cmds-guide.txt \
299
cmds-purehelpers.txt \
300
cmds-foreignscminterface.txt
301
Documentation/cmd-list.perl
+6
-1
@@ -6,9 +6,14 @@ sub format_one {
6
my ($out, $nameattr) = @_;
7
my ($name, $attr) = @$nameattr;
8
my ($state, $description);
9
+ my $mansection;
10
$state = 0;
11
open I, '<', "$name.txt" or die "No such file $name.txt";
12
while (<I>) {
13
+ if (/^git[a-z0-9-]*\(([0-9])\)$/) {
14
+ $mansection = $1;
15
+ next;
16
+ }
17
if (/^NAME$/) {
18
$state = 1;
19
next;
@@ -27,7 +32,7 @@ sub format_one {
32
die "No description found in $name.txt";
33
}
34
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
30
- print $out "linkgit:$name\[1\]::\n\t";
35
+ print $out "linkgit:$name\[$mansection\]::\n\t";
36
if ($attr =~ / deprecated /) {
37
print $out "(deprecated) ";
38
}
Documentation/git.txt
+7
@@ -304,6 +304,13 @@ users typically do not use them directly.
304
305
include::cmds-purehelpers.txt[]
306
307
+Guides
308
+------
309
+
310
+The following documentation pages are guides about Git concepts.
311
+
312
+include::cmds-guide.txt[]
313
+
314
315
Configuration Mechanism
316
-----------------------