Re: [PATCH 1/3] chainlint.pl: fix line number reporting
- From
Jeff King <peff@peff.net>
- Date
- Jul 8, 2024, 09:10 UTC
- Message-ID
- <20240708091026.GE819809@coredump.intra.peff.net>
- In-Reply-To
- <CAPig+cRxnpG9Yfix09EnJAbnzwN=yoUtSeYxt7S-Od+xBgfaYQ@mail.gmail.com>
On Mon, Jul 08, 2024 at 01:08:02AM -0400, Eric Sunshine wrote:
Show 9 quoted lines
> > I actually suspect the "record the heredoc line number" thing would not
> > be too hard. I.e., turn ShellParser's "heredoc" hash to point to
> > hashrefs like: "{ content => ..., lineno => ... }". And that would give
> > us a good spot to stick an "interpolate" boolean later if we want.
>
> It turned out to be quite easy. See below for an implementation atop
> your patch [1/3] (modulo Gmail whitespace damage). Given how simple
> this ended up being, it probably makes sense to squash this change in,
> as well.Very nice! I was hoping it would be something like this. I've squashed this in, and confirmed that it fixes the line numbers in my "double" case:
test_expect_success "$(cat <<END_OF_PREREQS)" 'here-doc-double' - <<\EOT SOME PREREQS END_OF_PREREQS echo "actual test commands" echo "that should be checked" EOT
The bogus line was incorrectly reported as line 2, because we did not account for the first here-doc.
-Peff