All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
	"brian m . carlson" <sandals@crustytoothpaste.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v2 2/2] fast-import: add '--signed-commits=<mode>' option
Date: Mon, 15 Sep 2025 12:56:34 +0200	[thread overview]
Message-ID: <aMfw4rboBOemzvr6@pks.im> (raw)
In-Reply-To: <CAP8UFD3-3zjBBHP-Y9nLO-qEyhkWhD_pxFZhk6rzrC31LanDMQ@mail.gmail.com>

On Mon, Sep 15, 2025 at 12:17:33PM +0200, Christian Couder wrote:
> On Mon, Sep 15, 2025 at 8:27 AM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > On Fri, Sep 12, 2025 at 02:40:42PM +0200, Christian Couder wrote:
> 
> > >
> > > -     /* Process signatures (up to 2: one "sha1" and one "sha256") */
> > >       while (skip_prefix(command_buf.buf, "gpgsig ", &v)) {
> > >               struct signature_data sig = { NULL, NULL, STRBUF_INIT };
> > >
> > > -             parse_one_signature(&sig, v);
> > > +             if (signed_commit_mode == SIGN_ABORT)
> > > +                     die(_("encountered signed commit; use "
> > > +                           "--signed-commits=<mode> to handle it"));
> > >
> > > -             if (!strcmp(sig.hash_algo, "sha1"))
> > > -                     store_signature(&sig_sha1, &sig, "SHA-1");
> > > -             else if (!strcmp(sig.hash_algo, "sha256"))
> > > -                     store_signature(&sig_sha256, &sig, "SHA-256");
> > > -             else
> > > -                     BUG("parse_one_signature() returned unknown hash algo");
> > > +             parse_one_signature(&sig, v);
> > >
> > > +             switch (signed_commit_mode) {
> > > +             case SIGN_ABORT:
> > > +                     BUG("SIGN_ABORT should be handled before calling parse_one_signature()");
> > > +                     break;
> >
> > Let's be defensive and convert this into a `default:` case so that any
> > unhandled value will cause a BUG.
> 
> Ok, maybe something like BUG("invalid signed_commit_mode value %d",
> signed_commit_mode) then?

Yeah, that should do the job.

Thanks!

Patrick

  reply	other threads:[~2025-09-15 10:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 12:40 [PATCH v2 0/2] fast-import: start controlling how commit signatures are handled Christian Couder
2025-09-12 12:40 ` [PATCH v2 1/2] gpg-interface: refactor 'enum sign_mode' parsing Christian Couder
2025-09-12 12:40 ` [PATCH v2 2/2] fast-import: add '--signed-commits=<mode>' option Christian Couder
2025-09-12 12:45   ` Christian Couder
2025-09-15  6:27   ` Patrick Steinhardt
2025-09-15 10:17     ` Christian Couder
2025-09-15 10:56       ` Patrick Steinhardt [this message]
2025-09-17 18:23         ` Christian Couder
2025-09-17 18:14 ` [PATCH v3 0/2] fast-import: start controlling how commit signatures are handled Christian Couder
2025-09-17 18:14   ` [PATCH v3 1/2] gpg-interface: refactor 'enum sign_mode' parsing Christian Couder
2025-09-17 18:14   ` [PATCH v3 2/2] fast-import: add '--signed-commits=<mode>' option Christian Couder

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=aMfw4rboBOemzvr6@pks.im \
    --to=ps@pks.im \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.