[RFC PATCH] cli: default entire-thread to false for all output formats

Jani Nikula jani at nikula.org
Tue Sep 19 13:50:36 PDT 2017


It's arguably bad design to have otherwise completely orthogonal
arguments depend on each other. I suppose defaulting entire-thread to
true for formatted output was considered a convenience, but what it
really does is make the implementation and testing unnecessarily
complicated.

Default entire-thread to false for all output formats, including json
and sexp.

This of course breaks a bunch of tests which depends on the current
default. I'm not really sure if we can ever do a change like this
without making people angry. But I like the simplification in code...
---
 notmuch-show.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index cdcc2a982bd9..c10b0c098bed 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1087,9 +1087,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     int format = NOTMUCH_FORMAT_NOT_SPECIFIED;
     int exclude = TRUE;
 
-    /* This value corresponds to neither true nor false being passed
-     * on the command line */
-    int entire_thread = -1;
     notmuch_bool_t single_message;
 
     notmuch_opt_desc_t options[] = {
@@ -1102,7 +1099,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 				  { 0, 0 } } },
 	{ NOTMUCH_OPT_INT, &notmuch_format_version, "format-version", 0, 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &exclude, "exclude", 'x', 0 },
-	{ NOTMUCH_OPT_BOOLEAN, &entire_thread, "entire-thread", 't', 0 },
+	{ NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },
 	{ NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &params.crypto.decrypt, "decrypt", 'd', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &params.crypto.verify, "verify", 'v', 0 },
@@ -1145,17 +1142,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_exit_if_unsupported_format ();
 
-    /* Default is entire-thread = FALSE except for format=json and
-     * format=sexp. */
-    if (entire_thread != FALSE && entire_thread != TRUE) {
-	if (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP)
-	    params.entire_thread = TRUE;
-	else
-	    params.entire_thread = FALSE;
-    } else {
-	params.entire_thread = entire_thread;
-    }
-
     if (!params.output_body) {
 	if (params.part > 0) {
 	    fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
-- 
2.11.0



More information about the notmuch mailing list