taskwarrior
taskwarrior copied to clipboard
Test modification of a task by an on-add hook (test case for #3416)
This PR adds a test case that shows the bug described in #3416. I confirmed it fails on current develop.
I think the bug's root cause is https://github.com/GothenburgBitFactory/taskwarrior/commit/5bb98579841d41e680280ada7bf3a3e9a9940553#r141727451.
For a fix:
TBD2::update()
as a method was removed in the referenced commit. And it seems calling TBD2::modify()
instead will fire on-modify hooks when saving changes by on-add to the database. That's about as far as I got, I hope this contribution will help someone else make progress.
Hmm, the simplest fix is reordering the on-add hook invocation before the save. That fixes the issue while passing the test suite. However, I don't know if it is the behaviour that you want. Anything more complicated is beyond my affinity with C++.
On a related note, https://github.com/GothenburgBitFactory/taskwarrior/pull/3443/commits/3e14d92a4272a48d981b5b3a3dbaa2286d01e2e5 is a copy of https://github.com/GothenburgBitFactory/taskwarrior/blob/develop/scripts/hooks/on-add.the with some added comments.
This also fixes #3455! Can you take a look at #3457 for me before I merge it?