{"thread":{"id":"33127","subject":"[PATCH 08/19] fixing typo","startedAt":"2013-03-09T19:26:13Z","lastAt":"2013-03-09T19:26:13Z","messageCount":1,"participants":["Paul Campbell"],"isPatch":true,"patchVersion":1,"patchTotal":19},"messages":[{"id":"210915","messageId":"CALeLG_kcJy4ksL5YVRpUoOvCTkS9J2WvDeT64fnb668H+X6pAA@mail.gmail.com","threadId":"33127","inReplyTo":null,"subject":"[PATCH 08/19] fixing typo","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-09T19:26:13Z","receivedAt":"2013-03-09T19:26:13Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":">From 8f6eb2ddfcaef888dc3d3ea4d089aa2e9cad5d0f Mon Sep 17 00:00:00 2001\nFrom: Paul Campbell <pcampbell@kemitix.net>\nDate: Sat, 9 Mar 2013 18:32:53 +0000\nSubject: [PATCH 08/19] fixing typo\n\nConflicts:\n\tgit-subtree.sh\n\nAdd diff command\n\nOriginal-Author: mhoffman <matt.hoffman@quantumretail.com>\nConflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 34 +++++++++++++++++++++++++++++++++-\n 1 file changed, 33 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex ae9f87f..4c3f3c0 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -16,6 +16,7 @@ git subtree pull-all\n git subtree push-all\n git subtree push  --prefix=<prefix> <repository> <refspec...>\n git subtree split --prefix=<prefix> <commit...>\n+git subtree diff  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree from-submodule --prefix=<prefix>\n --\n h,help        show the help\n@@ -105,8 +106,8 @@ command=\"$1\"\n shift\n case \"$command\" in\n \tadd|merge|pull|from-submodule|pull-all|push-all) default= ;;\n-\tsplit|push) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n+    split|push|diff) default=\"--default HEAD\" ;;\n esac\n\n if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" ]; then\n@@ -737,6 +738,37 @@ cmd_pull()\n \tfi\n }\n\n+cmd_diff()\n+{\n+    if [ -e \"$dir\" ]; then\n+        if [ $# -eq 1 ]; then\n+            repository=$(git config -f .gittrees subtree.$prefix.url)\n+            refspec=$1\n+        elif [ $# -eq 2 ]; then\n+            repository=$1\n+            refspec=$2\n+        else\n+            repository=$(git config -f .gittrees subtree.$prefix.url)\n+            refspec=$(git config -f .gittrees subtree.$prefix.branch)\n+        fi\n+        # this is ugly, but I don't know of a better way to do it. My\ngit-fu is weak.\n+        # git diff-tree expects a treeish, but I have only a\nrepository and branch name.\n+        # I don't know how to turn that into a treeish without\ncreating a remote.\n+        # Please change this if you know a better way!\n+        tmp_remote=__diff-tmp\n+        git remote rm $tmp_remote > /dev/null 2>&1\n+        git remote add -t $refspec $tmp_remote $repository > /dev/null\n+        # we fetch as a separate step so we can pass -q (quiet),\nwhich isn't an option for \"git remote\"\n+        # could this instead be \"git fetch -q $repository $refspec\"\nand leave aside creating the remote?\n+        # Still need a treeish for the diff-tree command...\n+        git fetch -q $tmp_remote\n+        git diff-tree -p refs/remotes/$tmp_remote/$refspec\n+        git remote rm $tmp_remote > /dev/null 2>&1\n+    else\n+        die \"Cannot resolve directory '$dir'. Please point to an\nexisting subtree directory to diff. Try 'git subtree add' to add a\nsubtree.\"\n+    fi\n+}\n+\n cmd_push()\n {\n \tif [ $# -gt 2 ]; then\n-- \n1.8.2.rc1\n\n\n-- \nPaul [W] Campbell\n"}]}