Skip to content

Commit 840371f

Browse files
committed
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 1b81d8c (help: use command-list.txt for the source of guides, 2018-05-20). Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Philippe Blain <[email protected]>
1 parent 552444a commit 840371f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Documentation/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
295295
cmds-plumbingmanipulators.txt \
296296
cmds-synchingrepositories.txt \
297297
cmds-synchelpers.txt \
298+
cmds-guide.txt \
298299
cmds-purehelpers.txt \
299300
cmds-foreignscminterface.txt
300301

Documentation/cmd-list.perl

Lines changed: 6 additions & 1 deletion
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
}

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)