git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] git.txt: add list of guides

From
Philippe Blain <levraiphilippeblain@gmail.com>
Date
Aug 3, 2020, 14:16 UTC
Message-ID
<6C571F33-0ACE-4C1C-805C-7E8ADE50D18D@gmail.com>
In-Reply-To
<xmqqv9i0wvoz.fsf@gitster.c.googlers.com>
Hi Junio, 
Show 17 quoted lines
> 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.
Show 87 quoted lines
> 
> 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.
Previous: Junio C HamanoNext: Philippe Blain via GitGitGadget
Message 6 of 18 in “[RFC] List all guides in git(1)”
  1. 0/3 [RFC] List all guides in git(1)Philippe Blain via GitGitGadget, Aug 2, 2020
  2. 1/3 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 2, 2020
  3. 3/3 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 2, 2020
  4. Junio C HamanoAug 2, 2020
  5. Junio C HamanoAug 2, 2020
  6. Philippe BlainAug 3, 2020
  7. 2/3 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 2, 2020
  8. 0/3 List all guides in git(1)Philippe Blain via GitGitGadget, Aug 4, 2020
  9. 1/3 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 4, 2020
  10. 2/3 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 4, 2020
  11. 3/3 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 4, 2020
  12. Junio C HamanoAug 4, 2020
  13. Philippe BlainAug 4, 2020
  14. 0/4 List all guides in git(1)Philippe Blain via GitGitGadget, Aug 5, 2020
  15. 1/4 command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers'Philippe Blain via GitGitGadget, Aug 5, 2020
  16. 2/4 help: drop usage of 'common' and 'useful' for guidesPhilippe Blain via GitGitGadget, Aug 5, 2020
  17. 4/4 git.txt: add list of guidesPhilippe Blain via GitGitGadget, Aug 5, 2020
  18. 3/4 Documentation: don't hardcode command categories twiceJunio C Hamano via GitGitGadget, Aug 5, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.