{"thread":{"id":"33129","subject":"[PATCH 10/19] 'prune' command to clear out stale .gittrees info","startedAt":"2013-03-09T19:27:05Z","lastAt":"2013-03-09T19:27:05Z","messageCount":1,"participants":["Paul Campbell"],"isPatch":true,"patchVersion":1,"patchTotal":19},"messages":[{"id":"210917","messageId":"CALeLG_=fr1WxO3ckpxsSh-LX3oSMJLQU-za2PEF6BR7sschPfA@mail.gmail.com","threadId":"33129","inReplyTo":null,"subject":"[PATCH 10/19] 'prune' command to clear out stale .gittrees info","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-09T19:27:05Z","receivedAt":"2013-03-09T19:27:05Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":">From 1aaa55ff64b3b4d9325568b3bb863748f20c80f3 Mon Sep 17 00:00:00 2001\nFrom: Paul Campbell <pcampbell@kemitix.net>\nDate: Sat, 9 Mar 2013 18:33:33 +0000\nSubject: [PATCH 10/19] 'prune' command to clear out stale .gittrees info\n\nConflicts:\n\tgit-subtree.sh\n\nOriginal-Author: Nate Jones <nate@endot.org>\nConflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 15 +++++++++++++--\n 1 file changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 7d08064..0c41383 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -105,12 +105,12 @@ done\n command=\"$1\"\n shift\n case \"$command\" in\n-\tadd|merge|pull|from-submodule|pull-all|push-all) default= ;;\n+    add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;;\n \t*) die \"Unknown command '$command'\" ;;\n     split|push|diff|list) default=\"--default HEAD\" ;;\n esac\n\n-if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" -a \"$command\" != \"list\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" -a \"$command\" != \"list\" -a \"$command\" != \"prune\" ]; then\n \tdie \"You must provide the --prefix option.\"\n fi\n\n@@ -839,6 +839,17 @@ cmd_list()\n   subtree_list\n }\n\n+cmd_prune()\n+{\n+    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+    while read path; do\n+        if [ ! -e \"$path\" ]; then\n+            echo \"pruning $path\"\n+            git config -f .gittrees --remove-section subtree.$path\n+        fi\n+    done\n+}\n+\n cmd_pull-all()\n {\n     git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n-- \n1.8.2.rc1\n\n\n-- \nPaul [W] Campbell\n"}]}