From e33603939b36631e9371b32abe2708941ee6eb20 Mon Sep 17 00:00:00 2001 From: Paul Roub Date: Sun, 8 Jan 2012 12:14:08 -0500 Subject: [PATCH] Fix typo in duplicate removal on archive, per discussion at http://tech.groups.yahoo.com/group/todotxt/message/3775 --- tests/t1900-archive.sh | 34 ++++++++++++++++++++++++++++++++++ todo.sh | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 tests/t1900-archive.sh diff --git a/tests/t1900-archive.sh b/tests/t1900-archive.sh new file mode 100755 index 0000000..5ac9316 --- /dev/null +++ b/tests/t1900-archive.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +test_description='archive functionality + +Ensure we can append items successfully. +' +. ./test-lib.sh + +cat >> todo.txt<>> todo.sh archive +x done +TODO: $HOME/todo.txt archived. +EOF + +test_todo_session 'list after archive' <>> todo.sh ls +4 four +1 one +3 three +2 two +-- +TODO: 4 of 4 tasks shown +EOF + +test_done diff --git a/todo.sh b/todo.sh index 337bbea..f945fa6 100755 --- a/todo.sh +++ b/todo.sh @@ -371,7 +371,7 @@ archive() grep "^x " "$TODO_FILE" >> "$DONE_FILE" sed -i.bak '/^x /d' "$TODO_FILE" cp "$TODO_FILE" "$TMP_FILE" - sed -n 'G; s/\n/&&/; /^\([ ~-]*\n\).*\n\1/d; s/\n//; h; P' "$TMP_FILE" > "$TODO_FILE" + sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P' "$TMP_FILE" > "$TODO_FILE" if [ $TODOTXT_VERBOSE -gt 0 ]; then echo "TODO: $TODO_FILE archived." fi