diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 90e9202ba..4411475f5 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -169,7 +169,12 @@ void TDB2::modify (Task& task) update = true; } if (update) { - tctask.set_value(k, make_optional (v_new)); + // An empty string indicates the value should be removed. + if (v_new == "") { + tctask.set_value(k, {}); + } else { + tctask.set_value(k, make_optional (v_new)); + } } } diff --git a/test/tw-3109.t b/test/tw-3109.t new file mode 100644 index 000000000..5375c91ba --- /dev/null +++ b/test/tw-3109.t @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +. bash_tap_tw.sh + +task add emptyval +task 1 done +task 1 mod end: status:pending +task_end=`task 1 info | grep ^End | sed -e 's/^End //' || true` +echo "task_end: $task_end" + +# `task mod end:` should have deleted the end. +[[ "$task_end" == "" ]]