diff --git a/ChangeLog b/ChangeLog index 85071a004..1a32805b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ + Supports '--' argument to indicate that all subsequence arguments are part of the description, despite what they otherwise might mean. + Removed support for the obsolete task file format 1 (never released). + + Fixed bug that allowed blank annotations to be added (thanks to Bruce + Dillahunty), ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index db4939b54..a8aa521f1 100644 --- a/html/task.html +++ b/html/task.html @@ -143,6 +143,8 @@
  • Supports '--' argument to indicate that all subsequence arguments are part of the description, despite what they otherwise might mean.
  • Removed support for the obsolete task file format 1 (never released). +
  • Fixed bug that allowed blank annotations to be added (thanks to Bruce + Dillahunty),

    diff --git a/src/T.cpp b/src/T.cpp index 448be9fc4..213de7815 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -584,16 +584,6 @@ void T::parse (const std::string& line) // If this code is inaccurate, data corruption ensues. int T::determineVersion (const std::string& line) { - // Version 1 looks like: - // - // [tags] [attributes] description\n - // X [tags] [attributes] description\n - // - // Scan for the first character being either the bracket or X. - if ((line[0] == '[' && line[line.length () - 1] != ']') || - line.find ("X [") != std::string::npos) - return 1; - // Version 2 looks like: // // uuid status [tags] [attributes] description\n @@ -627,6 +617,16 @@ int T::determineVersion (const std::string& line) return 2; } + // Version 1 looks like: + // + // [tags] [attributes] description\n + // X [tags] [attributes] description\n + // + // Scan for the first character being either the bracket or X. + else if ((line[0] == '[' && line[line.length () - 1] != ']') || + line.find ("X [") == 0) + return 1; + // Version 4 looks like: // // [name:"value" ...] diff --git a/src/command.cpp b/src/command.cpp index 9f8e7b4a3..ff4076def 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -948,6 +948,9 @@ std::string handleColor (Config& conf) //////////////////////////////////////////////////////////////////////////////// std::string handleAnnotate (TDB& tdb, T& task, Config& conf) { + if (task.getDescription () == "") + throw std::string ("Cannot apply a blank annotation."); + std::stringstream out; std::vector all; tdb.pendingT (all); diff --git a/src/sandbox/Context.cpp b/src/sandbox/Context.cpp index 912ec5f4e..a8095d165 100644 --- a/src/sandbox/Context.cpp +++ b/src/sandbox/Context.cpp @@ -153,6 +153,8 @@ void Context::loadCorrectConfigFile (int argc, char** argv) std::string file = pw->pw_dir; config.createDefault (file); + + // TODO Apply overrides of type: "rc.name:value" } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/tests/bug.annotate.t b/src/tests/bug.annotate.t new file mode 100755 index 000000000..f1b20b4aa --- /dev/null +++ b/src/tests/bug.annotate.t @@ -0,0 +1,54 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2009, Paul Beckingham. +## All rights reserved. +## +## 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 Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 4; + +# Create the rc file. +if (open my $fh, '>', 'bug_annotate.rc') +{ + print $fh "data.location=.\n"; + close $fh; + ok (-r 'bug_annotate.rc', 'Created bug_annotate.rc'); +} + +# Attempt a blank annotation. +qx{../task rc:bug_annotate.rc add foo}; +my $output = qx{../task rc:bug_annotate.rc 1 annotate}; +like ($output, qr/Cannot apply a blank annotation./, 'failed on blank annotation'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'bug_annotate.rc'; +ok (!-r 'bug_annotate.rc', 'Removed bug_annotate.rc'); + +exit 0; +