From: Justin Tobler <jltobler@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com
Subject: Re: [PATCH 1/4] fast-import: add 'abort-if-invalid' mode to '--signed-commits=<mode>'
Date: Wed, 25 Mar 2026 13:03:00 -0500 [thread overview]
Message-ID: <acQeGoBgsLFM7EWp@denethor> (raw)
In-Reply-To: <xmqqpl4syijh.fsf@gitster.g>
On 26/03/24 03:22PM, Junio C Hamano wrote:
> Justin Tobler <jltobler@gmail.com> writes:
>
> > diff --git a/builtin/fast-export.c b/builtin/fast-export.c
> > index 13621b0d6a..dcbc5bc82d 100644
> > --- a/builtin/fast-export.c
> > +++ b/builtin/fast-export.c
> > @@ -822,6 +822,9 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
> > die(_("encountered signed commit %s; use "
> > "--signed-commits=<mode> to handle it"),
> > oid_to_hex(&commit->object.oid));
> > + case SIGN_ABORT_IF_INVALID:
> > + die(_("'abort-if-invalid' is not a valid mode for "
> > + "git fast-export with --signed-commits=<mode>"));
> > case SIGN_STRIP_IF_INVALID:
> > die(_("'strip-if-invalid' is not a valid mode for "
> > "git fast-export with --signed-commits=<mode>"));
>
> There are a few similar hunks in this patch to fast-export, but I am
> not sure what is going on here.
git-fast-export(1) does not support the `{strip,sign,abort}-if-invalid`
mode for the `--signed-{commits,tags}` options. Therefore we die in
cases where we parse this option with an unsupported mode.
> I may be misreading the code, but this error, and the similar one
> for strip-if-invalid that is already there, trigger if the command
> is given "--signed-commits=abort-if-invalid" on its command line,
> and when we see a signed commit in the range we walk to export the
> commits. Why shouldn't the user get the error immediately while the
> command is parsing the command line options? You may be sharing the
> underlying parse_sign_mode() with import side that may support more
> variants, but that is not a good excuse to make these two
>
> git fast-export --signed-commits=abort-if-invalid
> git fast-export --signed-commits=i-dont-know-what-i-am-doing
>
> behave completely differently, no?
Ya, that is a completely fair point. If the mode is unsupported, it
doesn't make sense to wait until we encounter a signed commit/tag to
declare the user provided an invalid signed mode for the command.
> You can either move these "no, these subset of options are not
> available here" to fast-export.c::parse_opt_sign_mode(), or even
> better yet, teach parse_sign_mode() an option to say "hey, you are
> being called from fast-export, so pretend that you have never heard
> of options that are only available on fast-import" and error out
> right there, can't you? Or would it be too _early_ to give errors
> to users?
I think it definately makes sense to move signing mode verification to
be around the same time the option is initially parsed. With this patch
series, the `--signed-commits` and `--signed-tags` options for
git-fast-import(1) will support the same modes. It will only be
git-fast-export(1) that supports a subset of the signing modes. It
should be easy enough to update "fast-export.c:parse_opt_sign_mode()" to
explictly handle the unsupported signing modes upfront.
I'll update in the next version accordingly.
Thanks,
-Justin
next prev parent reply other threads:[~2026-03-25 18:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 21:55 [PATCH 0/4] fast-import: extend signed object handling modes Justin Tobler
2026-03-24 21:55 ` [PATCH 1/4] fast-import: add 'abort-if-invalid' mode to '--signed-commits=<mode>' Justin Tobler
2026-03-24 22:22 ` Junio C Hamano
2026-03-25 18:03 ` Justin Tobler [this message]
2026-03-24 21:55 ` [PATCH 2/4] fast-import: add 'strip-if-invalid' mode to '--signed-tags=<mode>' Justin Tobler
2026-03-24 21:55 ` [PATCH 3/4] fast-import: add 'sign-if-invalid' " Justin Tobler
2026-03-24 21:55 ` [PATCH 4/4] fast-import: add 'abort-if-invalid' " Justin Tobler
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=acQeGoBgsLFM7EWp@denethor \
--to=jltobler@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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