git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Dragan Simic <dsimic@manjaro.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/5] grep: perform some minor code and comment cleanups
Date: Mon, 18 Mar 2024 15:59:41 -0400	[thread overview]
Message-ID: <CAPig+cQ6Y2oOaPkKFsD41beXLHjhD++nmf59xrcswpb6_Q-sdA@mail.gmail.com> (raw)
In-Reply-To: <96b81f3573d3f29bb97e77d623be0d53cf8085b0.1710781235.git.dsimic@manjaro.org>

On Mon, Mar 18, 2024 at 1:04 PM Dragan Simic <dsimic@manjaro.org> wrote:
> Move some variable definitions around, and reflow one comment block, to
> make the code a bit neater after spotting those slightly unpolished areas.
> There are no functional changes to the source code.
>
> Signed-off-by: Dragan Simic <dsimic@manjaro.org>
> ---
> diff --git a/builtin/grep.c b/builtin/grep.c
> @@ -623,13 +623,13 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
> -       struct repository *repo = opt->repo;
> -       int hit = 0;
> +       int hit = 0, name_base_len = 0;
> +       int old_baselen = base->len;
>         enum interesting match = entry_not_interesting;
> +       struct repository *repo = opt->repo;
>         struct name_entry entry;
> -       int old_baselen = base->len;
>         struct strbuf name = STRBUF_INIT;
> -       int name_base_len = 0;
> @@ -890,19 +890,15 @@ static int pattern_callback(const struct option *opt, const char *arg,
> -       int hit = 0;
> +       int hit = 0, seen_dashdash = 0, use_index = 1;
>         int cached = 0, untracked = 0, opt_exclude = -1;
> -       int seen_dashdash = 0;
>         int external_grep_allowed__ignored;
> +       int i, dummy, allow_revs;
>         const char *show_in_pager = NULL, *default_pager = "dummy";
>         struct grep_opt opt;
>         struct object_array list = OBJECT_ARRAY_INIT;
>         struct pathspec pathspec;
>         struct string_list path_list = STRING_LIST_INIT_DUP;
> -       int i;
> -       int dummy;
> -       int use_index = 1;
> -       int allow_revs;

It's entirely subjective, of course, so no right-or-wrong answer, but
I personally do not find that this change improves code quality or
readability.

With my reviewer hat on, I spent an inordinate amount of time staring
at this change trying to locate each variable's new location to verify
that no initializers were dropped and that the declared type hadn't
changed. Taking into consideration that reviewers are a limited
resource on this project, I'd probably have skipped this patch
altogether if I were doing this series unless these changes concretely
help a subsequent patch.

  reply	other threads:[~2024-03-18 19:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 17:03 [PATCH 0/5] New config option for git-grep to include untracked files Dragan Simic
2024-03-18 17:03 ` [PATCH 1/5] grep: perform some minor code and comment cleanups Dragan Simic
2024-03-18 19:59   ` Eric Sunshine [this message]
2024-03-18 22:03     ` Dragan Simic
2024-03-19  0:32     ` Junio C Hamano
2024-03-19  5:33       ` Dragan Simic
2024-03-18 17:03 ` [PATCH 2/5] grep docs: describe --recurse-submodules further and improve formatting a bit Dragan Simic
2024-03-18 20:02   ` Eric Sunshine
2024-03-18 22:14     ` Dragan Simic
2024-03-18 17:03 ` [PATCH 3/5] grep docs: describe --no-index further Dragan Simic
2024-03-19  0:55   ` Junio C Hamano
2024-03-19  5:37     ` Dragan Simic
2024-03-18 17:03 ` [PATCH 4/5] grep: introduce new config option to include untracked files Dragan Simic
2024-03-19  0:58   ` Junio C Hamano
2024-03-19  5:47     ` Dragan Simic
2024-03-19 14:32       ` Junio C Hamano
2024-03-19 14:52         ` Dragan Simic
2024-03-18 17:03 ` [PATCH 5/5] grep docs: describe " Dragan Simic
2024-03-19  0:21 ` [PATCH 0/5] New config option for git-grep " Junio C Hamano
2024-03-19  5:09   ` Dragan Simic
2024-03-19 17:43     ` Junio C Hamano
2024-03-19 17:48       ` Dragan Simic

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=CAPig+cQ6Y2oOaPkKFsD41beXLHjhD++nmf59xrcswpb6_Q-sdA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=dsimic@manjaro.org \
    --cc=git@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).