git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] [RFC] List all guides in git(1)
@ 2020-08-02 15:20 Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-02 15:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

This series adds a list of the guides to git(1).

The first commit adds the misssing guides 'gitcredentials' and
'gitremote-helpers' to command-list.txt. The only missing guide after this
change is 'gitweb.conf', but I think this one is obscure anough, and already
linked to in 'gitweb.txt', that it does not matter much.

The second commit drops the usage of 'common' and 'useful' for guides. This
was suggested as one of two ways forward by Duy in [1] but was not commented
on. I'm CC'ing the people that were CC'ed on that message.

The third commit tweaks 'Documentation/cmd-list.perl' so that it also
generates a list of the guides, which gets included in 'git.txt'. I chose to
put this list just after the end of the list of commands.

[1] 
https://lore.kernel.org/git/CACsJy8ADj-bTMYDHxRNLOMppOEdPbVwL49u3XCfNBCmoLLZo+A@mail.gmail.com/

Philippe Blain (3):
  command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  help: drop usage of 'common' and 'useful' for guides
  git.txt: add list of guides

 Documentation/Makefile           |  1 +
 Documentation/cmd-list.perl      | 10 ++++++++--
 Documentation/git-help.txt       |  6 +++---
 Documentation/git.txt            |  7 +++++++
 Documentation/gitcredentials.txt |  2 +-
 builtin/help.c                   |  2 +-
 command-list.txt                 |  2 ++
 help.c                           |  4 ++--
 help.h                           |  2 +-
 9 files changed, 26 insertions(+), 10 deletions(-)


base-commit: e8ab941b671da6890181aea5b5755d1d9eea24ec
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-691%2Fphil-blain%2Flist-guides-in-git.1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-691/phil-blain/list-guides-in-git.1-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/691
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
@ 2020-08-02 15:20 ` Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-02 15:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

The guides 'gitcredentials' and 'gitremote-helpers' do not currently
appear in command-list.txt.

'gitcredentials' was forgotten back when guides were added to
command-list.txt in 1b81d8cb19 (help: use command-list.txt for the
source of guides, 2018-05-20).

'gitremote-helpers' was moved to section 7 in 439cc74632 (docs: move
gitremote-helpers into section 7, 2019-03-25), but command-list.txt was
not updated at the time.

Add these two guides to the list of guides in 'command-list.txt', so
that they appear in the output of 'git help --guides', and capitalize
the first word of the description of 'gitcredentials', as was done in
1b81d8c (help: use command-list.txt for the source of guides,
2018-05-20) for the other guides.

While at it, add a comment in Documentation/Makefile to remind developers
to update command-list.txt if they add a new guide.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/Makefile           | 1 +
 Documentation/gitcredentials.txt | 2 +-
 command-list.txt                 | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index ecd0b340b1..39f6fc8de7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -17,6 +17,7 @@ MAN1_TXT += git.txt
 MAN1_TXT += gitk.txt
 MAN1_TXT += gitweb.txt
 
+# man5 / man7 guides (note: new guides should also be added to command-list.txt)
 MAN5_TXT += gitattributes.txt
 MAN5_TXT += githooks.txt
 MAN5_TXT += gitignore.txt
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index 9e481aec85..758bf39ba3 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -3,7 +3,7 @@ gitcredentials(7)
 
 NAME
 ----
-gitcredentials - providing usernames and passwords to Git
+gitcredentials - Providing usernames and passwords to Git
 
 SYNOPSIS
 --------
diff --git a/command-list.txt b/command-list.txt
index 89aa60cde7..e5901f2213 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -195,6 +195,7 @@ git-write-tree                          plumbingmanipulators
 gitattributes                           guide
 gitcli                                  guide
 gitcore-tutorial                        guide
+gitcredentials                          guide
 gitcvs-migration                        guide
 gitdiffcore                             guide
 giteveryday                             guide
@@ -204,6 +205,7 @@ githooks                                guide
 gitignore                               guide
 gitmodules                              guide
 gitnamespaces                           guide
+gitremote-helpers                       guide
 gitrepository-layout                    guide
 gitrevisions                            guide
 gitsubmodules                           guide
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] help: drop usage of 'common' and 'useful' for guides
  2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
@ 2020-08-02 15:20 ` Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
  3 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-02 15:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Since 1b81d8cb19 (help: use command-list.txt for the source of guides,
2018-05-20), all man5/man7 guides listed in command-list.txt appear in
the output of 'git help -g'.

However, 'git help -g' still prefixes this list with "The common Git
guides are:", which makes one wonder if there are others!

In the same spirit, the man page for 'git help' describes the '--guides'
option as listing 'useful' guides, which is not false per se but can
also be taken to mean that there are other guides that exist but are not
useful.

Instead of 'common' and 'useful', use 'Git concept guides' in both
places. To keep the code in line with this change, rename
help.c::list_common_guides_help to list_guides_help.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/git-help.txt | 6 +++---
 builtin/help.c             | 2 +-
 help.c                     | 4 ++--
 help.h                     | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index 69c0c5c34e..44fe8860b3 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -21,8 +21,8 @@ on the standard output.
 If the option `--all` or `-a` is given, all available commands are
 printed on the standard output.
 
-If the option `--guides` or `-g` is given, a list of the useful
-Git guides is also printed on the standard output.
+If the option `--guides` or `-g` is given, a list of the
+Git concept guides is also printed on the standard output.
 
 If a command, or a guide, is given, a manual page for that command or
 guide is brought up. The 'man' program is used by default for this
@@ -58,7 +58,7 @@ OPTIONS
 
 -g::
 --guides::
