Permalink
Browse files

Recursive delete function to get rid of whole thread

  • Loading branch information...
singpolyma committed Jul 24, 2009
1 parent 3cf7658 commit df553569b7415e2a2041bd543ec53cefdc6fe1ae
Showing with 26 additions and 3 deletions.
  1. +10 −2 bin/git-ticket-close
  2. +16 −1 bin/git-ticket-list
View
@@ -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
View
@@ -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

0 comments on commit df55356

Please sign in to comment.