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-17 23:45:21 +0300 |
| commit | 5fa56d92d12a8864313a4d5c5dd1a3c43eb895ad (patch) | |
| tree | 0f5ab3082d071614fb76db9848e1195dc4265719 | |
| parent | ccd338ba8f4ade3109d065ee4f9373da33914377 (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, |
