Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Julia Evans" <julia@jvns.ca>
Cc: "Julia Evans" <gitgitgadget@gmail.com>,  git@vger.kernel.org
Subject: Re: [PATCH] doc: don't require a SYNOPSIS in section 7
Date: Fri, 02 Oct 2026 14:34:48 -0700	[thread overview]
Message-ID: <xmqqo6dbvlaf.fsf@gitster.g> (raw)
In-Reply-To: <01891b4b-ce04-41aa-8065-d7b88e466dbc@app.fastmail.com> (Julia Evans's message of "Fri, 02 Oct 2026 14:20:47 -0400")

"Julia Evans" <julia@jvns.ca> writes:

>> +# assume the first line is formatted like 'gitglossary(7)'
>> +my $firstline = <>;
>> +$firstline =~ m/\((\d)\)/;
>> +my $man_section_number = $1;
>> +
>>  my $last_was_section;
>>  my @actual_order;
>>  while (my $line = <>) {
>> @@ -93,6 +98,8 @@ while (my $line = <>) {
>> 
>>  		for my $section (sort keys %SECTIONS) {
>>  			next if !$SECTIONS{$section}->{required} or exists 
>> $actual_sections{$section};
>> +			# Synopsis is not required in section 7
>> +			next if ($section eq "SYNOPSIS" && $man_section_number eq "7");
>>  			report("has no required '$section' section!");
>>  		}
>
>
> I just realized that this script is actually supposed to be able to process multiple
> files as command line arguments, and that this patch won't work for that.

Yeah, your version would then notice only the first line of the
first file, and my update would also do the same.

You can work from what I gave you and inside the "eof" part of the
loop reset the %SECTIONS back to the original (which means you'd
need to keep a separate copy of the original) and also reset the
"did I tweak the %SECTIONS thing already?  have I handled the first
line of the current file?" variable.

> I don't understand how Perl's `<>`  works when you pass multiple files as
> command line arguments and that might be too much of a can of worms for me to
> figure right now :/

"man perlfunc" section on "eof" has an example to show what to
detect and reset when you reached the end of each file within a
"while (<>)" loop.

               # reset line numbering on each input file
               while (<>) {
                   next if /^\s*#/;  # skip comments
                   print "$.\t$_";
               } continue {
                   close ARGV if eof;  # Not eof()!
               }

The explicit "close ARGV if eof;" is how the example resets the
$. counter (which by default counts all the lines coming from <>
across multiple files).


  reply	other threads:[~2026-10-02 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 16:07 [PATCH] doc: don't require a SYNOPSIS in section 7 Julia Evans via GitGitGadget
2026-10-02 17:33 ` Junio C Hamano
2026-10-02 18:03   ` Junio C Hamano
2026-10-02 18:10     ` Julia Evans
2026-10-02 18:20 ` Julia Evans
2026-10-02 21:34   ` Junio C Hamano [this message]
2026-10-03  7:33     ` Tuomas Ahola
2026-10-03 11:37       ` Julia Evans
2026-10-03 12:55         ` Tuomas Ahola
2026-10-03 13:10 ` [PATCH v2] " Julia Evans via GitGitGadget
2026-10-04 13:17   ` Junio C Hamano
2026-10-06 11:17     ` Julia Evans
2026-10-06 16:07       ` Junio C Hamano
2026-10-06 16:54 ` [PATCH v3] " Julia Evans via GitGitGadget
2026-10-06 20:40   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqo6dbvlaf.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=julia@jvns.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox