diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2026-04-07 19:44:22 +0300 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2026-04-07 16:44:19 +0300 |
| commit | 30902b7eae5214d435cdacfc483018ccc83953a2 (patch) | |
| tree | 2b0b20b0cd495142f8fce5d493b8b240d88811f2 | |
| parent | 5fde2a01b5ce7542970e708df12bd784bd855a58 (diff) | |
mu-move: default to using old flags
And update tests as well.
| -rw-r--r-- | mu/mu-cmd-move.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/mu/mu-cmd-move.cc b/mu/mu-cmd-move.cc index bdb3983..c0c2ecc 100644 --- a/mu/mu-cmd-move.cc +++ b/mu/mu-cmd-move.cc @@ -1,5 +1,5 @@ /* -** Copyright (C) 2023-2025 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> +** Copyright (C) 2023-2026 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the @@ -61,7 +61,7 @@ Mu::mu_cmd_move(Mu::Store& store, const Options& opts) if (!old_flags) return Err(Error::Code::InvalidArgument, "failed to determine old flags"); - Flags new_flags{}; + Flags new_flags{*old_flags}; if (!opts.move.flags.empty()) { if (auto&& nflags{flags_from_expr(to_string_view(opts.move.flags), *old_flags)}; !nflags) @@ -164,12 +164,24 @@ test_move_dry_run() assert_equal(res->standard_out, dst + '\n'); } - // change maildir + // move to different maildir without flags; should retain old flags for (auto& o : {"o1", "o2"}) assert_valid_result(maildir_mkdir(join_paths(tdir.path(), "testdir", o))); { auto res = run_command0({MU_PROGRAM, "move", "--muhome", tdir.path(), src, + "/o1", "--dry-run"}); + assert_valid_command(res); + // src has ,S flag; moving without --flags should retain it + assert_equal(res->standard_out, + join_paths(testpath, + "o1/cur", "1220863042.12663_1.mindcrime!2,S") + "\n"); + } + + // change maildir + + { + auto res = run_command0({MU_PROGRAM, "move", "--muhome", tdir.path(), src, "/o1", "--flags", "-S+F", "--dry-run"}); assert_valid_command(res); assert_equal(res->standard_out, |