-	Prints a list of useful guides on the standard output. This
+	Prints a list of the Git concept guides on the standard output. This
 	option overrides any given command or guide name.
 
 -i::
diff --git a/builtin/help.c b/builtin/help.c
index 299206eb57..bb339f0fc8 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -579,7 +579,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	}
 
 	if (show_guides)
-		list_common_guides_help();
+		list_guides_help();
 
 	if (show_all || show_guides) {
 		printf("%s\n", _(git_more_info_string));
diff --git a/help.c b/help.c
index 44cee69c11..d478afb2af 100644
--- a/help.c
+++ b/help.c
@@ -397,10 +397,10 @@ void list_cmds_by_config(struct string_list *list)
 	}
 }
 
-void list_common_guides_help(void)
+void list_guides_help(void)
 {
 	struct category_description catdesc[] = {
-		{ CAT_guide, N_("The common Git guides are:") },
+		{ CAT_guide, N_("The Git concept guides are:") },
 		{ 0, NULL }
 	};
 	print_cmd_by_category(catdesc, NULL);
diff --git a/help.h b/help.h
index 500521b908..dc02458855 100644
--- a/help.h
+++ b/help.h
@@ -21,7 +21,7 @@ static inline void mput_char(char c, unsigned int num)
 
 void list_common_cmds_help(void);
 void list_all_cmds_help(void);
-void list_common_guides_help(void);
+void list_guides_help(void);
 
 void list_all_main_cmds(struct string_list *list);
 void list_all_other_cmds(struct string_list *list);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] git.txt: add list of guides
  2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
  2020-08-02 15:20 ` [PATCH 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
@ 2020-08-02 15:20 ` Philippe Blain via GitGitGadget
  2020-08-02 21:44   ` Junio C Hamano
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
  3 siblings, 1 reply; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-02 15:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] git.txt: add list of guides
  2020-08-02 15:20 ` [PATCH 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
@ 2020-08-02 21:44   ` Junio C Hamano
  2020-08-02 22:05     ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2020-08-02 21:44 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget
  Cc: git, Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> 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.

Who cleans this?  Do we need a change to Makefile?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] git.txt: add list of guides
  2020-08-02 21:44   ` Junio C Hamano
@ 2020-08-02 22:05     ` Junio C Hamano
  2020-08-03 14:16       ` Philippe Blain
  0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2020-08-02 22:05 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget
  Cc: git, Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

Junio C Hamano <gitster@pobox.com> writes:

> "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> 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.
>
> Who cleans this?  Do we need a change to Makefile?

A band-aid patch would look like this, BUT.

    diff --git a/Documentation/Makefile b/Documentation/Makefile
    index 39f6fc8de7..616449da88 100644
    --- a/Documentation/Makefile
    +++ b/Documentation/Makefile
    @@ -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

I think with a bit more work, we can be at a lot better place.  How
about something along the following line (untested)?

 Documentation/Makefile      |  3 ++-
 Documentation/cmd-list.perl | 21 ++++++++-------------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 39f6fc8de7..80d1908a44 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -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
 
@@ -302,7 +303,7 @@ $(cmds_txt): cmd-list.made
 
 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 	$(QUIET_GEN)$(RM) $@ && \
-	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
+	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
 	date >$@
 
 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 99f01a0910..af5da45d28 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -43,12 +43,15 @@ sub format_one {
 	}
 }
 
