Re: [PATCH v16 08/10] imap-send: display port alongwith host when git credential is invoked
- From
Aditya Garg <gargaditya08@live.com>
- Date
- Jun 9, 2025, 19:02 UTC
- Message-ID
- <PN3PR01MB959765D8A6621F155F7C756FB86BA@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
- In-Reply-To
- <xmqq8qm0rbgo.fsf@gitster.g>
Show 13 quoted lines
> On 10 Jun 2025, at 12:26 AM, Junio C Hamano <gitster@pobox.com> wrote: > > Aditya Garg <gargaditya08@live.com> 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.
Show 11 quoted lines
> >> cred->protocol = xstrdup(srvc->use_ssl ? "imaps" : "imap"); >> - cred->host = xstrdup(srvc->host); > > 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.
Show 7 quoted lines
>
>> + cred->host = xstrfmt("%s:%d", srvc->host, srvc->port);
>
>
>>
>> cred->username = xstrdup_or_null(srvc->user);
>> cred->password = xstrdup_or_null(srvc->pass);