On Sun, Jun 27, 2021 at 12:18 PM David Bremner <da...@tethera.net> wrote:
> Felipe Contreras <felipe.contre...@gmail.com> writes:
> > That way we don't need pass them to the query object ourselves.
> I have applied this change to master. As we discussed previously, I
> prefer to leave the sort order explicit in the tests.

OK. I still maintain that I see no point in doing this.

Just to find out what would happen if in the future the default
changed, I used NOTMUCH_SORT_UNSORTED instead of
NOTMUCH_SORT_NEWEST_FIRST in just two places and the result is 32
tests failing.

That does *not* include T395-ruby.sh.

In order for the ruby tests to fail the default in notmuch-search.c
has to be different from the default in lib/query.cc--I don't know why
notmuch-search.c doesn't use the true default.

But these are the tests that are *already* in the master branch. My
changes would not make the situation significantly worse.

I think if we really wanted to make the tests (and the binaries) truly
sort-agnostic, a lot more work is needed--and that's mostly orthogonal
to the changes I proposed to the ruby tests.

diff --git a/lib/query.cc b/lib/query.cc
index 792aba21..b618bf42 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -107,7 +107,7 @@ notmuch_query_create (notmuch_database_t *notmuch,

     query->query_string = talloc_strdup (query, query_string);

-    query->sort = NOTMUCH_SORT_NEWEST_FIRST;
+    query->sort = NOTMUCH_SORT_UNSORTED;

     query->exclude_terms = _notmuch_string_list_create (query);

diff --git a/notmuch-search.c b/notmuch-search.c
index 244817a9..83329a4d 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -770,7 +770,7 @@ _notmuch_search_cleanup (search_context_t *ctx)
 static search_context_t search_context = {
     .format_sel = NOTMUCH_FORMAT_TEXT,
     .exclude = NOTMUCH_EXCLUDE_TRUE,
     .output = 0,
     .offset = 0,
     .limit = -1, /* unlimited */

Felipe Contreras
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to