mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #1123
- Fixed bug #1123, which caused the undo of a 'log' command to corrupt the data file (thanks to Tim None).
This commit is contained in:
parent
4e03832b68
commit
6ce3a8e27f
3 changed files with 27 additions and 13 deletions
1
AUTHORS
1
AUTHORS
|
@ -160,4 +160,5 @@ suggestions:
|
|||
Jake Bell
|
||||
Florian Hollerweger
|
||||
Thomas Sullivan
|
||||
Tim None
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ Bugs
|
|||
+ Fixed bug #1065, where CmdShow issued messages in incorrect situations.
|
||||
+ Partially fixed #1083, which showed 'task 0 ...' when modifying a non-
|
||||
pending task (thanks to Aikido Guy).
|
||||
+ Fixed bug #1123, which caused the undo of a 'log' command to corrupt the data
|
||||
file (thanks to Tim None).
|
||||
+ No more bash completion of, for example, 'projABC:', or of 'proj:' if
|
||||
abbreviation.minimum is greater than 4.
|
||||
+ Fixed bug where shadow files are not properly created when there is a missing
|
||||
|
|
21
src/TDB2.cpp
21
src/TDB2.cpp
|
@ -1576,10 +1576,13 @@ void TDB2::revert ()
|
|||
{
|
||||
context.debug ("TDB::undo - task found in completed.data");
|
||||
|
||||
// If task now belongs back in pending.data
|
||||
if (prior.find ("status:\"pending\"") != std::string::npos ||
|
||||
prior.find ("status:\"waiting\"") != std::string::npos ||
|
||||
prior.find ("status:\"recurring\"") != std::string::npos)
|
||||
// Either revert if there was a prior state, or remove the task.
|
||||
if (prior != "")
|
||||
{
|
||||
*task = prior;
|
||||
if (task->find ("status:\"pending\"") != std::string::npos ||
|
||||
task->find ("status:\"waiting\"") != std::string::npos ||
|
||||
task->find ("status:\"recurring\"") != std::string::npos)
|
||||
{
|
||||
c.erase (task);
|
||||
p.push_back (prior);
|
||||
|
@ -1591,12 +1594,20 @@ void TDB2::revert ()
|
|||
}
|
||||
else
|
||||
{
|
||||
*task = prior;
|
||||
File::write (completed._file._data, c);
|
||||
File::write (undo._file._data, u);
|
||||
std::cout << STRING_TDB2_REVERTED << "\n";
|
||||
context.debug ("TDB::undo - task belongs in completed.data");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c.erase (task);
|
||||
File::write (completed._file._data, c);
|
||||
File::write (undo._file._data, u);
|
||||
std::cout << STRING_TDB2_REVERTED << "\n";
|
||||
context.debug ("TDB::undo - task removed");
|
||||
}
|
||||
|
||||
std::cout << STRING_TDB2_UNDO_COMPLETE << "\n";
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue