]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git.txt: add list of guides
authorPhilippe Blain <levraiphilippeblain@gmail.com>
Wed, 5 Aug 2020 01:19:07 +0000 (01:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Aug 2020 01:34:02 +0000 (18:34 -0700)
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>
Documentation/Makefile
Documentation/cmd-list.perl
Documentation/git.txt

index eb9c7e2b0e6fef4e3817222c63be5af172cc47af..80d1908a44ca38058c58dcc4e3444ee96060757b 100644 (file)
@@ -295,6 +295,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
        cmds-plumbingmanipulators.txt \
        cmds-synchingrepositories.txt \
        cmds-synchelpers.txt \
+       cmds-guide.txt \
        cmds-purehelpers.txt \
        cmds-foreignscminterface.txt
 
index ee96de53db39b51fcd93274b59bbe7291b0338a9..af5da45d2878e07ffe4586bfb8c1dc16134f9e95 100755 (executable)
@@ -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) ";
                }
index 3e50065198891b8f889d7905d8e0573ca791f02f..81349a84e73f76a8303dffa3d0d9a5bc71314f3e 100644 (file)
@@ -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
 -----------------------