-while (<>) {
+my ($input, @categories) = @ARGV;
+
+open IN, "<$input";
+while (<IN>) {
 	last if /^### command list/;
 }
 
 my %cmds = ();
-for (sort <>) {
+for (sort <IN>) {
 	next if /^#/;
 
 	chomp;
@@ -56,18 +59,10 @@ sub format_one {
 	$attr = '' unless defined $attr;
 	push @{$cmds{$cat}}, [$name, " $attr "];
 }
+close IN;
 
-for my $cat (qw(ancillaryinterrogators
-		ancillarymanipulators
-		mainporcelain
-		plumbinginterrogators
-		plumbingmanipulators
-		synchingrepositories
-		foreignscminterface
-		purehelpers
-		synchelpers
-		guide)) {
-	my $out = "cmds-$cat.txt";
+for my $out (@categories) {
+	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
 	open O, '>', "$out+" or die "Cannot open output file $out+";
 	for (@{$cmds{$cat}}) {
 		format_one(\*O, $_);

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] git.txt: add list of guides
  2020-08-02 22:05     ` Junio C Hamano
@ 2020-08-03 14:16       ` Philippe Blain
  0 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain @ 2020-08-03 14:16 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Philippe Blain via GitGitGadget, Git mailing list,
	Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor

Hi Junio, 

> Le 2 août 2020 à 18:05, Junio C Hamano <gitster@pobox.com> a écrit :
> 
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
>> 
>>> 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.
>> 
>> Who cleans this?  Do we need a change to Makefile?

Oups! I checked /.gitignore, but forgot to thoroughly check the Makefile.

> 
> A band-aid patch would look like this, BUT.
> 
>    diff --git a/Documentation/Makefile b/Documentation/Makefile
>    index 39f6fc8de7..616449da88 100644
>    --- a/Documentation/Makefile
>    +++ b/Documentation/Makefile
>    @@ -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
> 
> I think with a bit more work, we can be at a lot better place.  How
> about something along the following line (untested)?
> 
> Documentation/Makefile      |  3 ++-
> Documentation/cmd-list.perl | 21 ++++++++-------------
> 2 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 39f6fc8de7..80d1908a44 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -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
> 
> @@ -302,7 +303,7 @@ $(cmds_txt): cmd-list.made
> 
> cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
> 	$(QUIET_GEN)$(RM) $@ && \
> -	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
> +	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
> 	date >$@
> 
> mergetools_txt = mergetools-diff.txt mergetools-merge.txt
> diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
> index 99f01a0910..af5da45d28 100755
> --- a/Documentation/cmd-list.perl
> +++ b/Documentation/cmd-list.perl
> @@ -43,12 +43,15 @@ sub format_one {
> 	}
> }
> 
> -while (<>) {
> +my ($input, @categories) = @ARGV;
> +
> +open IN, "<$input";
> +while (<IN>) {
> 	last if /^### command list/;
> }
> 
> my %cmds = ();
> -for (sort <>) {
> +for (sort <IN>) {
> 	next if /^#/;
> 
> 	chomp;
> @@ -56,18 +59,10 @@ sub format_one {
> 	$attr = '' unless defined $attr;
> 	push @{$cmds{$cat}}, [$name, " $attr "];
> }
> +close IN;
> 
> -for my $cat (qw(ancillaryinterrogators
> -		ancillarymanipulators
> -		mainporcelain
> -		plumbinginterrogators
> -		plumbingmanipulators
> -		synchingrepositories
> -		foreignscminterface
> -		purehelpers
> -		synchelpers
> -		guide)) {
> -	my $out = "cmds-$cat.txt";
> +for my $out (@categories) {
> +	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
> 	open O, '>', "$out+" or die "Cannot open output file $out+";
> 	for (@{$cmds{$cat}}) {
> 		format_one(\*O, $_);

Thanks for the suggestion. I tested it and it works correctly. 
I've incorporated it to v2.


Philippe.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 0/3] List all guides in git(1)
  2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
                   ` (2 preceding siblings ...)
  2020-08-02 15:20 ` [PATCH 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
@ 2020-08-04  0:20 ` Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
                     ` (4 more replies)
  3 siblings, 5 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-04  0:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

Changes since v1:

 * Incorporated Junio's suggestion to reduce duplication.

v1: This series adds a list of the guides to git(1).

The first commit adds the misssing guides 'gitcredentials' and
'gitremote-helpers' to command-list.txt. The only missing guide after this
change is 'gitweb.conf', but I think this one is obscure anough, and already
linked to in 'gitweb.txt', that it does not matter much.

The second commit drops the usage of 'common' and 'useful' for guides. This
was suggested as one of two ways forward by Duy in [1] but was not commented
on. I'm CC'ing the people that were CC'ed on that message.

The third commit tweaks 'Documentation/cmd-list.perl' so that it also
generates a list of the guides, which gets included in 'git.txt'. I chose to
put this list just after the end of the list of commands.

[1] 
https://lore.kernel.org/git/CACsJy8ADj-bTMYDHxRNLOMppOEdPbVwL49u3XCfNBCmoLLZo+A@mail.gmail.com/

Philippe Blain (3):
  command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  help: drop usage of 'common' and 'useful' for guides
  git.txt: add list of guides

 Documentation/Makefile           |  4 +++-
 Documentation/cmd-list.perl      | 27 ++++++++++++++-------------
 Documentation/git-help.txt       |  6 +++---
 Documentation/git.txt            |  7 +++++++
 Documentation/gitcredentials.txt |  2 +-
 builtin/help.c                   |  2 +-
 command-list.txt                 |  2 ++
 help.c                           |  4 ++--
 help.h                           |  2 +-
 9 files changed, 34 insertions(+), 22 deletions(-)


base-commit: e8ab941b671da6890181aea5b5755d1d9eea24ec
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-691%2Fphil-blain%2Flist-guides-in-git.1-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-691/phil-blain/list-guides-in-git.1-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/691

Range-diff vs v1:

 1:  2bd473e0aa = 1:  2bd473e0aa command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
 2:  f49cf08f4f = 2:  f49cf08f4f help: drop usage of 'common' and 'useful' for guides
 3:  9374d80f0c ! 3:  4394bb357b git.txt: add list of guides
     @@ Metadata
       ## Commit message ##
          git.txt: add list of guides
      
     -    Not all guides are mentioned in the 'git(1)' documentation,
     +    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).
     +    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.
      
     -    Tweak `Documentation/cmd-list.perl` so that it also generates
     -    a file `cmds-guide.txt` which gets included in git.txt.
     +    Instead of hard-coding the list of command categories in both
     +    `Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
     +    Makefile the authoritative source and tweak `cmd-list.perl` so that it
     +    receives the list of command categories as argument.
      
          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
     @@ Commit message
          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>
      
     + ## Documentation/Makefile ##
     +@@ Documentation/Makefile: cmds_txt = cmds-ancillaryinterrogators.txt \
     + 	cmds-plumbingmanipulators.txt \
     + 	cmds-synchingrepositories.txt \
     + 	cmds-synchelpers.txt \
     ++	cmds-guide.txt \
     + 	cmds-purehelpers.txt \
     + 	cmds-foreignscminterface.txt
     + 
     +@@ Documentation/Makefile: $(cmds_txt): cmd-list.made
     + 
     + cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
     + 	$(QUIET_GEN)$(RM) $@ && \
     +-	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
     ++	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
     + 	date >$@
     + 
     + mergetools_txt = mergetools-diff.txt mergetools-merge.txt
     +
       ## Documentation/cmd-list.perl ##
      @@ Documentation/cmd-list.perl: sub format_one {
       	my ($out, $nameattr) = @_;
     @@ Documentation/cmd-list.perl: sub format_one {
       			print $out "(deprecated) ";
       		}
      @@ Documentation/cmd-list.perl: sub format_one {
     - 		synchingrepositories
     - 		foreignscminterface
     - 		purehelpers
     + 	}
     + }
     + 
     +-while (<>) {
     ++my ($input, @categories) = @ARGV;
     ++
     ++open IN, "<$input";
     ++while (<IN>) {
     + 	last if /^### command list/;
     + }
     + 
     + my %cmds = ();
     +-for (sort <>) {
     ++for (sort <IN>) {
     + 	next if /^#/;
     + 
     + 	chomp;
     +@@ Documentation/cmd-list.perl: sub format_one {
     + 	$attr = '' unless defined $attr;
     + 	push @{$cmds{$cat}}, [$name, " $attr "];
     + }
     ++close IN;
     + 
     +-for my $cat (qw(ancillaryinterrogators
     +-		ancillarymanipulators
     +-		mainporcelain
     +-		plumbinginterrogators
     +-		plumbingmanipulators
     +-		synchingrepositories
     +-		foreignscminterface
     +-		purehelpers
      -		synchelpers)) {
     -+		synchelpers
     -+		guide)) {
     - 	my $out = "cmds-$cat.txt";
     +-	my $out = "cmds-$cat.txt";
     ++for my $out (@categories) {
     ++	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
       	open O, '>', "$out+" or die "Cannot open output file $out+";
       	for (@{$cmds{$cat}}) {
     + 		format_one(\*O, $_);
      
       ## Documentation/git.txt ##
      @@ Documentation/git.txt: users typically do not use them directly.

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
@ 2020-08-04  0:20   ` Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-04  0:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

The guides 'gitcredentials' and 'gitremote-helpers' do not currently
appear in command-list.txt.

'gitcredentials' was forgotten back when guides were added to
command-list.txt in 1b81d8cb19 (help: use command-list.txt for the
source of guides, 2018-05-20).

'gitremote-helpers' was moved to section 7 in 439cc74632 (docs: move
gitremote-helpers into section 7, 2019-03-25), but command-list.txt was
not updated at the time.

Add these two guides to the list of guides in 'command-list.txt', so
that they appear in the output of 'git help --guides', and capitalize
the first word of the description of 'gitcredentials', as was done in
1b81d8c (help: use command-list.txt for the source of guides,
2018-05-20) for the other guides.

While at it, add a comment in Documentation/Makefile to remind developers
to update command-list.txt if they add a new guide.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/Makefile           | 1 +
 Documentation/gitcredentials.txt | 2 +-
 command-list.txt                 | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index ecd0b340b1..39f6fc8de7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -17,6 +17,7 @@ MAN1_TXT += git.txt
 MAN1_TXT += gitk.txt
 MAN1_TXT += gitweb.txt
 
+# man5 / man7 guides (note: new guides should also be added to command-list.txt)
 MAN5_TXT += gitattributes.txt
 MAN5_TXT += githooks.txt
 MAN5_TXT += gitignore.txt
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index 9e481aec85..758bf39ba3 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -3,7 +3,7 @@ gitcredentials(7)
 
 NAME
 ----
-gitcredentials - providing usernames and passwords to Git
+gitcredentials - Providing usernames and passwords to Git
 
 SYNOPSIS
 --------
diff --git a/command-list.txt b/command-list.txt
index 89aa60cde7..e5901f2213 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -195,6 +195,7 @@ git-write-tree                          plumbingmanipulators
 gitattributes                           guide
 gitcli                                  guide
 gitcore-tutorial                        guide
+gitcredentials                          guide
 gitcvs-migration                        guide
 gitdiffcore                             guide
 giteveryday                             guide
@@ -204,6 +205,7 @@ githooks                                guide
 gitignore                               guide
 gitmodules                              guide
 gitnamespaces                           guide
+gitremote-helpers                       guide
 gitrepository-layout                    guide
 gitrevisions                            guide
 gitsubmodules                           guide
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/3] help: drop usage of 'common' and 'useful' for guides
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
@ 2020-08-04  0:20   ` Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-04  0:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Since 1b81d8cb19 (help: use command-list.txt for the source of guides,
2018-05-20), all man5/man7 guides listed in command-list.txt appear in
the output of 'git help -g'.

However, 'git help -g' still prefixes this list with "The common Git
guides are:", which makes one wonder if there are others!

In the same spirit, the man page for 'git help' describes the '--guides'
option as listing 'useful' guides, which is not false per se but can
also be taken to mean that there are other guides that exist but are not
useful.

Instead of 'common' and 'useful', use 'Git concept guides' in both
places. To keep the code in line with this change, rename
help.c::list_common_guides_help to list_guides_help.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/git-help.txt | 6 +++---
 builtin/help.c             | 2 +-
 help.c                     | 4 ++--
 help.h                     | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index 69c0c5c34e..44fe8860b3 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -21,8 +21,8 @@ on the standard output.
 If the option `--all` or `-a` is given, all available commands are
 printed on the standard output.
 
-If the option `--guides` or `-g` is given, a list of the useful
-Git guides is also printed on the standard output.
+If the option `--guides` or `-g` is given, a list of the
+Git concept guides is also printed on the standard output.
 
 If a command, or a guide, is given, a manual page for that command or
 guide is brought up. The 'man' program is used by default for this
@@ -58,7 +58,7 @@ OPTIONS
 
 -g::
 --guides::
-	Prints a list of useful guides on the standard output. This
+	Prints a list of the Git concept guides on the standard output. This
 	option overrides any given command or guide name.
 
 -i::
diff --git a/builtin/help.c b/builtin/help.c
index 299206eb57..bb339f0fc8 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -579,7 +579,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	}
 
 	if (show_guides)
-		list_common_guides_help();
+		list_guides_help();
 
 	if (show_all || show_guides) {
 		printf("%s\n", _(git_more_info_string));
diff --git a/help.c b/help.c
index 44cee69c11..d478afb2af 100644
--- a/help.c
+++ b/help.c
@@ -397,10 +397,10 @@ void list_cmds_by_config(struct string_list *list)
 	}
 }
 
-void list_common_guides_help(void)
+void list_guides_help(void)
 {
 	struct category_description catdesc[] = {
-		{ CAT_guide, N_("The common Git guides are:") },
+		{ CAT_guide, N_("The Git concept guides are:") },
 		{ 0, NULL }
 	};
 	print_cmd_by_category(catdesc, NULL);
diff --git a/help.h b/help.h
index 500521b908..dc02458855 100644
--- a/help.h
+++ b/help.h
@@ -21,7 +21,7 @@ static inline void mput_char(char c, unsigned int num)
 
 void list_common_cmds_help(void);
 void list_all_cmds_help(void);
-void list_common_guides_help(void);
+void list_guides_help(void);
 
 void list_all_main_cmds(struct string_list *list);
 void list_all_other_cmds(struct string_list *list);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 3/3] git.txt: add list of guides
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
  2020-08-04  0:20   ` [PATCH v2 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
@ 2020-08-04  0:20   ` Philippe Blain via GitGitGadget
  2020-08-04  0:26   ` [PATCH v2 0/3] List all guides in git(1) Junio C Hamano
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
  4 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-04  0:20 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

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.

Instead of hard-coding the list of command categories in both
`Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
Makefile the authoritative source and tweak `cmd-list.perl` so that it
receives the list of command categories as argument.

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>
---
 Documentation/Makefile      |  3 ++-
 Documentation/cmd-list.perl | 27 ++++++++++++++-------------
 Documentation/git.txt       |  7 +++++++
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 39f6fc8de7..80d1908a44 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -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
 
@@ -302,7 +303,7 @@ $(cmds_txt): cmd-list.made
 
 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 	$(QUIET_GEN)$(RM) $@ && \
-	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
+	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
 	date >$@
 
 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 5aa73cfe45..af5da45d28 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) ";
 		}
@@ -38,12 +43,15 @@ sub format_one {
 	}
 }
 
-while (<>) {
+my ($input, @categories) = @ARGV;
+
+open IN, "<$input";
+while (<IN>) {
 	last if /^### command list/;
 }
 
 my %cmds = ();
-for (sort <>) {
+for (sort <IN>) {
 	next if /^#/;
 
 	chomp;
@@ -51,17 +59,10 @@ sub format_one {
 	$attr = '' unless defined $attr;
 	push @{$cmds{$cat}}, [$name, " $attr "];
 }
+close IN;
 
-for my $cat (qw(ancillaryinterrogators
-		ancillarymanipulators
-		mainporcelain
-		plumbinginterrogators
-		plumbingmanipulators
-		synchingrepositories
-		foreignscminterface
-		purehelpers
-		synchelpers)) {
-	my $out = "cmds-$cat.txt";
+for my $out (@categories) {
+	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
 	open O, '>', "$out+" or die "Cannot open output file $out+";
 	for (@{$cmds{$cat}}) {
 		format_one(\*O, $_);
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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] List all guides in git(1)
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
                     ` (2 preceding siblings ...)
  2020-08-04  0:20   ` [PATCH v2 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
@ 2020-08-04  0:26   ` Junio C Hamano
  2020-08-04 13:44     ` Philippe Blain
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
  4 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2020-08-04  0:26 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget
  Cc: git, Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Changes since v1:
>
>  * Incorporated Junio's suggestion to reduce duplication.
>
> v1: This series adds a list of the guides to git(1).
>
> The first commit adds the misssing guides 'gitcredentials' and
> 'gitremote-helpers' to command-list.txt. The only missing guide after this
> change is 'gitweb.conf', but I think this one is obscure anough, and already
> linked to in 'gitweb.txt', that it does not matter much.
>
> The second commit drops the usage of 'common' and 'useful' for guides. This
> was suggested as one of two ways forward by Duy in [1] but was not commented
> on. I'm CC'ing the people that were CC'ed on that message.
>
> The third commit tweaks 'Documentation/cmd-list.perl' so that it also
> generates a list of the guides, which gets included in 'git.txt'. I chose to
> put this list just after the end of the list of commands.
>
> [1] 
> https://lore.kernel.org/git/CACsJy8ADj-bTMYDHxRNLOMppOEdPbVwL49u3XCfNBCmoLLZo+A@mail.gmail.com/
>
> Philippe Blain (3):
>   command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
>   help: drop usage of 'common' and 'useful' for guides
>   git.txt: add list of guides

I think the "dedup the list of cmds-$category.txt" is logically a
separate step from "we forgot to add guide category so add it", so
either (1) "add guide twice, and then refactor" or (2) "refactor
before adding guide, and then add guide only in one place" would be
more appropriate than (3) "add guide while refactoring".  IMHO, (2)
would make the most sense.

Thanks.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] List all guides in git(1)
  2020-08-04  0:26   ` [PATCH v2 0/3] List all guides in git(1) Junio C Hamano
@ 2020-08-04 13:44     ` Philippe Blain
  0 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain @ 2020-08-04 13:44 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Philippe Blain via GitGitGadget, Git mailing list,
	Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor


> Le 3 août 2020 à 20:26, Junio C Hamano <gitster@pobox.com> a écrit :
> 
> "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> Changes since v1:
>> 
>> * Incorporated Junio's suggestion to reduce duplication.
>> 
>> v1: This series adds a list of the guides to git(1).
>> 
>> The first commit adds the misssing guides 'gitcredentials' and
>> 'gitremote-helpers' to command-list.txt. The only missing guide after this
>> change is 'gitweb.conf', but I think this one is obscure anough, and already
>> linked to in 'gitweb.txt', that it does not matter much.
>> 
>> The second commit drops the usage of 'common' and 'useful' for guides. This
>> was suggested as one of two ways forward by Duy in [1] but was not commented
>> on. I'm CC'ing the people that were CC'ed on that message.
>> 
>> The third commit tweaks 'Documentation/cmd-list.perl' so that it also
>> generates a list of the guides, which gets included in 'git.txt'. I chose to
>> put this list just after the end of the list of commands.
>> 
>> [1] 
>> https://lore.kernel.org/git/CACsJy8ADj-bTMYDHxRNLOMppOEdPbVwL49u3XCfNBCmoLLZo+A@mail.gmail.com/
>> 
>> Philippe Blain (3):
>>  command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
>>  help: drop usage of 'common' and 'useful' for guides
>>  git.txt: add list of guides
> 
> I think the "dedup the list of cmds-$category.txt" is logically a
> separate step from "we forgot to add guide category so add it", so
> either (1) "add guide twice, and then refactor" or (2) "refactor
> before adding guide, and then add guide only in one place" would be
> more appropriate than (3) "add guide while refactoring".  IMHO, (2)
> would make the most sense.
> 

I agree that (2) makes the most sense, I've split it for v3. (Your "SQUASH???" message on pb/guide-docs 
may have mislead me :)

Philippe.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 0/4] List all guides in git(1)
  2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
                     ` (3 preceding siblings ...)
  2020-08-04  0:26   ` [PATCH v2 0/3] List all guides in git(1) Junio C Hamano
@ 2020-08-05  1:19   ` Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
                       ` (3 more replies)
  4 siblings, 4 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-05  1:19 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain

Changes since v2:

 * Split the third commit following Junio's suggestion

Question for Junio: Since the new commit 3/4 comes entirely from your
suggestion, I've attributed authorship to you, but I've added my own
sign-off because Gitgitgadget requires sign-off on each commit. Please let
me know if I should have proceeded differently.

v2:

 * Incorporated Junio's suggestion to reduce duplication.

v1: This series adds a list of the guides to git(1).

The first commit adds the misssing guides 'gitcredentials' and
'gitremote-helpers' to command-list.txt. The only missing guide after this
change is 'gitweb.conf', but I think this one is obscure anough, and already
linked to in 'gitweb.txt', that it does not matter much.

The second commit drops the usage of 'common' and 'useful' for guides. This
was suggested as one of two ways forward by Duy in [1] but was not commented
on. I'm CC'ing the people that were CC'ed on that message.

The third commit tweaks 'Documentation/cmd-list.perl' so that it also
generates a list of the guides, which gets included in 'git.txt'. I chose to
put this list just after the end of the list of commands.

[1] 
https://lore.kernel.org/git/CACsJy8ADj-bTMYDHxRNLOMppOEdPbVwL49u3XCfNBCmoLLZo+A@mail.gmail.com/

Junio C Hamano (1):
  Documentation: don't hardcode command categories twice

Philippe Blain (3):
  command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  help: drop usage of 'common' and 'useful' for guides
  git.txt: add list of guides

 Documentation/Makefile           |  4 +++-
 Documentation/cmd-list.perl      | 27 ++++++++++++++-------------
 Documentation/git-help.txt       |  6 +++---
 Documentation/git.txt            |  7 +++++++
 Documentation/gitcredentials.txt |  2 +-
 builtin/help.c                   |  2 +-
 command-list.txt                 |  2 ++
 help.c                           |  4 ++--
 help.h                           |  2 +-
 9 files changed, 34 insertions(+), 22 deletions(-)


base-commit: e8ab941b671da6890181aea5b5755d1d9eea24ec
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-691%2Fphil-blain%2Flist-guides-in-git.1-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-691/phil-blain/list-guides-in-git.1-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/691

Range-diff vs v2:

 1:  2bd473e0aa = 1:  2bd473e0aa command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
 2:  f49cf08f4f = 2:  f49cf08f4f help: drop usage of 'common' and 'useful' for guides
 -:  ---------- > 3:  552444a842 Documentation: don't hardcode command categories twice
 3:  4394bb357b ! 4:  840371fb4b git.txt: add list of guides
     @@ Commit message
          `Documentation/cmd-list.perl` script to generate a file `cmds-guide.txt`
          which gets included in git.txt.
      
     -    Instead of hard-coding the list of command categories in both
     -    `Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
     -    Makefile the authoritative source and tweak `cmd-list.perl` so that it
     -    receives the list of command categories as argument.
     -
          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).
     +    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>
     @@ Documentation/Makefile: cmds_txt = cmds-ancillaryinterrogators.txt \
       	cmds-purehelpers.txt \
       	cmds-foreignscminterface.txt
       
     -@@ Documentation/Makefile: $(cmds_txt): cmd-list.made
     - 
     - cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
     - 	$(QUIET_GEN)$(RM) $@ && \
     --	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
     -+	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
     - 	date >$@
     - 
     - mergetools_txt = mergetools-diff.txt mergetools-merge.txt
      
       ## Documentation/cmd-list.perl ##
      @@ Documentation/cmd-list.perl: sub format_one {
     @@ Documentation/cmd-list.perl: sub format_one {
       		if ($attr =~ / deprecated /) {
       			print $out "(deprecated) ";
       		}
     -@@ Documentation/cmd-list.perl: sub format_one {
     - 	}
     - }
     - 
     --while (<>) {
     -+my ($input, @categories) = @ARGV;
     -+
     -+open IN, "<$input";
     -+while (<IN>) {
     - 	last if /^### command list/;
     - }
     - 
     - my %cmds = ();
     --for (sort <>) {
     -+for (sort <IN>) {
     - 	next if /^#/;
     - 
     - 	chomp;
     -@@ Documentation/cmd-list.perl: sub format_one {
     - 	$attr = '' unless defined $attr;
     - 	push @{$cmds{$cat}}, [$name, " $attr "];
     - }
     -+close IN;
     - 
     --for my $cat (qw(ancillaryinterrogators
     --		ancillarymanipulators
     --		mainporcelain
     --		plumbinginterrogators
     --		plumbingmanipulators
     --		synchingrepositories
     --		foreignscminterface
     --		purehelpers
     --		synchelpers)) {
     --	my $out = "cmds-$cat.txt";
     -+for my $out (@categories) {
     -+	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
     - 	open O, '>', "$out+" or die "Cannot open output file $out+";
     - 	for (@{$cmds{$cat}}) {
     - 		format_one(\*O, $_);
      
       ## Documentation/git.txt ##
      @@ Documentation/git.txt: users typically do not use them directly.

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
@ 2020-08-05  1:19     ` Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 2/4] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-05  1:19 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

The guides 'gitcredentials' and 'gitremote-helpers' do not currently
appear in command-list.txt.

'gitcredentials' was forgotten back when guides were added to
command-list.txt in 1b81d8cb19 (help: use command-list.txt for the
source of guides, 2018-05-20).

'gitremote-helpers' was moved to section 7 in 439cc74632 (docs: move
gitremote-helpers into section 7, 2019-03-25), but command-list.txt was
not updated at the time.

Add these two guides to the list of guides in 'command-list.txt', so
that they appear in the output of 'git help --guides', and capitalize
the first word of the description of 'gitcredentials', as was done in
1b81d8c (help: use command-list.txt for the source of guides,
2018-05-20) for the other guides.

While at it, add a comment in Documentation/Makefile to remind developers
to update command-list.txt if they add a new guide.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/Makefile           | 1 +
 Documentation/gitcredentials.txt | 2 +-
 command-list.txt                 | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index ecd0b340b1..39f6fc8de7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -17,6 +17,7 @@ MAN1_TXT += git.txt
 MAN1_TXT += gitk.txt
 MAN1_TXT += gitweb.txt
 
+# man5 / man7 guides (note: new guides should also be added to command-list.txt)
 MAN5_TXT += gitattributes.txt
 MAN5_TXT += githooks.txt
 MAN5_TXT += gitignore.txt
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index 9e481aec85..758bf39ba3 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -3,7 +3,7 @@ gitcredentials(7)
 
 NAME
 ----
-gitcredentials - providing usernames and passwords to Git
+gitcredentials - Providing usernames and passwords to Git
 
 SYNOPSIS
 --------
diff --git a/command-list.txt b/command-list.txt
index 89aa60cde7..e5901f2213 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -195,6 +195,7 @@ git-write-tree                          plumbingmanipulators
 gitattributes                           guide
 gitcli                                  guide
 gitcore-tutorial                        guide
+gitcredentials                          guide
 gitcvs-migration                        guide
 gitdiffcore                             guide
 giteveryday                             guide
@@ -204,6 +205,7 @@ githooks                                guide
 gitignore                               guide
 gitmodules                              guide
 gitnamespaces                           guide
+gitremote-helpers                       guide
 gitrepository-layout                    guide
 gitrevisions                            guide
 gitsubmodules                           guide
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/4] help: drop usage of 'common' and 'useful' for guides
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
@ 2020-08-05  1:19     ` Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 3/4] Documentation: don't hardcode command categories twice Junio C Hamano via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 4/4] git.txt: add list of guides Philippe Blain via GitGitGadget
  3 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-05  1:19 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Since 1b81d8cb19 (help: use command-list.txt for the source of guides,
2018-05-20), all man5/man7 guides listed in command-list.txt appear in
the output of 'git help -g'.

However, 'git help -g' still prefixes this list with "The common Git
guides are:", which makes one wonder if there are others!

In the same spirit, the man page for 'git help' describes the '--guides'
option as listing 'useful' guides, which is not false per se but can
also be taken to mean that there are other guides that exist but are not
useful.

Instead of 'common' and 'useful', use 'Git concept guides' in both
places. To keep the code in line with this change, rename
help.c::list_common_guides_help to list_guides_help.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/git-help.txt | 6 +++---
 builtin/help.c             | 2 +-
 help.c                     | 4 ++--
 help.h                     | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index 69c0c5c34e..44fe8860b3 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -21,8 +21,8 @@ on the standard output.
 If the option `--all` or `-a` is given, all available commands are
 printed on the standard output.
 
-If the option `--guides` or `-g` is given, a list of the useful
-Git guides is also printed on the standard output.
+If the option `--guides` or `-g` is given, a list of the
+Git concept guides is also printed on the standard output.
 
 If a command, or a guide, is given, a manual page for that command or
 guide is brought up. The 'man' program is used by default for this
@@ -58,7 +58,7 @@ OPTIONS
 
 -g::
 --guides::
-	Prints a list of useful guides on the standard output. This
+	Prints a list of the Git concept guides on the standard output. This
 	option overrides any given command or guide name.
 
 -i::
diff --git a/builtin/help.c b/builtin/help.c
index 299206eb57..bb339f0fc8 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -579,7 +579,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	}
 
 	if (show_guides)
-		list_common_guides_help();
+		list_guides_help();
 
 	if (show_all || show_guides) {
 		printf("%s\n", _(git_more_info_string));
diff --git a/help.c b/help.c
index 44cee69c11..d478afb2af 100644
--- a/help.c
+++ b/help.c
@@ -397,10 +397,10 @@ void list_cmds_by_config(struct string_list *list)
 	}
 }
 
-void list_common_guides_help(void)
+void list_guides_help(void)
 {
 	struct category_description catdesc[] = {
-		{ CAT_guide, N_("The common Git guides are:") },
+		{ CAT_guide, N_("The Git concept guides are:") },
 		{ 0, NULL }
 	};
 	print_cmd_by_category(catdesc, NULL);
diff --git a/help.h b/help.h
index 500521b908..dc02458855 100644
--- a/help.h
+++ b/help.h
@@ -21,7 +21,7 @@ static inline void mput_char(char c, unsigned int num)
 
 void list_common_cmds_help(void);
 void list_all_cmds_help(void);
-void list_common_guides_help(void);
+void list_guides_help(void);
 
 void list_all_main_cmds(struct string_list *list);
 void list_all_other_cmds(struct string_list *list);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/4] Documentation: don't hardcode command categories twice
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 2/4] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
@ 2020-08-05  1:19     ` Junio C Hamano via GitGitGadget
  2020-08-05  1:19     ` [PATCH v3 4/4] git.txt: add list of guides Philippe Blain via GitGitGadget
  3 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano via GitGitGadget @ 2020-08-05  1:19 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Junio C Hamano

From: Junio C Hamano <gitster@pobox.com>

Instead of hard-coding the list of command categories in both
`Documentation/Makefile` and `Documentation/cmd-list.perl`, make the
Makefile the authoritative source and tweak `cmd-list.perl` so that it
receives the list of command categories as argument.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/Makefile      |  2 +-
 Documentation/cmd-list.perl | 20 ++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 39f6fc8de7..eb9c7e2b0e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -302,7 +302,7 @@ $(cmds_txt): cmd-list.made
 
 cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 	$(QUIET_GEN)$(RM) $@ && \
-	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
+	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
 	date >$@
 
 mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 5aa73cfe45..ee96de53db 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -38,12 +38,15 @@ sub format_one {
 	}
 }
 
-while (<>) {
+my ($input, @categories) = @ARGV;
+
+open IN, "<$input";
+while (<IN>) {
 	last if /^### command list/;
 }
 
 my %cmds = ();
-for (sort <>) {
+for (sort <IN>) {
 	next if /^#/;
 
 	chomp;
@@ -51,17 +54,10 @@ sub format_one {
 	$attr = '' unless defined $attr;
 	push @{$cmds{$cat}}, [$name, " $attr "];
 }
+close IN;
 
-for my $cat (qw(ancillaryinterrogators
-		ancillarymanipulators
-		mainporcelain
-		plumbinginterrogators
-		plumbingmanipulators
-		synchingrepositories
-		foreignscminterface
-		purehelpers
-		synchelpers)) {
-	my $out = "cmds-$cat.txt";
+for my $out (@categories) {
+	my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
 	open O, '>', "$out+" or die "Cannot open output file $out+";
 	for (@{$cmds{$cat}}) {
 		format_one(\*O, $_);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/4] git.txt: add list of guides
  2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
                       ` (2 preceding siblings ...)
  2020-08-05  1:19     ` [PATCH v3 3/4] Documentation: don't hardcode command categories twice Junio C Hamano via GitGitGadget
@ 2020-08-05  1:19     ` Philippe Blain via GitGitGadget
  3 siblings, 0 replies; 18+ messages in thread
From: Philippe Blain via GitGitGadget @ 2020-08-05  1:19 UTC (permalink / raw)
  To: git
  Cc: Nguyễn Thái Ngọc Duy, Philip Oakley,
	Eric Sunshine, SZEDER Gábor, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

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>
---
 Documentation/Makefile      | 1 +
 Documentation/cmd-list.perl | 7 ++++++-
 Documentation/git.txt       | 7 +++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index eb9c7e2b0e..80d1908a44 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -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
 
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index ee96de53db..af5da45d28 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) ";
 		}
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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-08-05  1:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 15:20 [PATCH 0/3] [RFC] List all guides in git(1) Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-02 15:20 ` [PATCH 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
2020-08-02 21:44   ` Junio C Hamano
2020-08-02 22:05     ` Junio C Hamano
2020-08-03 14:16       ` Philippe Blain
2020-08-04  0:20 ` [PATCH v2 0/3] List all guides in git(1) Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 1/3] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 2/3] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-04  0:20   ` [PATCH v2 3/3] git.txt: add list of guides Philippe Blain via GitGitGadget
2020-08-04  0:26   ` [PATCH v2 0/3] List all guides in git(1) Junio C Hamano
2020-08-04 13:44     ` Philippe Blain
2020-08-05  1:19   ` [PATCH v3 0/4] " Philippe Blain via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 1/4] command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers' Philippe Blain via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 2/4] help: drop usage of 'common' and 'useful' for guides Philippe Blain via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 3/4] Documentation: don't hardcode command categories twice Junio C Hamano via GitGitGadget
2020-08-05  1:19     ` [PATCH v3 4/4] git.txt: add list of guides Philippe Blain via GitGitGadget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).