- The bash completion script no longer expands IDs after 'depends:'.
  (Such expansion required running gc() which is not correct.)
- The unit tests for expanding 'depends:' were commented out (and not
  removed) in the case that someday we implement a command to list IDs
  without running gc().
- Unit tests to check that gc() is not run after 'depends:' were added.
This commit is contained in:
Scott Kostyshak 2013-02-18 06:24:47 -05:00 committed by Paul Beckingham
parent c87ce366a9
commit c68b2a149f
4 changed files with 40 additions and 38 deletions

View file

@ -95,6 +95,7 @@ Bugs
+ Integrated latest UTF8 character width calculations from Markus Kuhn. + Integrated latest UTF8 character width calculations from Markus Kuhn.
+ Fixed bug where localized UTF8 strings were not properly substr'd (thanks to + Fixed bug where localized UTF8 strings were not properly substr'd (thanks to
Fidel Mato). Fidel Mato).
+ Fixed a bug where the bash completion script was causing gc() to be run.
------ old releases ------------------------------ ------ old releases ------------------------------

3
NEWS
View file

@ -24,7 +24,8 @@ New configuration options in taskwarrior 2.2.0
Newly deprecated features in taskwarrior 2.2.0 Newly deprecated features in taskwarrior 2.2.0
- - The bash completion script no longer expands IDs after 'depends:'.
(Such expansion required running gc() which is not correct.)
--- ---

View file

@ -62,10 +62,6 @@ _task_get_config() {
$taskcommand _config $taskcommand _config
} }
_task_offer_dependencies() {
COMPREPLY=( $(compgen -W "$($taskcommand _ids)" -- ${cur/*:/}) )
}
_task_offer_priorities() { _task_offer_priorities() {
COMPREPLY=( $(compgen -W "L M H" -- ${cur/*:/}) ) COMPREPLY=( $(compgen -W "L M H" -- ${cur/*:/}) )
} }
@ -94,17 +90,11 @@ _task()
abbrev_min=$($taskcommand show | grep "abbreviation.minimum" | awk {'print $2'}) abbrev_min=$($taskcommand show | grep "abbreviation.minimum" | awk {'print $2'})
commands_aliases=$(echo $($taskcommand _commands; $taskcommand _aliases) | tr " " "\n"|sort|tr "\n" " ") commands_aliases=$(echo $($taskcommand _commands; $taskcommand _aliases) | tr " " "\n"|sort|tr "\n" " ")
opts="$commands_aliases $($taskcommand _ids) $($taskcommand _columns)" opts="$commands_aliases $($taskcommand _columns)"
case "${prev}" in case "${prev}" in
:) :)
case "${prev2}" in case "${prev2}" in
dep|depe|depen|depend|depends)
if [ ${#prev2} -ge $abbrev_min ]; then
_task_offer_dependencies
fi
return 0
;;
pri|prior|priori|priorit|priority) pri|prior|priori|priorit|priority)
if [ ${#prev2} -ge $abbrev_min ]; then if [ ${#prev2} -ge $abbrev_min ]; then
_task_offer_priorities _task_offer_priorities
@ -136,12 +126,6 @@ _task()
;; ;;
:) :)
case "${prev}" in case "${prev}" in
dep|depe|depen|depend|depends)
if [ ${#prev} -ge $abbrev_min ]; then
_task_offer_dependencies
fi
return 0
;;
pri|prior|priori|priorit|priority) pri|prior|priori|priorit|priority)
if [ ${#prev} -ge $abbrev_min ]; then if [ ${#prev} -ge $abbrev_min ]; then
_task_offer_priorities _task_offer_priorities

View file

@ -102,31 +102,47 @@ $output = qx{bash ./task.sh task proj : to 2>&1};
ok ($? == 0, 'Exit status check'); ok ($? == 0, 'Exit status check');
unlike ($output, qr/todd/, '\'proj:\' does not expand if abbreviation.minimum is 5'); unlike ($output, qr/todd/, '\'proj:\' does not expand if abbreviation.minimum is 5');
# "priority:" should be expanded correctly and dependent on abbreviation.minimum # The following tests were removed because we no longer expand task IDs after
$output = qx{bash ./task.sh task priorABC : 2>&1}; # depends. This expansion was stopped because it was using the _ids command
ok ($? == 0, 'Exit status check'); # which runs _ids and can lead to confusing behavior for the user. See:
unlike ($output, qr/H/, '\'priorABC:\' does not expand'); # https://groups.google.com/forum/#!topic/taskwarrior-dev/KwHnb9MOOqA
$output = qx{bash ./task.sh task prior : 2>&1}; ## "priority:" should be expanded correctly and dependent on abbreviation.minimum
ok ($? == 0, 'Exit status check'); #$output = qx{bash ./task.sh task priorABC : 2>&1};
like ($output, qr/H/, '\'prior:\' does expand'); #ok ($? == 0, 'Exit status check');
#unlike ($output, qr/H/, '\'priorABC:\' does not expand');
#
#$output = qx{bash ./task.sh task prior : 2>&1};
#ok ($? == 0, 'Exit status check');
#like ($output, qr/H/, '\'prior:\' does expand');
#
#$output = qx{bash ./task.sh task prio : 2>&1};
#ok ($? == 0, 'Exit status check');
#unlike ($output, qr/H/, '\'prio:\' does not expand if abbreviation.minimum is 5');
#
## "depends:" should be expanded correctly and dependent on abbreviation.minimum
#$output = qx{bash ./task.sh task depenABC : 2>&1};
#ok ($? == 0, 'Exit status check');
#unlike ($output, qr/1/, '\'depenABC:\' does not expand');
#
#$output = qx{bash ./task.sh task depen : 2>&1};
#ok ($? == 0, 'Exit status check');
#like ($output, qr/1/, '\'depen:\' does expand');
#
#$output = qx{bash ./task.sh task depe : 2>&1};
#ok ($? == 0, 'Exit status check');
#unlike ($output, qr/1/, '\'depe:\' does not expand if abbreviation.minimum is 5');
$output = qx{bash ./task.sh task prio : 2>&1}; # there should be no gc coming from bash completion
qx{../src/task rc:bug.rc add this task should be number 2 and stay number 2 2>&1};
ok ($? == 0, 'Exit status check'); ok ($? == 0, 'Exit status check');
unlike ($output, qr/H/, '\'prio:\' does not expand if abbreviation.minimum is 5'); qx{../src/task rc:bug.rc rc.confirmation:off 1 delete 2>&1};
# "depends:" should be expanded correctly and dependent on abbreviation.minimum
$output = qx{bash ./task.sh task depenABC : 2>&1};
ok ($? == 0, 'Exit status check'); ok ($? == 0, 'Exit status check');
unlike ($output, qr/1/, '\'depenABC:\' does not expand'); qx{bash ./task.sh task depends : 2>&1};
$output = qx{bash ./task.sh task depen : 2>&1};
ok ($? == 0, 'Exit status check'); ok ($? == 0, 'Exit status check');
like ($output, qr/1/, '\'depen:\' does expand'); $output = qx{../src/task rc:bug.rc rc.confirmation:off 2 modify shouldreplacetext 2>&1};
ok ($? == 0, 'Should exit with 0 because task should exist');
$output = qx{bash ./task.sh task depe : 2>&1}; like ($output, qr/shouldreplacetext/, 'no gc was run');
ok ($? == 0, 'Exit status check');
unlike ($output, qr/1/, '\'depe:\' does not expand if abbreviation.minimum is 5');
# Cleanup. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc task.sh); unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc task.sh);