Subject: Re: [PATCH 4/7] revision, rev-parse: factorize incompatibility messages about --exclude-hidden

From: Taylor Blau <[email-masked]>
Date: Wed, 6 Dec 2023 14:25:01 -0500

On Wed, Dec 06, 2023 at 06:07:29PM +0100, René Scharfe wrote:
> > It's not perfect
> > of course, but would at least ensure that we can easily convert things
> > over time without having to duplicate the exact message everywhere.
>
> Maybe the simplest option would be to use a macro, e.g.
>
>    #define INCOMPATIBLE_OPTIONS_MESSAGE \
>            _("options '%s' and '%s' cannot be used together")
>
> It could be used with both error() and die(), and the compiler would
> still ensure that two strings are passed along with it, but I don't know
> how to encode that requirement in the macro name somehow to make it
> self-documenting.  Perhaps by getting the number two in there?

I think that this is a great idea. It nicely solves Patrick's concern
that we have to duplicate this message ID everywhere, and equally solves
yours by calling error() inline instead of having to pass down the
option values.

I think that including a number in the macro name would be helpful here.

> > I don't think it's a problem to not convert everything in one go. The
> > current series is a good step in the right direction, and any additional
> > instances that were missed can be fixed in follow-ups.
>
> Right; whatever we do, we can (and should) do it step by step.

I agree :-).

Thanks,
Taylor