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

Re: [PATCH 2/3] vimdiff: add tool documentation

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 8, 2021, 01:02 UTC
Message-ID
<CAPig+cSi9S+EdqKLNWDGA76B3kUbvxQHEh2csyZYqX2sf0gztQ@mail.gmail.com>
In-Reply-To
<CAJDDKr4icrigRO-2S_HVdY7+W0EGJ8XBn5dD=O-qy1tXym4u8w@mail.gmail.com>
On Sun, Nov 7, 2021 at 4:25 PM David Aguilar <davvid@gmail.com> wrote:
Show 14 quoted lines
> On Thu, Nov 4, 2021 at 9:10 AM Fernando Ramos <greenfoo@u92.eu> wrote:
> > +                               while IFS= read -r line
> > +                               do
> > +                                       printf "%s\t%s\n" "$per_line_prefix" "$line"
> > +                                done < <(diff_mode && diff_cmd_help "$toolname" || merge_cmd_help "$toolname")
>
> If we wanted to shorten this line a bit, would it work to run the pipeline
> first and pipe the result?
>
>     (diff_mode && ... || merge_cmd_help ...) |
>     while IFS= read -r line
>     do
>        ...
>     done

The additional benefit is that this avoids the `<(...)` Bashism (which you mentioned in your other review).

Show 10 quoted lines
> > +               cat <<-ENDOFMESSAGE
> > +                       Opens vim with two vertical windows: LOCAL changes will be placed in the left
> > +                       window and REMOTE changes in the right one.
> > +               ENDOFMESSAGE
>
> Tiny nit: we call this EOF in the other places
> (git-mergetool--helper.sh) where we do the same.
>
> ENDOFMESSAGE is a bit verbose so it might be worth sticking to the
> conventional EOF marker.
A couple additional really micro nits (take them or leave them)...

We normally don't add extra indentation to the here-doc body, and we use `<<-\EOF` to reduce cognitive load if there's nothing in the body which requires interpolation or expansion. Thus:

    cat <<-\EOF
    Opens vim with two...
    EOF
Previous: David AguilarNext: Junio C Hamano
Message 7 of 9 in “vimdiff: new layout option + docs”
  1. 0/3 vimdiff: new layout option + docsFernando Ramos, Nov 4, 2021
  2. 1/3 vimdiff: new implementation with layout supportFernando Ramos, Nov 4, 2021
  3. David AguilarNov 7, 2021
  4. Eric SunshineNov 8, 2021
  5. 2/3 vimdiff: add tool documentationFernando Ramos, Nov 4, 2021
  6. David AguilarNov 7, 2021
  7. Eric SunshineNov 8, 2021
  8. Junio C HamanoNov 8, 2021
  9. 3/3 vimdiff: remove deprecated {,g,n}vimdiff{1,2,3} variantsFernando Ramos, Nov 4, 2021

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.