From: Junio C Hamano <gitster@pobox.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, vdye@github.com, jonathantanmy@google.com
Subject: Re: [PATCH v2 2/4] builtin/pack-objects.c: avoid redundant NULL check
Date: Tue, 24 May 2022 14:44:37 -0700 [thread overview]
Message-ID: <xmqq8rqqfvwa.fsf@gitster.g> (raw)
In-Reply-To: <2719d33f328e03239cdb2f5cca2fef9a4e9cbb93.1653418457.git.me@ttaylorr.com> (Taylor Blau's message of "Tue, 24 May 2022 14:54:27 -0400")
Taylor Blau <me@ttaylorr.com> writes:
> Before calling `for_each_object_in_pack()`, the caller
> `read_packs_list_from_stdin()` loops through each of the `include_packs`
> and checks that its `->util` pointer (which is used to store the `struct
> packed_git *` itself) is non-NULL.
>
> This check is redundant, because `read_packs_list_from_stdin()` already
> checks that the included packs are non-NULL earlier on in the same
> function (and it does not add any new entries in between).
>
> Remove this check, since it is not doing anything in the meantime.
Will it start doing something soon in a later step?
Oh, did you mean that after the earlier for_each_string_list_item()
iteration over include_packs that died on an item with a NULL .util
member, the code did not do anything to cause this second iteration
over the same list to suddenly start seeing an item with NULL .util?
I am puzzled by the mention of "in the meantime".
The patch itself looks correct, of course.
Thanks.
> Co-authored-by: Victoria Dye <vdye@github.com>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
> builtin/pack-objects.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 014dcd4bc9..ec3193fd95 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -3369,8 +3369,6 @@ static void read_packs_list_from_stdin(void)
>
> for_each_string_list_item(item, &include_packs) {
> struct packed_git *p = item->util;
> - if (!p)
> - die(_("could not find pack '%s'"), item->string);
> for_each_object_in_pack(p,
> add_object_entry_from_pack,
> &revs,
next prev parent reply other threads:[~2022-05-24 21:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 16:23 [PATCH 0/2] pack-objects: fix a pair of MIDX bitmap-related races Taylor Blau
2022-05-13 16:23 ` [PATCH 1/2] pack-bitmap: check preferred pack validity when opening MIDX bitmap Taylor Blau
2022-05-13 18:19 ` Junio C Hamano
2022-05-13 19:55 ` Taylor Blau
2022-05-13 16:23 ` [PATCH 2/2] builtin/pack-objects.c: ensure pack validity from MIDX bitmap objects Taylor Blau
2022-05-13 23:06 ` Jonathan Tan
2022-05-14 13:17 ` Taylor Blau
2022-05-16 6:07 ` Jonathan Tan
2022-05-14 13:34 ` Taylor Blau
2022-05-16 6:11 ` Jonathan Tan
2022-05-24 18:54 ` [PATCH v2 0/4] pack-objects: fix a pair of MIDX bitmap-related races Taylor Blau
2022-05-24 18:54 ` [PATCH v2 1/4] pack-bitmap.c: check preferred pack validity when opening MIDX bitmap Taylor Blau
2022-05-24 19:36 ` Ævar Arnfjörð Bjarmason
2022-05-24 21:38 ` Taylor Blau
2022-05-24 21:51 ` Ævar Arnfjörð Bjarmason
2022-05-24 18:54 ` [PATCH v2 2/4] builtin/pack-objects.c: avoid redundant NULL check Taylor Blau
2022-05-24 21:44 ` Junio C Hamano [this message]
2022-05-25 0:11 ` Taylor Blau
2022-05-24 18:54 ` [PATCH v2 3/4] builtin/pack-objects.c: ensure included `--stdin-packs` exist Taylor Blau
2022-05-24 19:46 ` Ævar Arnfjörð Bjarmason
2022-05-24 21:33 ` Taylor Blau
2022-05-24 21:49 ` Ævar Arnfjörð Bjarmason
2022-05-24 22:03 ` Junio C Hamano
2022-05-25 0:14 ` Taylor Blau
2022-05-26 19:21 ` Victoria Dye
2022-05-26 20:05 ` Taylor Blau
2022-05-24 18:54 ` [PATCH v2 4/4] builtin/pack-objects.c: ensure pack validity from MIDX bitmap objects Taylor Blau
2022-05-24 21:38 ` [PATCH v2 0/4] pack-objects: fix a pair of MIDX bitmap-related races Junio C Hamano
2022-05-25 0:16 ` Taylor Blau
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=xmqq8rqqfvwa.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
--cc=me@ttaylorr.com \
--cc=vdye@github.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).