From df553569b7415e2a2041bd543ec53cefdc6fe1ae Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 23 Jul 2009 18:23:46 -0700 Subject: [PATCH] Recursive delete function to get rid of whole thread --- bin/git-ticket-close | 12 ++++++++++-- bin/git-ticket-list | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bin/git-ticket-close b/bin/git-ticket-close index c1e1d6d..8121efc 100755 --- a/bin/git-ticket-close +++ b/bin/git-ticket-close @@ -70,8 +70,16 @@ git add "$TICKET" if [ "$COMMIT" -eq 1 ]; then git commit -em"Closes: $*" if [ "$DELETE" -eq 1 ]; then - git rm "$TICKET" - T="`git rm "$TICKET"-* 2>&1`" + rm_thread() { + IFS=" +" + for LINE in `git ticket list comments "$1"`; do + rm_thread "$LINE" + done + IFS=" " + git rm "$1" + } + rm_thread "$TICKET" cd .. git commit -m"Remove closed ticket $*" fi diff --git a/bin/git-ticket-list b/bin/git-ticket-list index 04a5143..1e04aa0 100755 --- a/bin/git-ticket-list +++ b/bin/git-ticket-list @@ -10,5 +10,20 @@ fi if [ -d .tickets ]; then cd .tickets - grep -vil 'In-Reply-To' * | grep -v current + + case "$1" in + comments) + shift + if [ -z "$*" -o ! -f "$*" ]; then + echo "You must specify a valid ticket or comment." 1>&2 + exit 1 + fi + MESSAGEID="`grep -i Message-Id < "$*" | cut -d':' -f2 | sed -e's/^ *//'`" + grep -il "^In-Reply-To: $MESSAGEID$" * + ;; + *) + grep -vil '^In-Reply-To:' * | grep -v current + ;; + esac + fi