On Wed, Sep 16, 2020 at 03:52:16PM -0700, Junio C Hamano wrote: > >> Adding a command-line option for "all" is a good idea, but will probably > >> mean needing to add the "unset" sentinel value I mentioned in the other > >> email. > > > > Sorry, I do not quite follow. I thought that assigning the > > (misnamed --- see other mail) ALL to the "family" variable would be > > sufficient? > > > > enum transport_family { > > TRANSPORT_FAMILY_ALL = 0, > > TRANSPORT_FAMILY_IPV4, > > TRANSPORT_FAMILY_IPV6 > > }; > > Ah, I see. We want a way to tell "nobody has set it from the command > line or the config" and "we were explicitly told to accept any" > apart. > > But wouldn't the usual "read config first and then override from the > command line" handle that without "not yet set" value? I thought we > by default accept any. It would, if each individual program does it in that order. But that means every caller of the transport code needs to be updated to handle the config. That might not be that bad (after all, they have to take --ipv6 etc, options, and I guess they'd need a new "any" option). My suggestion elsewhere was to have an "unset" value, and then resolve it at the time-of-use, something like: diff --git a/transport.c b/transport.c index 43e24bf1e5..6414a847ae 100644 --- a/transport.c +++ b/transport.c @@ -248,6 +248,9 @@ static int connect_setup(struct transport *transport, int for_push) if (data->conn) return 0; + if (transport->family == TRANSPORT_FAMILY_UNSET) + transport->family = transport_family_config; + switch (transport->family) { case TRANSPORT_FAMILY_ALL: break; case TRANSPORT_FAMILY_IPV4: flags |= CONNECT_IPV4; break; but I am happy either way as long as the code does the right thing. -Peff