Replace basic error messages with more helpful ones that guide users
on how to resolve configuration issues. When imap.host or imap.folder
are missing, provide the exact git config commands needed to fix the
problem, along with examples of typical values.
Use the advise() API to display hints in a multi-line format with
proper "hint:" prefixes for each line.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "advice.h"
#include "config.h"
#include "credential.h"
#include "gettext.h"
if (!server.host) {
if (!server.tunnel) {
- fprintf(stderr, "no IMAP host specified\n");
+ error(_("no IMAP host specified"));
+ advise(_("set the IMAP host with 'git config imap.host <host>'.\n"
+ "(e.g., 'git config imap.host imaps://imap.example.com')"));
ret = 1;
goto out;
}
}
if (!server.folder) {
- fprintf(stderr, "no IMAP folder specified\n");
+ error(_("no IMAP folder specified"));
+ advise(_("set the target folder with 'git config imap.folder <folder>'.\n"
+ "(e.g., 'git config imap.folder Drafts')"));
ret = 1;
goto out;
}