git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Stefan Beller <sbeller@google.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 2/4] builtin/blame: dim uninteresting metadata
Date: Sat, 6 Jan 2018 03:26:25 -0500	[thread overview]
Message-ID: <CAPig+cQg3o2iicGhSmwPM8dDjtUFSGow5dwprbRNnq4-m5EmFA@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79ka22DPHX5_etFREvdVjfsQPzQG66iFgyfsjCdLnwUcAdA@mail.gmail.com>

On Thu, Jan 4, 2018 at 5:10 PM, Stefan Beller <sbeller@google.com> wrote:
> On Thu, Dec 28, 2017 at 2:29 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> On Thu, Dec 28, 2017 at 4:03 PM, Stefan Beller <sbeller@google.com> wrote:
>>> +static inline void colors_unset(const char **use_color, const char **reset_color)
>>> +{
>>> +       *use_color = "";
>>> +       *reset_color = "";
>>> +}
>>> +
>>> +static inline void colors_set(const char **use_color, const char **reset_color)
>>> +{
>>> +       *use_color = repeated_meta_color;
>>> +       *reset_color = GIT_COLOR_RESET;
>>> +}
>>
>> I'm not convinced that this colors_unset() / colors_set() /
>> setup_line_color() abstraction is buying much. With this abstraction,
>> I found the code more difficult to reason about than if the colors
>> were just set/unset manually in the code which needs the colors. I
>> *could* perhaps imagine setup_line_color() existing as a separate
>> function since it is slightly more complex than the other two, but as
>> it has only a single caller through all patches, even that may not be
>> sufficient to warrant its existence.
>
> Have you viewed this patch in context of the following patch?
> Originally I was convinced an abstraction was not needed, but
> as the next patch shows, a helper per field seems handy.

I did take the other patch into consideration when making the
observation, and I still found the code more difficult to reason about
than if these minor bits of code had merely been inlined into the
callers. I neglected to mention previously that part of the problem
may be that these function names do not do a good job of conveying
what is being done, thus I repeatedly had to consult the function
implementations while reading callers in order to understand what was
going on.

  reply	other threads:[~2018-01-06  8:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 21:03 [PATCHv2 0/4] blame: (dim rep. metadata lines or fields, decay date coloring) Stefan Beller
2017-12-28 21:03 ` [PATCH 1/4] color.h: document and modernize header Stefan Beller
2017-12-28 22:00   ` Eric Sunshine
2018-01-04 19:49     ` Stefan Beller
2017-12-28 21:03 ` [PATCH 2/4] builtin/blame: dim uninteresting metadata Stefan Beller
2017-12-28 22:29   ` Eric Sunshine
2018-01-04 22:10     ` Stefan Beller
2018-01-06  8:26       ` Eric Sunshine [this message]
2018-01-08 19:38         ` Stefan Beller
2017-12-28 21:03 ` [PATCH 3/4] builtin/blame: add option to color metadata fields separately Stefan Beller
2017-12-28 21:03 ` [PATCH 4/4] builtin/blame: highlight recently changed lines Stefan Beller
2017-12-28 22:45   ` Eric Sunshine
  -- strict thread matches above, loose matches on Subject: below --
2017-11-10  1:09 [RFC PATCH 0/4] blame: (dim rep. metadata lines or fields, decay date coloring) Stefan Beller
2017-11-10  1:10 ` [PATCH 2/4] builtin/blame: dim uninteresting metadata Stefan Beller

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAPig+cQg3o2iicGhSmwPM8dDjtUFSGow5dwprbRNnq4-m5EmFA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).