{"thread":{"id":"33128","subject":"[PATCH 09/19] Adding a \"list\" command","startedAt":"2013-03-09T19:26:37Z","lastAt":"2013-03-09T19:26:37Z","messageCount":1,"participants":["Paul Campbell"],"isPatch":true,"patchVersion":1,"patchTotal":19},"messages":[{"id":"210916","messageId":"CALeLG_nWWbQnmMcKoqtpdLa+7VaxMgjmAr4Y7pPZ98SNO+_05g@mail.gmail.com","threadId":"33128","inReplyTo":null,"subject":"[PATCH 09/19] Adding a \"list\" command","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-09T19:26:37Z","receivedAt":"2013-03-09T19:26:37Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":">From ca1c855c032d88159ed878f68ef2e18640bbd49c Mon Sep 17 00:00:00 2001\nFrom: Paul Campbell <pcampbell@kemitix.net>\nDate: Sat, 9 Mar 2013 18:33:12 +0000\nSubject: [PATCH 09/19] Adding a \"list\" command\n\nConflicts:\n\tgit-subtree.sh\n\nOriginal-Author: mhoffman <matt.hoffman@quantumretail.com>\nConflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 19 +++++++++++++++++--\n 1 file changed, 17 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 4c3f3c0..7d08064 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -107,10 +107,10 @@ shift\n case \"$command\" in\n \tadd|merge|pull|from-submodule|pull-all|push-all) default= ;;\n \t*) die \"Unknown command '$command'\" ;;\n-    split|push|diff) default=\"--default HEAD\" ;;\n+    split|push|diff|list) default=\"--default HEAD\" ;;\n esac\n\n-if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" -a \"$command\" != \"list\" ]; then\n \tdie \"You must provide the --prefix option.\"\n fi\n\n@@ -824,6 +824,21 @@ cmd_from-submodule()\n \trm -rf $tmp_repo\n }\n\n+subtree_list()\n+{\n+    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+    while read path; do\n+        repository=$(git config -f .gittrees subtree.$path.url)\n+        refspec=$(git config -f .gittrees subtree.$path.branch)\n+        echo \"    $path        (merged from $repository branch $refspec) \"\n+    done\n+}\n+\n+cmd_list()\n+{\n+  subtree_list\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"}]}