Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/4] format-rev: learn --abbrev, --color, and --date
Date: Mon, 17 Aug 2026 09:54:58 -0700	[thread overview]
Message-ID: <xmqqa4qk661p.fsf@gitster.g> (raw)
In-Reply-To: <0bd9c642-9e88-4c82-81ee-20fdeb3c2797@app.fastmail.com> (Kristoffer Haugsbakk's message of "Mon, 17 Aug 2026 16:48:54 +0200")

"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

>     static int format_nul_cb(const struct option *option,
>                              const char *arg,
>                              int unset)
>     {
>             struct format_rev_data *data = option->value;
>             data->nul_input = 1;
>             data->nul_output = 1;
>             BUG_ON_OPT_NEG(unset);
>             BUG_ON_OPT_ARG(arg);
>             return 0;
>     }
>
> But this does not have the `NULL` deref. problem since we just
> unconditionally set two boolean values. Still, for readability it’s
> better for these two statements to go at the start. Since they are
> preconditions. I will add this as a patch/commit to the series.

Yeah, it would be a good idea to establish the "validate before
doing anything with the parameters" pattern.

Thanks.

  reply	other threads:[~2026-08-17 16:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 17:23 [PATCH 0/4] format-rev: add --abbrev, --color, and --date kristofferhaugsbakk
2026-08-13 17:23 ` [PATCH 1/4] format-rev: use lower case for opts description kristofferhaugsbakk
2026-08-13 17:23 ` [PATCH 2/4] format-rev: factor option variables into a struct kristofferhaugsbakk
2026-08-13 18:21   ` Junio C Hamano
2026-08-14 10:54     ` Kristoffer Haugsbakk
2026-08-13 17:23 ` [PATCH 3/4] doc: rev-list-options.adoc: factor out --date alts kristofferhaugsbakk
2026-08-13 17:24 ` [PATCH 4/4] format-rev: learn --abbrev, --color, and --date kristofferhaugsbakk
2026-08-15  2:17   ` Junio C Hamano
2026-08-17 14:48     ` Kristoffer Haugsbakk
2026-08-17 16:54       ` Junio C Hamano [this message]
2026-08-18  5:11   ` Kristoffer Haugsbakk
2026-08-18  9:57 ` [PATCH v2 0/5] format-rev: add " kristofferhaugsbakk
2026-08-18  9:57   ` [PATCH v2 1/5] format-rev: use lower case for opts description kristofferhaugsbakk
2026-08-18  9:57   ` [PATCH v2 2/5] format-rev: place BUG calls first in callback kristofferhaugsbakk
2026-08-18  9:57   ` [PATCH v2 3/5] format-rev: factor option variables into a struct kristofferhaugsbakk
2026-08-18  9:57   ` [PATCH v2 4/5] doc: rev-list-options.adoc: factor out --date alts kristofferhaugsbakk
2026-08-18  9:57   ` [PATCH v2 5/5] format-rev: learn --abbrev, --color, and --date kristofferhaugsbakk

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=xmqqa4qk661p.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kristofferhaugsbakk@fastmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox