From df686e9e31d7429785336485c80002b4571c44c1 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 2 Jun 2024 16:34:26 -0400 Subject: [PATCH 1/2] Only warn about .data files when showing reports This avoids the warning appearing in shell completion, for example. --- src/TDB2.cpp | 8 -------- src/commands/CmdCustom.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/TDB2.cpp b/src/TDB2.cpp index a8c7157dc..e871d4854 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -58,14 +58,6 @@ TDB2::TDB2 () //////////////////////////////////////////////////////////////////////////////// void TDB2::open_replica (const std::string& location, bool create_if_missing) { - File pending_data = File (location + "/pending.data"); - if (pending_data.exists()) { - Color warning = Color (Context::getContext ().config.get ("color.warning")); - std::cerr << warning.colorize ( - format ("Found existing '*.data' files in {1}", location)) << "\n"; - std::cerr << " Taskwarrior's storage format changed in 3.0, requiring a manual migration.\n"; - std::cerr << " See https://github.com/GothenburgBitFactory/taskwarrior/releases.\n"; - } replica = tc::Replica(location, create_if_missing); } diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index d6e1b7503..6fa977c99 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -272,6 +273,16 @@ int CmdCustom::execute (std::string& output) } } + std::string location = (Context::getContext ().data_dir); + File pending_data = File (location + "/pending.data"); + if (pending_data.exists()) { + Color warning = Color (Context::getContext ().config.get ("color.warning")); + std::cerr << warning.colorize ( + format ("Found existing '*.data' files in {1}", location)) << "\n"; + std::cerr << " Taskwarrior's storage format changed in 3.0, requiring a manual migration.\n"; + std::cerr << " See https://github.com/GothenburgBitFactory/taskwarrior/releases.\n"; + std::cerr << " Remove the '*.data' files to silence this warning.\n"; + } feedback_backlog (); output = out.str (); From 946678b67b2920b233f0314ee41be6bd87d27050 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Mon, 10 Jun 2024 13:48:31 -0400 Subject: [PATCH 2/2] Update src/commands/CmdCustom.cpp Co-authored-by: ryneeverett --- src/commands/CmdCustom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 6fa977c99..bb240bf7d 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -281,7 +281,6 @@ int CmdCustom::execute (std::string& output) format ("Found existing '*.data' files in {1}", location)) << "\n"; std::cerr << " Taskwarrior's storage format changed in 3.0, requiring a manual migration.\n"; std::cerr << " See https://github.com/GothenburgBitFactory/taskwarrior/releases.\n"; - std::cerr << " Remove the '*.data' files to silence this warning.\n"; } feedback_backlog ();