> On 10 Jun 2025, at 12:26 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Aditya Garg <gargaditya08@xxxxxxxx> 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. > >> 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. > >> + cred->host = xstrfmt("%s:%d", srvc->host, srvc->port); > > >> >> cred->username = xstrdup_or_null(srvc->user); >> cred->password = xstrdup_or_null(srvc->pass);