Skip to content

Commit 9374d80

Browse files
committed
git.txt: add list of guides
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 1b81d8c (help: use command-list.txt for the source of guides, 2018-05-20). Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
1 parent f49cf08 commit 9374d80

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Documentation/cmd-list.perl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ sub format_one {
66
my ($out, $nameattr) = @_;
77
my ($name, $attr) = @$nameattr;
88
my ($state, $description);
9+
my $mansection;
910
$state = 0;
1011
open I, '<', "$name.txt" or die "No such file $name.txt";
1112
while (<I>) {
13+
if (/^git[a-z0-9-]*\(([0-9])\)$/) {
14+
$mansection = $1;
15+
next;
16+
}
1217
if (/^NAME$/) {
1318
$state = 1;
1419
next;
@@ -27,7 +32,7 @@ sub format_one {
2732
die "No description found in $name.txt";
2833
}
2934
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
30-
print $out "linkgit:$name\[1\]::\n\t";
35+
print $out "linkgit:$name\[$mansection\]::\n\t";
3136
if ($attr =~ / deprecated /) {
3237
print $out "(deprecated) ";
3338
}
@@ -60,7 +65,8 @@ sub format_one {
6065
synchingrepositories
6166
foreignscminterface
6267
purehelpers
63-
synchelpers)) {
68+
synchelpers
69+
guide)) {
6470
my $out = "cmds-$cat.txt";
6571
open O, '>', "$out+" or die "Cannot open output file $out+";
6672
for (@{$cmds{$cat}}) {

Documentation/git.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ users typically do not use them directly.
304304

305305
include::cmds-purehelpers.txt[]
306306

307+
Guides
308+
------
309+
310+
The following documentation pages are guides about Git concepts.
311+
312+
include::cmds-guide.txt[]
313+
307314

308315
Configuration Mechanism
309316
-----------------------

0 commit comments

Comments
 (0)