From: Junio C Hamano Date: Mon, 14 Apr 2025 20:41:27 GMT Subject: Re: [PATCH v2 1/8] pack-objects: use standard option incompatibility functions Message-ID: In-Reply-To: <65bc7e46309712e06a2d743172ea4ec518ee928f.1744661167.git.me@ttaylorr.com> Taylor Blau writes: > pack-objects has a handful of explicit checks for pairs of command-line > options which are mutually incompatible. Many of these pre-date > a699367bb8 (i18n: factorize more 'incompatible options' messages, > 2022-01-31). > > Convert the explicit checks into die_for_incompatible_opt2() calls, > which simplifies the implementation and standardizes pack-objects' > output when given incompatible options (e.g., --stdin-packs with > --filter gives different output than --keep-unreachable with > --unpack-unreachable). Makes sense. > - if (stdin_packs && filter_options.choice) > - die(_("cannot use --filter with --stdin-packs")); > + die_for_incompatible_opt2(filter_options.choice, "--filter", > + stdin_packs, "--stdin-packs"); The order of check is now reversed (which does not make any difference to correctness or performance), but this way, we list the options in the same order in the message as before, which is nice. > test_must_fail git pack-objects --stdin-packs --stdout \ > --filter=blob:none err && > - test_grep "cannot use --filter with --stdin-packs" err > + test_grep "options .--filter. and .--stdin-packs. cannot be used together" err > ) > '