Subject: Re: [PATCH v16 08/10] imap-send: display port alongwith host when git credential is invoked

From: Junio C Hamano <[email-masked]>
Date: Mon, 09 Jun 2025 13:14:30 -0700

Aditya Garg <[email-masked]> writes:

>> On 10 Jun 2025, at 12:26 AM, Junio C Hamano <[email-masked]> wrote:
>> 
>> Aditya Garg <[email-masked]> writes:
>> 
>>> FWIW, if no port is specified by the user, the default port, 993 for
>>> IMAPS and 143 for IMAP is used by the code. So, the case of no port
>>> defined for the helper is not possible, and therefore is not added.
>> 
>> Shouldn't we do a bit better than being so pessimistic?
>> 
>> If the user left the port unspecified, or if the more knowledgeable
>> user redundantly specified the default port explicitly, showing to
>> such a user :993 for imaps at the end adds no useful information.
>
> Maybe you misunderstood me? I want to show the port explicitly
> just like send-email. I think the FWIW line could be excluded, since
> it's more confusing the useful.

Yeah, I read your FWIW line to be saying "even if we wanted to tell
cases where the user left it unspecified and the user set it to a
value that happens to be the same as the default, we have no way to
tell (unless we add some code to record one more bit, that is), so
we punt and show port regardless."

>> Perhaps something like
>> 
>>    if ((srvc->use_ssl ? 993 : 143) == srvc->port)
>>            cred->host = xstrdup(srvc->host);
>>    else
>> 
>> here?
>
> That will not show the port if we specify the port as 993 as well then.

Yes, that is exactly what I was saying---if the user set it to the
port that is the default anyway, or more importantly, if the user
did not set, it is unnecessary and/or confusing to start showing the
port number.

If the ISP uses something non-standard and the user explicitly sets
it to that port, it may make sense to show it that the user is using
something non-standard.

Having said that, I do not care too much either way---if we prefer
to always show port, that's fine, but then the FWIW part definitely
needs to be rephrased to explain why it makes sense to show even the
default port.

Thanks.