diff options
| author | David Bremner <david@tethera.net> | 2026-01-25 07:56:40 +0900 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2026-02-16 07:24:18 +0900 |
| commit | 3f51f62eaf44842eb7f67536ff49b0ec972f8fe2 (patch) | |
| tree | d00153df6334e3ec9bd6c63d2268d2c06a51a5bb /git-remote-notmuch.c | |
| parent | b7df6feb9809fa9735141fad01616555f4b21726 (diff) | |
cli/git-remote: add check for missing messages
In cases where a given 'export' both adds and deletes messages, we may
not know what messages are actually missing until the end of
processing. We thus do single pass of all remaining message-ids, and
report any that are still missing at the end of the "export"
operation.
Diffstat (limited to 'git-remote-notmuch.c')
| -rw-r--r-- | git-remote-notmuch.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c index a81c969e..33ded395 100644 --- a/git-remote-notmuch.c +++ b/git-remote-notmuch.c @@ -470,8 +470,39 @@ purge_database (notmuch_database_t *notmuch, GHashTable *msg_state) } static void -check_missing (unused (notmuch_database_t *notmuch), unused (GHashTable *mid_state)) +check_missing (notmuch_database_t *notmuch, GHashTable *mid_state) { + notmuch_status_t status; + notmuch_bool_t strict; + gpointer key, value; + + GHashTableIter iter; + int count = 0; + + status = notmuch_config_get_bool (notmuch, + NOTMUCH_CONFIG_GIT_FAIL_ON_MISSING, + &strict); + if (print_status_database ("config_get_bool", notmuch, status)) + exit (EXIT_FAILURE); + + g_hash_table_iter_init (&iter, mid_state); + while (g_hash_table_iter_next (&iter, &key, &value)) { + if (GPOINTER_TO_INT (value) != MSG_STATE_MISSING) + continue; + + fprintf (stderr, "%c: missing mid %s\n", strict ? 'E' : 'W', (const char *) key); + flog ("%c: missing mid %s\n", strict ? 'E' : 'W', (const char *) key); + count++; + } + + if (count > 0) { + if (strict) { + fprintf (stderr, "E: %d missing messages\n", count); + exit (1); + } else { + flog ("I: ignoring missing messages\n"); + } + } } static void |
