* [PATCH] imap-send: improve error messages for missing configuration
@ 2025-06-19 8:53 Jörg Thalheim
2025-06-20 0:58 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Jörg Thalheim @ 2025-06-19 8:53 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano
The error message 'no imap store specified' was confusing because
it referred to 'store' when the actual missing configuration was
'imap.folder'. Similarly, the host error message provided no
guidance on how to fix the issue.
Improve both error messages to:
- Clearly state what configuration is missing
- Provide hints showing the exact git config commands needed
- Include examples of typical values
This helps users quickly understand and resolve configuration issues
when using git imap-send.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
imap-send.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 2e812f5a6e..a2d6f6d3f6 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1539,13 +1539,17 @@ int cmd_main(int argc, const char **argv)
server.port = server.use_ssl ? 993 : 143;
if (!server.folder) {
- fprintf(stderr, "no imap store specified\n");
+ fprintf(stderr, "error: no imap folder specified\n");
+ fprintf(stderr, "hint: set the target folder with 'git config imap.folder <folder>'\n");
+ fprintf(stderr, " (e.g., 'git config imap.folder Drafts')\n");
ret = 1;
goto out;
}
if (!server.host) {
if (!server.tunnel) {
- fprintf(stderr, "no imap host specified\n");
+ fprintf(stderr, "error: no imap host specified\n");
+ fprintf(stderr, "hint: set the imap host with 'git config imap.host <host>'\n");
+ fprintf(stderr, " (e.g., 'git config imap.host imaps://imap.example.com')\n");
ret = 1;
goto out;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] imap-send: improve error messages for missing configuration
2025-06-19 8:53 [PATCH] imap-send: improve error messages for missing configuration Jörg Thalheim
@ 2025-06-20 0:58 ` Junio C Hamano
2025-06-20 5:03 ` Aditya Garg
2025-06-20 6:38 ` [PATCH v2 0/2] " Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 0/2] imap-send: improve error messages for missing configuration Joerg Thalheim
2 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2025-06-20 0:58 UTC (permalink / raw)
To: Jörg Thalheim; +Cc: git, Aditya Garg
"Jörg Thalheim" <joerg@thalheim.io> writes:
> The error message 'no imap store specified' was confusing because
> it referred to 'store' when the actual missing configuration was
> 'imap.folder'. Similarly, the host error message provided no
> guidance on how to fix the issue.
>
> Improve both error messages to:
> - Clearly state what configuration is missing
> - Provide hints showing the exact git config commands needed
> - Include examples of typical values
>
> This helps users quickly understand and resolve configuration issues
> when using git imap-send.
>
> Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
> ---
> imap-send.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
It is curious that you are sending usability improvement patches to
imap-send, which I was recently told to be completely broken wrt the
use of imap.folder. Is the claim I heard that it is totally broken
not true after all, I wonder?
In any case, there are some patches in flight that rewrites the
parts of the program this patch wants to update (which addresses
that "completely broken" part and makes the program usable again).
Can you fix the messages on top of that work? By doing
$ git checkout --detach origin/master
$ git merge --no-ff -m 'Merge ag/imap-send-resurrection' adbc0b5d
$ git checkout -b jt/imap-send-error-message-fix
you can prepare the ground and then fix the messages there.
You might want to consider using the advise() API to add the hints,
and please make that a separate patch on top of the "What's imap
store? We call it a folder!" patch.
Thanks.
> diff --git a/imap-send.c b/imap-send.c
> index 2e812f5a6e..a2d6f6d3f6 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -1539,13 +1539,17 @@ int cmd_main(int argc, const char **argv)
> server.port = server.use_ssl ? 993 : 143;
>
> if (!server.folder) {
> - fprintf(stderr, "no imap store specified\n");
> + fprintf(stderr, "error: no imap folder specified\n");
> + fprintf(stderr, "hint: set the target folder with 'git config imap.folder <folder>'\n");
> + fprintf(stderr, " (e.g., 'git config imap.folder Drafts')\n");
> ret = 1;
> goto out;
> }
> if (!server.host) {
> if (!server.tunnel) {
> - fprintf(stderr, "no imap host specified\n");
> + fprintf(stderr, "error: no imap host specified\n");
> + fprintf(stderr, "hint: set the imap host with 'git config imap.host <host>'\n");
> + fprintf(stderr, " (e.g., 'git config imap.host imaps://imap.example.com')\n");
> ret = 1;
> goto out;
> }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] imap-send: improve error messages for missing configuration
2025-06-20 0:58 ` Junio C Hamano
@ 2025-06-20 5:03 ` Aditya Garg
2025-06-20 5:05 ` Aditya Garg
0 siblings, 1 reply; 11+ messages in thread
From: Aditya Garg @ 2025-06-20 5:03 UTC (permalink / raw)
To: Junio C Hamano, Jörg Thalheim; +Cc: git
On 20 June 2025 6:28:32 am IST, Junio C Hamano <gitster@pobox.com> wrote:
>"Jörg Thalheim" <joerg@thalheim.io> writes:
>
>> The error message 'no imap store specified' was confusing because
>> it referred to 'store' when the actual missing configuration was
>> 'imap.folder'. Similarly, the host error message provided no
>> guidance on how to fix the issue.
>>
>> Improve both error messages to:
>> - Clearly state what configuration is missing
>> - Provide hints showing the exact git config commands needed
>> - Include examples of typical values
>>
>> This helps users quickly understand and resolve configuration issues
>> when using git imap-send.
>>
>> Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
>> ---
>> imap-send.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>It is curious that you are sending usability improvement patches to
>imap-send, which I was recently told to be completely broken wrt the
>use of imap.folder. Is the claim I heard that it is totally broken
>not true after all, I wonder?
I assume either the person has used the seen branch, or has not tested the program itself.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] imap-send: improve error messages for missing configuration
2025-06-20 5:03 ` Aditya Garg
@ 2025-06-20 5:05 ` Aditya Garg
0 siblings, 0 replies; 11+ messages in thread
From: Aditya Garg @ 2025-06-20 5:05 UTC (permalink / raw)
To: Junio C Hamano, Jörg Thalheim; +Cc: git
On 20 June 2025 10:33:21 am IST, Aditya Garg <gargaditya08@live.com> wrote:
>
>
>On 20 June 2025 6:28:32 am IST, Junio C Hamano <gitster@pobox.com> wrote:
>>"Jörg Thalheim" <joerg@thalheim.io> writes:
>>
>>> The error message 'no imap store specified' was confusing because
>>> it referred to 'store' when the actual missing configuration was
>>> 'imap.folder'. Similarly, the host error message provided no
>>> guidance on how to fix the issue.
>>>
>>> Improve both error messages to:
>>> - Clearly state what configuration is missing
>>> - Provide hints showing the exact git config commands needed
>>> - Include examples of typical values
>>>
>>> This helps users quickly understand and resolve configuration issues
>>> when using git imap-send.
>>>
>>> Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
>>> ---
>>> imap-send.c | 8 ++++++--
>>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>>It is curious that you are sending usability improvement patches to
>>imap-send, which I was recently told to be completely broken wrt the
>>use of imap.folder. Is the claim I heard that it is totally broken
>>not true after all, I wonder?
>
>I assume either the person has used the seen branch, or has not tested the program itself.
Actually you get the error:
no imap store specified
In the broken imap send irrespective of what you do IIRC. Maybe that's what is being addressed here.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 0/2] imap-send: improve error messages for missing configuration
2025-06-19 8:53 [PATCH] imap-send: improve error messages for missing configuration Jörg Thalheim
2025-06-20 0:58 ` Junio C Hamano
@ 2025-06-20 6:38 ` Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 0/2] imap-send: improve error messages for missing configuration Joerg Thalheim
2 siblings, 2 replies; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 6:38 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
This patch series improves error messages when required IMAP configuration
is missing, making it easier for users to understand and fix the issue.
Changes since v1:
- Rebased on top of ag/imap-send-resurrection branch as requested
- Split into two patches:
* First patch fixes the confusing "store" → "folder" terminology
* Second patch adds configuration hints using advise() API
- Use error() and advise() instead of fprintf() for better integration
with Git's message handling
Thanks to Junio for the helpful feedback on v1.
Jörg Thalheim (2):
imap-send: fix confusing 'store' terminology in error message
imap-send: improve error messages with configuration hints
imap-send.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/2] imap-send: fix confusing 'store' terminology in error message
2025-06-20 6:38 ` [PATCH v2 0/2] " Joerg Thalheim
@ 2025-06-20 6:38 ` Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
1 sibling, 0 replies; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 6:38 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
The error message 'no imap store specified' is misleading because
it refers to 'store' when the actual missing configuration is
'imap.folder'. Update the message to use the correct terminology
that matches the configuration variable name.
This reduces confusion for users who might otherwise look for
non-existent 'imap.store' configuration when they see this error.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
imap-send.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/imap-send.c b/imap-send.c
index ed4c34dadd..33690cd66a 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1831,7 +1831,7 @@ int cmd_main(int argc, const char **argv)
}
if (!server.folder) {
- fprintf(stderr, "no IMAP store specified\n");
+ fprintf(stderr, "no IMAP folder specified\n");
ret = 1;
goto out;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] imap-send: improve error messages with configuration hints
2025-06-20 6:38 ` [PATCH v2 0/2] " Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
@ 2025-06-20 6:38 ` Joerg Thalheim
2025-06-20 15:44 ` Junio C Hamano
1 sibling, 1 reply; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 6:38 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
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.
This uses the advise() API to display hints that can be disabled
by users who don't want them, and error() for the main error message.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
imap-send.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 33690cd66a..e4613aa236 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -25,6 +25,7 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "advice.h"
#include "config.h"
#include "credential.h"
#include "gettext.h"
@@ -1811,7 +1812,9 @@ int cmd_main(int argc, const char **argv)
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>'"));
+ advise(_("(e.g., 'git config imap.host imaps://imap.example.com')"));
ret = 1;
goto out;
}
@@ -1831,7 +1834,9 @@ int cmd_main(int argc, const char **argv)
}
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>'"));
+ advise(_("(e.g., 'git config imap.folder Drafts')"));
ret = 1;
goto out;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] imap-send: improve error messages with configuration hints
2025-06-20 6:38 ` [PATCH v2 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
@ 2025-06-20 15:44 ` Junio C Hamano
0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2025-06-20 15:44 UTC (permalink / raw)
To: Joerg Thalheim; +Cc: git, Patrick Steinhardt, Aditya Garg
Joerg Thalheim <joerg@thalheim.io> writes:
> From: Jörg Thalheim <joerg@thalheim.io>
>
> 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.
>
> This uses the advise() API to display hints that can be disabled
> by users who don't want them,
Not quite. We do not encourage or condone wholesale disabling of
all advise messages by end users. The advice_if_enabled() helper
allows selective disabling of individual messages that the user has
seen often enough and find no more need for help, but I do not think
it is advisable (no pun intended) to use it in these particular code
paths, simply because once the relevant configuration variables are
set, the users will not see the errors anymore.
The reason advise() was suggested was primarily because of its
better handling of multi-line messages. It can be fed a multi-line
message (i.e., with embedded LF in it), and give "hint:" prefix to
each line, which is lacking from the error(), warning(), die() family
of messaging functions.
> + error(_("no IMAP host specified"));
> + advise(_("set the IMAP host with 'git config imap.host <host>'"));
> + advise(_("(e.g., 'git config imap.host imaps://imap.example.com')"));
Give a single multi-line message to a single advise() call, i.e.,
advice(_("set the IMAP host with ... <host>'.\n"
"(e.g., 'git config ....com')"));
instead of two back-to-back calls to advise. It allows the
translators to find points to break lines better than the programmer
who wrote these advise() call(s).
> @@ -1831,7 +1834,9 @@ int cmd_main(int argc, const char **argv)
> }
>
> 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>'"));
> + advise(_("(e.g., 'git config imap.folder Drafts')"));
Ditto.
As a #leftoverbit we might want to inspect many fprintf(stderr)
still remain in this program after this patch and turn them into
calls to appropriate error() or warning() or whatever, but that
certainly would be outside the scope of this patch.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 0/2] imap-send: improve error messages for missing configuration
2025-06-19 8:53 [PATCH] imap-send: improve error messages for missing configuration Jörg Thalheim
2025-06-20 0:58 ` Junio C Hamano
2025-06-20 6:38 ` [PATCH v2 0/2] " Joerg Thalheim
@ 2025-06-20 15:56 ` Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
2 siblings, 2 replies; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 15:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
This patch series improves error messages when required IMAP configuration
is missing, making it easier for users to understand and fix the issue.
Changes since v2:
- Use single advise() calls with multi-line strings instead of multiple
calls, as suggested by Junio
- Simplified commit message explanation about advise() API
Changes since v1:
- Rebased on top of ag/imap-send-resurrection branch
- Split into two patches:
* First patch fixes the confusing "store" → "folder" terminology
* Second patch adds configuration hints using advise() API
- Use error() and advise() instead of fprintf()
Thanks to Junio for the helpful reviews.
Jörg Thalheim (2):
imap-send: fix confusing 'store' terminology in error message
imap-send: improve error messages with configuration hints
imap-send.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] imap-send: fix confusing 'store' terminology in error message
2025-06-20 15:56 ` [PATCH v3 0/2] imap-send: improve error messages for missing configuration Joerg Thalheim
@ 2025-06-20 15:56 ` Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
1 sibling, 0 replies; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 15:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
The error message 'no imap store specified' is misleading because
it refers to 'store' when the actual missing configuration is
'imap.folder'. Update the message to use the correct terminology
that matches the configuration variable name.
This reduces confusion for users who might otherwise look for
non-existent 'imap.store' configuration when they see this error.
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
imap-send.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/imap-send.c b/imap-send.c
index ed4c34dadd..33690cd66a 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1831,7 +1831,7 @@ int cmd_main(int argc, const char **argv)
}
if (!server.folder) {
- fprintf(stderr, "no IMAP store specified\n");
+ fprintf(stderr, "no IMAP folder specified\n");
ret = 1;
goto out;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] imap-send: improve error messages with configuration hints
2025-06-20 15:56 ` [PATCH v3 0/2] imap-send: improve error messages for missing configuration Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
@ 2025-06-20 15:56 ` Joerg Thalheim
1 sibling, 0 replies; 11+ messages in thread
From: Joerg Thalheim @ 2025-06-20 15:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Aditya Garg,
Jörg Thalheim
From: Jörg Thalheim <joerg@thalheim.io>
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>
---
imap-send.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 33690cd66a..b6fa90960f 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -25,6 +25,7 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "advice.h"
#include "config.h"
#include "credential.h"
#include "gettext.h"
@@ -1811,7 +1812,9 @@ int cmd_main(int argc, const char **argv)
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;
}
@@ -1831,7 +1834,9 @@ int cmd_main(int argc, const char **argv)
}
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;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-06-20 15:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 8:53 [PATCH] imap-send: improve error messages for missing configuration Jörg Thalheim
2025-06-20 0:58 ` Junio C Hamano
2025-06-20 5:03 ` Aditya Garg
2025-06-20 5:05 ` Aditya Garg
2025-06-20 6:38 ` [PATCH v2 0/2] " Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
2025-06-20 6:38 ` [PATCH v2 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
2025-06-20 15:44 ` Junio C Hamano
2025-06-20 15:56 ` [PATCH v3 0/2] imap-send: improve error messages for missing configuration Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 1/2] imap-send: fix confusing 'store' terminology in error message Joerg Thalheim
2025-06-20 15:56 ` [PATCH v3 2/2] imap-send: improve error messages with configuration hints Joerg Thalheim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).