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
|
Jake Bell
|
||||||
Florian Hollerweger
|
Florian Hollerweger
|
||||||
Thomas Sullivan
|
Thomas Sullivan
|
||||||
|
Tim None
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ Bugs
|
||||||
+ Fixed bug #1065, where CmdShow issued messages in incorrect situations.
|
+ Fixed bug #1065, where CmdShow issued messages in incorrect situations.
|
||||||
+ Partially fixed #1083, which showed 'task 0 ...' when modifying a non-
|
+ Partially fixed #1083, which showed 'task 0 ...' when modifying a non-
|
||||||
pending task (thanks to Aikido Guy).
|
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
|
+ No more bash completion of, for example, 'projABC:', or of 'proj:' if
|
||||||
abbreviation.minimum is greater than 4.
|
abbreviation.minimum is greater than 4.
|
||||||
+ Fixed bug where shadow files are not properly created when there is a missing
|
+ Fixed bug where shadow files are not properly created when there is a missing
|
||||||
|
|
37
src/TDB2.cpp
37
src/TDB2.cpp
|
@ -1576,26 +1576,37 @@ void TDB2::revert ()
|
||||||
{
|
{
|
||||||
context.debug ("TDB::undo - task found in completed.data");
|
context.debug ("TDB::undo - task found in completed.data");
|
||||||
|
|
||||||
// If task now belongs back in pending.data
|
// Either revert if there was a prior state, or remove the task.
|
||||||
if (prior.find ("status:\"pending\"") != std::string::npos ||
|
if (prior != "")
|
||||||
prior.find ("status:\"waiting\"") != std::string::npos ||
|
|
||||||
prior.find ("status:\"recurring\"") != std::string::npos)
|
|
||||||
{
|
{
|
||||||
c.erase (task);
|
*task = prior;
|
||||||
p.push_back (prior);
|
if (task->find ("status:\"pending\"") != std::string::npos ||
|
||||||
File::write (completed._file._data, c);
|
task->find ("status:\"waiting\"") != std::string::npos ||
|
||||||
File::write (pending._file._data, p);
|
task->find ("status:\"recurring\"") != std::string::npos)
|
||||||
File::write (undo._file._data, u);
|
{
|
||||||
std::cout << STRING_TDB2_REVERTED << "\n";
|
c.erase (task);
|
||||||
context.debug ("TDB::undo - task belongs in pending.data");
|
p.push_back (prior);
|
||||||
|
File::write (completed._file._data, c);
|
||||||
|
File::write (pending._file._data, p);
|
||||||
|
File::write (undo._file._data, u);
|
||||||
|
std::cout << STRING_TDB2_REVERTED << "\n";
|
||||||
|
context.debug ("TDB::undo - task belongs in pending.data");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
*task = prior;
|
c.erase (task);
|
||||||
File::write (completed._file._data, c);
|
File::write (completed._file._data, c);
|
||||||
File::write (undo._file._data, u);
|
File::write (undo._file._data, u);
|
||||||
std::cout << STRING_TDB2_REVERTED << "\n";
|
std::cout << STRING_TDB2_REVERTED << "\n";
|
||||||
context.debug ("TDB::undo - task belongs in completed.data");
|
context.debug ("TDB::undo - task removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << STRING_TDB2_UNDO_COMPLETE << "\n";
|
std::cout << STRING_TDB2_UNDO_COMPLETE << "\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue