From d6d867c1cface9abb99439466b01fcd7db8452f0 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 18 Nov 2015 08:25:49 -0500 Subject: [PATCH] TW-1658: rc override to non-existent alternate rc quietly uses default - Thanks to David Patrick. - The 'rc:' argument now means 'use all defaults', which assumes 'data.location=~/.task', so this will not work for anyone using a different location. --- ChangeLog | 2 ++ src/CLI2.cpp | 2 +- src/Context.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79a9b8296..c03f7ec24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ blank results (thanks to Jeremy John Reeder). - TW-1582 Wrong urgency for first report after reviving task with "mod status:pending" +- TW-1658 rc override to non-existent alternate rc quietly uses default (thanks + to David Patrick). - TW-1698 tests: 'make test' should exit non-zero if tests failed (thanks to Daniel Shahaf). - TW-1703 When on-modify hook is installed, some messages print UUIDs diff --git a/src/CLI2.cpp b/src/CLI2.cpp index b779f7198..7aaafef89 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -254,7 +254,7 @@ void CLI2::getOverride (int argc, const char** argv, std::string& home, File& rc if (raw == "--") return; - if (raw.length () > 3 && + if (raw.length () >= 3 && raw.substr (0, 3) == "rc:") { rc = raw.substr (3); diff --git a/src/Context.cpp b/src/Context.cpp index 7924a4ab6..40f825ea1 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -683,7 +683,7 @@ void Context::staticInitialization () void Context::createDefaultConfig () { // Do we need to create a default rc? - if (! rc_file.exists ()) + if (rc_file._data != "" && ! rc_file.exists ()) { if (config.getBoolean ("confirmation") && !confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data)))