mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Task: Correctly handle bulk removal of virtual tags/depends attributes
This edge case would happen if a user issued a following command $ task 1 mod depends: or $ task 1 mod tags: which would not perform as expected for tasks with non-empty depends / tags attributes. The problem under the hood is the fact that current synchronization between 'tags" attribute and its constituent decomposed `tag_X` attributes is performed in a way where the set of tags obtained from `tag_X` attributes is taken as the source of truth. If the legacy 'tags:' attribute was set to empty, the fixTags() method would then restore its previous value from the `tag_X` attributes, effectively leading to a no-op. The same happens with dependencies. The fix here is to detect removal of depends and tags attributes, and instead of setting the legacy attributes to empty values, we iteratively remove all tags/dependencies. Closes #2655.
This commit is contained in:
parent
3937f1efb0
commit
d54c7e090e
1 changed files with 13 additions and 0 deletions
13
src/Task.cpp
13
src/Task.cpp
|
@ -2276,6 +2276,19 @@ void Task::modify (modType type, bool text_required /* = false */)
|
|||
value == "''" ||
|
||||
value == "\"\"")
|
||||
{
|
||||
// Special case: Handle bulk removal of 'tags' and 'depends" virtual
|
||||
// attributes
|
||||
if (name == "depends")
|
||||
{
|
||||
for (auto dep: getDependencyUUIDs ())
|
||||
removeDependency(dep);
|
||||
}
|
||||
else if (name == "tags")
|
||||
{
|
||||
for (auto tag: getTags ())
|
||||
removeTag(tag);
|
||||
}
|
||||
|
||||
// ::composeF4 will skip if the value is blank, but the presence of
|
||||
// the attribute will prevent ::validate from applying defaults.
|
||||
if ((has (name) && get (name) != "") ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue