Don't force imap.host to be set when imap.tunnel is set

The documentation for git-imap-send suggests a tunnel setting such as

  Tunnel = "ssh -q user@server.com /usr/bin/imapd ./Maildir 2> /dev/null"

which works wonderfully and doesn't require a username, password or port
setting.

However, git-imap-send currently requires that the imap.host variable be
set in the config even when it was unused.  This patch changes imap-send
to only require that the imap.host setting is set if imap.tunnel is not
set.  Otherwise, server.host is set to "tunnel" for reporting purposes.

Acked-by: Andy Parkins <andyparkins@gmail.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2008-04-22 06:41:47 -04:00 committed by Junio C Hamano
parent 2498a1ad0b
commit 34b5cd1fe9

View File

@ -1303,9 +1303,12 @@ main(int argc, char **argv)
return 1;
}
if (!server.host) {
if (!server.tunnel) {
fprintf( stderr, "no imap host specified\n" );
return 1;
}
server.host = "tunnel";
}
/* read the messages */
if (!read_message( stdin, &all_msgs )) {