Update "modified" on modification
This commit is contained in:
committed by
Dustin J. Mitchell
parent
a1b64a05ba
commit
6cd5bf1237
@@ -133,6 +133,9 @@ void TDB2::add (Task& task)
|
|||||||
// they have been unmodified for a long time.
|
// they have been unmodified for a long time.
|
||||||
void TDB2::modify (Task& task)
|
void TDB2::modify (Task& task)
|
||||||
{
|
{
|
||||||
|
// All locally modified tasks are timestamped, implicitly overwriting any
|
||||||
|
// changes the user or hooks tried to apply to the "modified" attribute.
|
||||||
|
task.setAsNow ("modified");
|
||||||
task.validate (false);
|
task.validate (false);
|
||||||
auto uuid = task.get ("uuid");
|
auto uuid = task.get ("uuid");
|
||||||
|
|
||||||
|
|||||||
@@ -1826,7 +1826,7 @@ void Task::validate (bool applyDefault /* = true */)
|
|||||||
if ((status == Task::pending) && (get ("end") != ""))
|
if ((status == Task::pending) && (get ("end") != ""))
|
||||||
remove ("end");
|
remove ("end");
|
||||||
|
|
||||||
// Provide an entry date unless user already specified one.
|
// Provide a modified date unless user already specified one.
|
||||||
if (! has ("modified") || get ("modified") == "")
|
if (! has ("modified") || get ("modified") == "")
|
||||||
setAsNow ("modified");
|
setAsNow ("modified");
|
||||||
|
|
||||||
|
|||||||
13
test/tw-3102.t
Executable file
13
test/tw-3102.t
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
. bash_tap_tw.sh
|
||||||
|
|
||||||
|
task add modtest modified:yesterday
|
||||||
|
old_modified=`task _get 1.modified`
|
||||||
|
echo $old_modified
|
||||||
|
|
||||||
|
task 1 start
|
||||||
|
new_modified=`task _get 1.modified`
|
||||||
|
echo $new_modified
|
||||||
|
|
||||||
|
# `task start` should have updated modified
|
||||||
|
[[ $old_modified != $new_modified ]]
|
||||||
Reference in New Issue
Block a user