{"thread":{"id":"33149","subject":"[PATCH v2 00/23] contrib/subtree: Collected updates","startedAt":"2013-03-10T23:41:08Z","lastAt":"2013-03-24T21:22:30Z","messageCount":33,"participants":["Paul Campbell","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":23},"messages":[{"id":"210989","messageId":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":null,"subject":"[PATCH v2 00/23] contrib/subtree: Collected updates","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:08Z","receivedAt":"2013-03-10T23:41:08Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"A selection of updates to git-subtree were offered to the list in May of \nlast year ($gmane/196667) by Herman van Rink.\n\nAt the time the commits were available as either a single commit or a \nlarge collection of commits and merges to the git-subtree prior to it's\ninclusion in contrib/subtree.\n\nThe following patches take a selection of these commits and rebase them \nagainst the tip of master.\n\nThe git-subtree tests work (make test), but they don't cover any of\nthe new commands added nor the use of the .gittrees file for storing\nthe subtree metadata.\n\nIf I could ask the original contributors to add their Signed-off-by, I\nwould appreciate it.\n\nHowever I don't have current email addresses for four of them: Peter \nJaros, Michael Hart, Paul Cartwright and James Roper. If anyone has \ncurrent email address for any of these, please either forward the \nrelevant patch(es) to them or let me know so I can do so.\n\nHerman van Rink (8):\n  contrib/subtree: Add prune command to OPTS_SPEC\n  contrib/subtree: Remove trailing slash from prefix parameter\n  contrib/subtree: Teach from-submodule to add new subtree to .gittrees\n  contrib/subtree: Document pull-all and push-all\n  contrib/subtree: Document from-submodule and prune commands\n  contrib/subtree: Add missing commands to SYNOPSIS\n  contrib/subtree: Document list command\n  contrib/subtree: Convert spaces to tabs and remove some trailing\n    whitespace\n\nJames Roper (1):\n  contrib/subtree: Teach push to use --force option\n\nMatt Hoffman (6):\n  contrib/subtree: Teach add to store repository & branch in .gittrees\n  contrib/subtree: Rename commands push_all/pull_all to\n    push-all/pull-all\n  contrib/subtree: Teach push and pull to use .gittrees if needed\n  contrib/subtree: Replace invisible carriage return with a visible \\r\n  contrib/subtree: Add command diff\n  contrib/subtree: Add command list\n\nMichael Hart (1):\n  contrib/subtree: Teach push to abort if split fails\n\nNate Jones (1):\n  contrib/subtree: Add command prune\n\nPaul Campbell (2):\n  contrib/subtree: Parameters repository/branch for push/pull are\n    optional\n  contrib/subtree: Fix order of case switches so default case is last\n\nPaul Cartwright (1):\n  contrib/subtree: Fix typo (s/incldued/included/)\n\nPeter Jaros (1):\n  contrib/subtree: Add command from-submodule\n\nbibendi (2):\n  contrib/subtree: Teach push and pull to use .gittrees for defaults\n  contrib/subtree: Add commands pull_all and push_all\n\n contrib/subtree/git-subtree.sh  | 203 ++++++++++++++++++++++++++++++++++++----\n contrib/subtree/git-subtree.txt |  46 +++++++--\n 2 files changed, 222 insertions(+), 27 deletions(-)\n\n-- \n1.8.2.rc1\n"},{"id":"210990","messageId":"1362958891-26941-2-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 01/23] contrib/subtree: Fix typo (s/incldued/included/)","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:09Z","receivedAt":"2013-03-10T23:41:09Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Paul Cartwright <paul.cartwright@ziilabs.com>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 7ba853e..e0957ee 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -270,7 +270,7 @@ git-extensions repository in ~/git-extensions/:\n name\n \n You can omit the --squash flag, but doing so will increase the number\n-of commits that are incldued in your local repository.\n+of commits that are included in your local repository.\n \n We now have a ~/git-extensions/git-subtree directory containing code\n from the master branch of git://github.com/apenwarr/git-subtree.git\n-- \n1.8.2.rc1\n"},{"id":"210991","messageId":"1362958891-26941-3-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 02/23] contrib/subtree: Add command from-submodule","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:10Z","receivedAt":"2013-03-10T23:41:10Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Peter Jaros <pjaros@pivotallabs.com>\n\nConverts a git-submodule into a git-subtree.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\t.gitignore\n\tcontrib/subtree/git-subtree.sh\n\ttest.sh\n---\n contrib/subtree/git-subtree.sh | 30 +++++++++++++++++++++++++++++-\n 1 file changed, 29 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 8a23f58..caf4988 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -14,6 +14,7 @@ git subtree merge --prefix=<prefix> <commit>\n git subtree pull  --prefix=<prefix> <repository> <refspec...>\n git subtree push  --prefix=<prefix> <repository> <refspec...>\n git subtree split --prefix=<prefix> <commit...>\n+git subtree from-submodule --prefix=<prefix>\n --\n h,help        show the help\n q             quiet\n@@ -101,7 +102,7 @@ done\n command=\"$1\"\n shift\n case \"$command\" in\n-\tadd|merge|pull) default= ;;\n+\tadd|merge|pull|from-submodule) default= ;;\n \tsplit|push) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n esac\n@@ -721,4 +722,31 @@ cmd_push()\n \tfi\n }\n \n+cmd_from-submodule()\n+{\n+\tensure_clean\n+\n+\tlocal submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2)\n+\n+\t# Remove references to submodule.\n+\tgit config --remove-section submodule.$prefix\n+\tgit config --file .gitmodules --remove-section submodule.$prefix\n+\tgit add .gitmodules\n+\n+\t# Move submodule aside.\n+\tlocal tmp_repo=\"$(mktemp -d /tmp/git-subtree.XXXXX)\"\n+\trm -r $tmp_repo\n+\tmv $prefix $tmp_repo\n+\tgit rm $prefix\n+\n+\t# Commit changes.\n+\tgit commit -m \"Remove '$prefix/' submodule\"\n+\n+\t# subtree add from submodule repo.\n+\tcmd_add_repository $tmp_repo HEAD\n+\n+\t# Remove submodule repo.\n+\trm -rf $tmp_repo\n+}\n+\n \"cmd_$command\" \"$@\"\n-- \n1.8.2.rc1\n"},{"id":"210992","messageId":"1362958891-26941-4-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 03/23] contrib/subtree: Teach add to store repository & branch in .gittrees","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:11Z","receivedAt":"2013-03-10T23:41:11Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nThe repository and branch of a subtree added with the add command is\nstored in the .gittrees file.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex caf4988..7b70251 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -528,6 +528,14 @@ cmd_add_repository()\n \trevs=FETCH_HEAD\n \tset -- $revs\n \tcmd_add_commit \"$@\"\n+  \n+  # now add it to our list of repos \n+  git config -f .gittrees --unset subtree.$dir.url\n+  git config -f .gittrees --add subtree.$dir.url $repository\n+  git config -f .gittrees --unset subtree.$dir.path\n+  git config -f .gittrees --add subtree.$dir.path $dir\n+  git config -f .gittrees --unset subtree.$dir.branch\n+  git config -f .gittrees --add subtree.$dir.branch $refspec\n }\n \n cmd_add_commit()\n-- \n1.8.2.rc1\n"},{"id":"210993","messageId":"1362958891-26941-5-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:12Z","receivedAt":"2013-03-10T23:41:12Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: bibendi <bibendi@bk.ru>\n\nLook in the config file .gittrees for a default repository and\nrefspec or commit when they are not provided on the command line.\n\nUses the .gittrees config file in a similar way to how git-submodule\nuses the .gitmodules file.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 28 +++++++++++++++++++---------\n 1 file changed, 19 insertions(+), 9 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 7b70251..1aff956 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -708,21 +708,31 @@ cmd_merge()\n \n cmd_pull()\n {\n-\tensure_clean\n-\tgit fetch \"$@\" || exit $?\n-\trevs=FETCH_HEAD\n-\tset -- $revs\n-\tcmd_merge \"$@\"\n+    if [ $# -ne 1 ]; then\n+\t    die \"You must provide <branch>\"\n+\tfi\n+\tif [ -e \"$dir\" ]; then\n+\t    ensure_clean\n+\t    repository=$(git config -f .gittrees subtree.$prefix.url)\n+\t    refspec=$1\n+\t    git fetch $repository $refspec || exit $?\n+\t    echo \"git fetch using: \" $repository $refspec\n+\t    revs=FETCH_HEAD\n+\t    set -- $revs\n+\t    cmd_merge \"$@\"\n+\telse\n+\t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n+\tfi\n }\n \n cmd_push()\n {\n-\tif [ $# -ne 2 ]; then\n-\t    die \"You must provide <repository> <refspec>\"\n+\tif [ $# -ne 1 ]; then\n+\t    die \"You must provide <branch>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-\t    repository=$1\n-\t    refspec=$2\n+\t    repository=$(git config -f .gittrees subtree.$prefix.url)\n+\t    refspec=$1\n \t    echo \"git push using: \" $repository $refspec\n \t    git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec\n \telse\n-- \n1.8.2.rc1\n"},{"id":"210994","messageId":"1362958891-26941-6-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 05/23] contrib/subtree: Add commands pull_all and push_all","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:13Z","receivedAt":"2013-03-10T23:41:13Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: bibendi <bibendi@bk.ru>\n\nFor each subtree listed in .gittrees perform a push or a pull.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tcontrib/subtree/git-subtree.sh\n---\n contrib/subtree/git-subtree.sh | 25 ++++++++++++++++++++++---\n 1 file changed, 22 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 1aff956..ddae56e 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -12,6 +12,7 @@ git subtree add   --prefix=<prefix> <commit>\n git subtree add   --prefix=<prefix> <repository> <commit>\n git subtree merge --prefix=<prefix> <commit>\n git subtree pull  --prefix=<prefix> <repository> <refspec...>\n+git subtree pull_all\n git subtree push  --prefix=<prefix> <repository> <refspec...>\n git subtree split --prefix=<prefix> <commit...>\n git subtree from-submodule --prefix=<prefix>\n@@ -102,16 +103,18 @@ done\n command=\"$1\"\n shift\n case \"$command\" in\n-\tadd|merge|pull|from-submodule) default= ;;\n+\tadd|merge|pull|from-submodule|pull_all|push_all) default= ;;\n \tsplit|push) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n esac\n \n-if [ -z \"$prefix\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull_all\" -a \"$command\" != \"push_all\" ]; then\n \tdie \"You must provide the --prefix option.\"\n fi\n \n case \"$command\" in\n+    pull_all);;\n+    push_all);;\n \tadd) [ -e \"$prefix\" ] && \n \t\tdie \"prefix '$prefix' already exists.\" ;;\n \t*)   [ -e \"$prefix\" ] || \n@@ -120,7 +123,7 @@ esac\n \n dir=\"$(dirname \"$prefix/.\")\"\n \n-if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" != \"push\" ]; then\n+if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" != \"push\" -a \"$command\" != \"pull_all\" ]; then\n \trevs=$(git rev-parse $default --revs-only \"$@\") || exit $?\n \tdirs=\"$(git rev-parse --no-revs --no-flags \"$@\")\" || exit $?\n \tif [ -n \"$dirs\" ]; then\n@@ -767,4 +770,20 @@ cmd_from-submodule()\n \trm -rf $tmp_repo\n }\n \n+cmd_pull_all()\n+{\n+    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+        while read path; do\n+            git subtree pull -P $path master || exit $?\n+        done\n+}\n+\n+cmd_push_all()\n+{\n+    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+        while read path; do\n+            git subtree push -P $path master || exit $?\n+        done\n+}\n+\n \"cmd_$command\" \"$@\"\n-- \n1.8.2.rc1\n"},{"id":"210995","messageId":"1362958891-26941-7-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 06/23] contrib/subtree: Rename commands push_all/pull_all to push-all/pull-all","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:14Z","receivedAt":"2013-03-10T23:41:14Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nChanging underscores to dashes (push_all -> push-all)\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\t.gitignore\n\tcontrib/subtree/git-subtree.sh\n---\n contrib/subtree/git-subtree.sh | 17 +++++++++--------\n 1 file changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex ddae56e..39d764b 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -12,7 +12,8 @@ git subtree add   --prefix=<prefix> <commit>\n git subtree add   --prefix=<prefix> <repository> <commit>\n git subtree merge --prefix=<prefix> <commit>\n git subtree pull  --prefix=<prefix> <repository> <refspec...>\n-git subtree pull_all\n+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 from-submodule --prefix=<prefix>\n@@ -103,18 +104,18 @@ done\n command=\"$1\"\n shift\n case \"$command\" in\n-\tadd|merge|pull|from-submodule|pull_all|push_all) default= ;;\n+\tadd|merge|pull|from-submodule|pull-all|push-all) default= ;;\n \tsplit|push) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n esac\n \n-if [ -z \"$prefix\" -a \"$command\" != \"pull_all\" -a \"$command\" != \"push_all\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" != \"push-all\" ]; then\n \tdie \"You must provide the --prefix option.\"\n fi\n \n case \"$command\" in\n-    pull_all);;\n-    push_all);;\n+    pull-all);;\n+    push-all);;\n \tadd) [ -e \"$prefix\" ] && \n \t\tdie \"prefix '$prefix' already exists.\" ;;\n \t*)   [ -e \"$prefix\" ] || \n@@ -123,7 +124,7 @@ esac\n \n dir=\"$(dirname \"$prefix/.\")\"\n \n-if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" != \"push\" -a \"$command\" != \"pull_all\" ]; then\n+if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" != \"push\" -a \"$command\" != \"pull-all\" ]; then\n \trevs=$(git rev-parse $default --revs-only \"$@\") || exit $?\n \tdirs=\"$(git rev-parse --no-revs --no-flags \"$@\")\" || exit $?\n \tif [ -n \"$dirs\" ]; then\n@@ -770,7 +771,7 @@ cmd_from-submodule()\n \trm -rf $tmp_repo\n }\n \n-cmd_pull_all()\n+cmd_pull-all()\n {\n     git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n         while read path; do\n@@ -778,7 +779,7 @@ cmd_pull_all()\n         done\n }\n \n-cmd_push_all()\n+cmd_push-all()\n {\n     git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n         while read path; do\n-- \n1.8.2.rc1\n"},{"id":"210996","messageId":"1362958891-26941-8-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 07/23] contrib/subtree: Teach push and pull to use .gittrees if needed","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:15Z","receivedAt":"2013-03-10T23:41:15Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nOnly when a repository and/or branch are not supplied on the command\nline will push and pull look for them in the .gittrees file.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 32 ++++++++++++++++++++++++--------\n 1 file changed, 24 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 39d764b..98c508b 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -712,13 +712,21 @@ cmd_merge()\n \n cmd_pull()\n {\n-    if [ $# -ne 1 ]; then\n-\t    die \"You must provide <branch>\"\n+  if [ $# -gt 2 ]; then\n+\t    die \"You should provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n \t    ensure_clean\n-\t    repository=$(git config -f .gittrees subtree.$prefix.url)\n-\t    refspec=$1\n+      if [ $# -eq 1 ]; then \n+\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n+\t      refspec=$1\n+      elif [ $# -eq 2 ]; then \n+        repository=$1\n+        refspec=$2\n+      else \n+\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n+        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n+      fi\n \t    git fetch $repository $refspec || exit $?\n \t    echo \"git fetch using: \" $repository $refspec\n \t    revs=FETCH_HEAD\n@@ -731,12 +739,20 @@ cmd_pull()\n \n cmd_push()\n {\n-\tif [ $# -ne 1 ]; then\n-\t    die \"You must provide <branch>\"\n+\tif [ $# -gt 2 ]; then\n+\t    die \"You shold provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-\t    repository=$(git config -f .gittrees subtree.$prefix.url)\n-\t    refspec=$1\n+      if [ $# -eq 1 ]; then \n+\t      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+\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n+        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n+      fi\n \t    echo \"git push using: \" $repository $refspec\n \t    git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec\n \telse\n-- \n1.8.2.rc1\n"},{"id":"210997","messageId":"1362958891-26941-9-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 08/23] contrib/subtree: Replace invisible carriage return with a visible \\r","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:16Z","receivedAt":"2013-03-10T23:41:16Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nThe ctrl-M (^M) character used for the carriage return (CR) is not visible\nin all (most) text editors and is often silently converted to a new\nline (NL) or CR/NL combo.\n\n'say' is a wrapper for echo with accepts the option -e to interperet\nescaped characters. \\r becomes a CR, yet is not munged by text\neditors.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\n---\n contrib/subtree/git-subtree.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 98c508b..8056851 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -605,7 +605,7 @@ cmd_split()\n \teval \"$grl\" |\n \twhile read rev parents; do\n \t\trevcount=$(($revcount + 1))\n-\t\tsay -n \"$revcount/$revmax ($createcount)\n\"\n+\t\tsay -ne \"$revcount/$revmax ($createcount)\\r\"\n \t\tdebug \"Processing commit: $rev\"\n \t\texists=$(cache_get $rev)\n \t\tif [ -n \"$exists\" ]; then\n-- \n1.8.2.rc1\n"},{"id":"210998","messageId":"1362958891-26941-10-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 09/23] contrib/subtree: Teach push to abort if split fails","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:17Z","receivedAt":"2013-03-10T23:41:17Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Michael Hart <michael@adslot.com>\n\nAdded a check to ensure that split succeeds before trying to push.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 8056851..ae9f87f 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -754,7 +754,12 @@ cmd_push()\n         refspec=$(git config -f .gittrees subtree.$prefix.branch)\n       fi\n \t    echo \"git push using: \" $repository $refspec\n-\t    git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec\n+\t    rev=$(git subtree split --prefix=$prefix)\n+\t    if [ -n \"$rev\" ]; then\n+\t        git push $repository $rev:refs/heads/$refspec\n+\t    else\n+\t        die \"Couldn't push, 'git subtree split' failed.\"\n+\t    fi\n \telse\n \t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n \tfi\n-- \n1.8.2.rc1\n"},{"id":"210999","messageId":"1362958891-26941-11-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 10/23] contrib/subtree: Add command diff","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:18Z","receivedAt":"2013-03-10T23:41:18Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nFetches the remote repo as a temporary git-remote then uses\ngit-diff-tree to do comparison before removing the temporary\ngit-remote.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\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\" != \"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 git-fu is weak. \n+        # git diff-tree expects a treeish, but I have only a repository and branch name.\n+        # I don't know how to turn that into a treeish without creating 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), which isn't an option for \"git remote\"\n+        # could this instead be \"git fetch -q $repository $refspec\" and 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 existing subtree directory to diff. Try 'git subtree add' to add a subtree.\"\n+    fi\n+}\n+\n cmd_push()\n {\n \tif [ $# -gt 2 ]; then\n-- \n1.8.2.rc1\n"},{"id":"211000","messageId":"1362958891-26941-12-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 11/23] contrib/subtree: Add command list","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:19Z","receivedAt":"2013-03-10T23:41:19Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nLists subtrees from the .gittrees file.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\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\" != \"push-all\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" != \"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 '=.*' | 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 '=.*' | grep -o '[^=].*' |\n-- \n1.8.2.rc1\n"},{"id":"211001","messageId":"1362958891-26941-13-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 12/23] contrib/subtree: Add command prune","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:20Z","receivedAt":"2013-03-10T23:41:20Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Nate Jones <nate@endot.org>\n\nRemoves entries in .gittrees where the subtree files are\nno longer present on disk.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\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\" != \"push-all\" -a \"$command\" != \"list\" ]; then\n+if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" != \"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 '=.*' | 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 '=.*' | grep -o '[^=].*' |\n-- \n1.8.2.rc1\n"},{"id":"211002","messageId":"1362958891-26941-14-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 13/23] contrib/subtree: Add prune command to OPTS_SPEC","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:21Z","receivedAt":"2013-03-10T23:41:21Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\n---\n contrib/subtree/git-subtree.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 0c41383..d67fe5a 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -18,6 +18,7 @@ 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+git subtree prune\n --\n h,help        show the help\n q             quiet\n-- \n1.8.2.rc1\n"},{"id":"211003","messageId":"1362958891-26941-15-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 14/23] contrib/subtree: Remove trailing slash from prefix parameter","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:22Z","receivedAt":"2013-03-10T23:41:22Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nConflicts:\n\tgit-subtree.sh\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex d67fe5a..ae7d1fe 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -103,6 +103,9 @@ while [ $# -gt 0 ]; do\n \tesac\n done\n \n+# Remove trailing slash\n+prefix=\"${prefix%/}\";\n+\n command=\"$1\"\n shift\n case \"$command\" in\n-- \n1.8.2.rc1\n"},{"id":"211004","messageId":"1362958891-26941-16-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 15/23] contrib/subtree: Teach from-submodule to add new subtree to .gittrees","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:23Z","receivedAt":"2013-03-10T23:41:23Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\n---\n contrib/subtree/git-subtree.sh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex ae7d1fe..84c90c7 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -806,6 +806,7 @@ cmd_from-submodule()\n \tensure_clean\n \n \tlocal submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2)\n+\tlocal submodule_orig_repo=$(git config --file .gitmodules submodule.$prefix.url)\n \n \t# Remove references to submodule.\n \tgit config --remove-section submodule.$prefix\n@@ -824,6 +825,10 @@ cmd_from-submodule()\n \t# subtree add from submodule repo.\n \tcmd_add_repository $tmp_repo HEAD\n \n+\t# Update .gittrees with the original repo url\n+\tgit config --file .gittrees --unset subtree.$prefix.url\n+\tgit config --file .gittrees subtree.$prefix.url $submodule_orig_repo\n+\n \t# Remove submodule repo.\n \trm -rf $tmp_repo\n }\n-- \n1.8.2.rc1\n"},{"id":"211005","messageId":"1362958891-26941-17-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 16/23] contrib/subtree: Document pull-all and push-all","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:24Z","receivedAt":"2013-03-10T23:41:24Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.txt | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex e0957ee..c8fc103 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -92,13 +92,19 @@ pull::\n \tExactly like 'merge', but parallels 'git pull' in that\n \tit fetches the given commit from the specified remote\n \trepository.\n-\t\n+\n+pull-all::\n+\tPerform a pull operation on all in .gittrees registered subtrees.\n+\n push::\n \tDoes a 'split' (see below) using the <prefix> supplied\n \tand then does a 'git push' to push the result to the \n \trepository and refspec. This can be used to push your\n \tsubtree to different branches of the remote repository.\n \n+push-all::\n+\tPerform a pull operation on all in .gittrees registered subtrees.\n+\n split::\n \tExtract a new, synthetic project history from the\n \thistory of the <prefix> subtree.  The new history\n-- \n1.8.2.rc1\n"},{"id":"211006","messageId":"1362958891-26941-18-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 17/23] contrib/subtree: Document from-submodule and prune commands","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:25Z","receivedAt":"2013-03-10T23:41:25Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.txt | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex c8fc103..48ba158 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -129,6 +129,16 @@ split::\n \tNote that if you use '--squash' when you merge, you\n \tshould usually not just '--rejoin' when you split.\n \n+from-submodule::\n+\tConvert a git submodule to a subtree.\n+\tThe module is removed from the .gitmodules file and\n+\tthe repo contents are integrated as a subtree.\n+\n+prune::\n+\tCleanup .gittrees entries for which the subtree nolonger exists.\n+\n+diff::\n+\tTO BE DOCUMENTED\n \n OPTIONS\n -------\n-- \n1.8.2.rc1\n"},{"id":"211007","messageId":"1362958891-26941-19-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 18/23] contrib/subtree: Add missing commands to SYNOPSIS","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:26Z","receivedAt":"2013-03-10T23:41:26Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nAdd pull-all, push-all, from-submodule, prune and diff commands\nto SYNOPSIS.\n\nAdd alternate parameter option for add command.\n\nUse long-form option for specifying prefix.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tcontrib/subtree/git-subtree.txt\n---\n contrib/subtree/git-subtree.txt | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 48ba158..b485ab5 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -9,13 +9,16 @@ git-subtree - Merge subtrees together and split repository into subtrees\n SYNOPSIS\n --------\n [verse]\n-'git subtree' add   -P <prefix> <refspec>\n-'git subtree' add   -P <prefix> <repository> <refspec>\n-'git subtree' pull  -P <prefix> <repository> <refspec...>\n-'git subtree' push  -P <prefix> <repository> <refspec...>\n-'git subtree' merge -P <prefix> <commit>\n-'git subtree' split -P <prefix> [OPTIONS] [<commit>]\n-\n+'git subtree' add   --prefix=<prefix> <repository> <refspec>\n+'git subtree' merge --prefix=<prefix> <commit>\n+'git subtree' pull  --prefix=<prefix> [<repository> [<refspec>...]]\n+'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' from-submodule --prefix=<prefix>\n+'git subtree' prune\n+'git subtree' diff  --prefix=<prefix> [<repository> [<refspec>...]]\n \n DESCRIPTION\n -----------\n-- \n1.8.2.rc1\n"},{"id":"211008","messageId":"1362958891-26941-20-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 19/23] contrib/subtree: Document list command","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:27Z","receivedAt":"2013-03-10T23:41:27Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tgit-subtree.sh\n---\n contrib/subtree/git-subtree.sh  | 1 +\n contrib/subtree/git-subtree.txt | 4 ++++\n 2 files changed, 5 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 84c90c7..4605203 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -15,6 +15,7 @@ git subtree pull  --prefix=<prefix> <repository> <refspec...>\n git subtree pull-all\n git subtree push-all\n git subtree push  --prefix=<prefix> <repository> <refspec...>\n+git subtree list\n git subtree split --prefix=<prefix> <commit...>\n git subtree diff  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree from-submodule --prefix=<prefix>\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex b485ab5..385bde8 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -15,6 +15,7 @@ SYNOPSIS\n 'git subtree' pull-all\n 'git subtree' push-all\n 'git subtree' push  --prefix=<prefix> [<repository> [<refspec>...]]\n+'git subtree' list\n 'git subtree' split --prefix=<prefix> <commit...>\n 'git subtree' from-submodule --prefix=<prefix>\n 'git subtree' prune\n@@ -108,6 +109,9 @@ push::\n push-all::\n \tPerform a pull operation on all in .gittrees registered subtrees.\n \n+list::\n+\tShow a list of the in .gittrees registered subtrees\n+\n split::\n \tExtract a new, synthetic project history from the\n \thistory of the <prefix> subtree.  The new history\n-- \n1.8.2.rc1\n"},{"id":"211009","messageId":"1362958891-26941-21-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 20/23] contrib/subtree: Teach push to use --force option","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:28Z","receivedAt":"2013-03-10T23:41:28Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: James Roper <jroper@vz.net>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tcontrib/subtree/git-subtree.sh\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh  | 9 ++++++++-\n contrib/subtree/git-subtree.txt | 5 +++++\n 2 files changed, 13 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 4605203..3582a55 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -32,6 +32,8 @@ b,branch=     create a new branch from the split subtree\n ignore-joins  ignore prior --rejoin commits\n onto=         try connecting new tree to an existing one\n rejoin        merge the new branch back into HEAD\n+ options for 'push'\n+f,force       use force push\n  options for 'add', 'merge', 'pull' and 'push'\n squash        merge subtree changes as a single commit\n \"\n@@ -90,6 +92,7 @@ while [ $# -gt 0 ]; do\n \t\t-b) branch=\"$1\"; shift ;;\n \t\t-P) prefix=\"$1\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n+        -f|--force) force=1 ;;\n \t\t--no-prefix) prefix= ;;\n \t\t--onto) onto=\"$1\"; shift ;;\n \t\t--no-onto) onto= ;;\n@@ -790,10 +793,14 @@ cmd_push()\n \t      repository=$(git config -f .gittrees subtree.$prefix.url)\n         refspec=$(git config -f .gittrees subtree.$prefix.branch)\n       fi\n+        push_opts=\n+        if [ \"$force\" == \"1\" ]; then \n+            push_opts=\"$push_opts --force\"\n+        fi\n \t    echo \"git push using: \" $repository $refspec\n \t    rev=$(git subtree split --prefix=$prefix)\n \t    if [ -n \"$rev\" ]; then\n-\t        git push $repository $rev:refs/heads/$refspec\n+\t        git push $push_opts $repository $rev:refs/heads/$refspec\n \t    else\n \t        die \"Couldn't push, 'git subtree split' failed.\"\n \t    fi\ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 385bde8..9e9eb9e 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -278,6 +278,11 @@ OPTIONS FOR split\n \t'--rejoin' when you split, because you don't want the\n \tsubproject's history to be part of your project anyway.\n \n+OPTIONS FOR push\n+----------------\n+-f::\n+--force::\n+    Uses 'git push --force'.\n \n EXAMPLE 1. Add command\n ----------------------\n-- \n1.8.2.rc1\n"},{"id":"211011","messageId":"1362958891-26941-22-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 21/23] contrib/subtree: Convert spaces to tabs and remove some trailing whitespace","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:29Z","receivedAt":"2013-03-10T23:41:29Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Herman van Rink <rink@initfour.nl>\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n\nConflicts:\n\tcontrib/subtree/.gitignore\n\tcontrib/subtree/git-subtree.sh\n\tcontrib/subtree/test.sh\n---\n\nIt's a nasty formatting only patch and I won't be surprised or too dissappiointed\nif this doesn't make it. Or are the rules for this more lax for contrib? How else\ncan contrib be brought in-line with coding standards?\n\n contrib/subtree/git-subtree.sh | 213 +++++++++++++++++++++--------------------\n 1 file changed, 109 insertions(+), 104 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 3582a55..263ea9f 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -92,7 +92,7 @@ while [ $# -gt 0 ]; do\n \t\t-b) branch=\"$1\"; shift ;;\n \t\t-P) prefix=\"$1\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n-        -f|--force) force=1 ;;\n+\t\t-f|--force) force=1 ;;\n \t\t--no-prefix) prefix= ;;\n \t\t--onto) onto=\"$1\"; shift ;;\n \t\t--no-onto) onto= ;;\n@@ -123,8 +123,10 @@ if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" != \"push-all\" -a \"$c\n fi\n \n case \"$command\" in\n-    pull-all);;\n-    push-all);;\n+\tpull-all);;\n+\tpush-all);;\n+\tlist);;\n+\tprune);;\n \tadd) [ -e \"$prefix\" ] && \n \t\tdie \"prefix '$prefix' already exists.\" ;;\n \t*)   [ -e \"$prefix\" ] || \n@@ -541,14 +543,14 @@ cmd_add_repository()\n \trevs=FETCH_HEAD\n \tset -- $revs\n \tcmd_add_commit \"$@\"\n-  \n-  # now add it to our list of repos \n-  git config -f .gittrees --unset subtree.$dir.url\n-  git config -f .gittrees --add subtree.$dir.url $repository\n-  git config -f .gittrees --unset subtree.$dir.path\n-  git config -f .gittrees --add subtree.$dir.path $dir\n-  git config -f .gittrees --unset subtree.$dir.branch\n-  git config -f .gittrees --add subtree.$dir.branch $refspec\n+\n+\t# now add it to our list of repos\n+\tgit config -f .gittrees --unset subtree.$dir.url\n+\tgit config -f .gittrees --add subtree.$dir.url $repository\n+\tgit config -f .gittrees --unset subtree.$dir.path\n+\tgit config -f .gittrees --add subtree.$dir.path $dir\n+\tgit config -f .gittrees --unset subtree.$dir.branch\n+\tgit config -f .gittrees --add subtree.$dir.branch $refspec\n }\n \n cmd_add_commit()\n@@ -721,89 +723,91 @@ cmd_merge()\n \n cmd_pull()\n {\n-  if [ $# -gt 2 ]; then\n-\t    die \"You should provide either <refspec> or <repository> <refspec>\"\n+\tif [ $# -gt 2 ]; then\n+\t\tdie \"You should provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-\t    ensure_clean\n-      if [ $# -eq 1 ]; then \n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-\t      refspec=$1\n-      elif [ $# -eq 2 ]; then \n-        repository=$1\n-        refspec=$2\n-      else \n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n-      fi\n-\t    git fetch $repository $refspec || exit $?\n-\t    echo \"git fetch using: \" $repository $refspec\n-\t    revs=FETCH_HEAD\n-\t    set -- $revs\n-\t    cmd_merge \"$@\"\n+\t\tensure_clean\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\t\tgit fetch $repository $refspec || exit $?\n+\t\techo \"git fetch using: \" $repository $refspec\n+\t\trevs=FETCH_HEAD\n+\t\tset -- $revs\n+\t\tcmd_merge \"$@\"\n \telse\n-\t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n+\t\tdie \"'$dir' must already exist. Try 'git subtree add'.\"\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 git-fu is weak. \n-        # git diff-tree expects a treeish, but I have only a repository and branch name.\n-        # I don't know how to turn that into a treeish without creating 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), which isn't an option for \"git remote\"\n-        # could this instead be \"git fetch -q $repository $refspec\" and 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 existing subtree directory to diff. Try 'git subtree add' to add a subtree.\"\n-    fi\n+cmd_diff()\n+{\n+\tif [ -e \"$dir\" ]; then\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\t\t# this is ugly, but I don't know of a better way to do it. My git-fu is weak.\n+\t\t# git diff-tree expects a treeish, but I have only a repository and branch name.\n+\t\t# I don't know how to turn that into a treeish without creating a remote.\n+\t\t# Please change this if you know a better way!\n+\t\ttmp_remote=__diff-tmp\n+\t\tgit remote rm $tmp_remote > /dev/null 2>&1\n+\t\tgit remote add -t $refspec $tmp_remote $repository > /dev/null\n+\t\t# we fetch as a separate step so we can pass -q (quiet), which isn't an option for \"git remote\"\n+\t\t# could this instead be \"git fetch -q $repository $refspec\" and leave aside creating the remote?\n+\t\t# Still need a treeish for the diff-tree command...\n+\t\tgit fetch -q $tmp_remote\n+\t\tgit diff-tree -p refs/remotes/$tmp_remote/$refspec\n+\t\tgit remote rm $tmp_remote > /dev/null 2>&1\n+\telse\n+\t\tdie \"Cannot resolve directory '$dir'. Please point to an existing subtree directory to diff. Try 'git subtree add' to add a subtree.\"\n+\tfi\n }\n \n cmd_push()\n {\n \tif [ $# -gt 2 ]; then\n-\t    die \"You shold provide either <refspec> or <repository> <refspec>\"\n+\t\tdie \"You shold provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-      if [ $# -eq 1 ]; then \n-\t      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-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n-      fi\n-        push_opts=\n-        if [ \"$force\" == \"1\" ]; then \n-            push_opts=\"$push_opts --force\"\n-        fi\n-\t    echo \"git push using: \" $repository $refspec\n-\t    rev=$(git subtree split --prefix=$prefix)\n-\t    if [ -n \"$rev\" ]; then\n-\t        git push $push_opts $repository $rev:refs/heads/$refspec\n-\t    else\n-\t        die \"Couldn't push, 'git subtree split' failed.\"\n-\t    fi\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\n+\t\tpush_opts=\n+\t\tif [ \"$force\" == \"1\" ]; then\n+\t\t  push_opts=\"$push_opts --force\"\n+\t\tfi\n+\n+\t\techo \"git push using: \" $repository $refspec\n+\t\trev=$(git subtree split --prefix=$prefix)\n+\t\tif [ -n \"$rev\" ]; then\n+\t\t\tgit push $push_opts $repository $rev:refs/heads/$refspec\n+\t\telse\n+\t\t\tdie \"Couldn't push, 'git subtree split' failed.\"\n+\t\tfi\n \telse\n \t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n \tfi\n@@ -831,6 +835,7 @@ cmd_from-submodule()\n \tgit commit -m \"Remove '$prefix/' submodule\"\n \n \t# subtree add from submodule repo.\n+\t# TODO: Could be determin HEAD to be a specific branch\n \tcmd_add_repository $tmp_repo HEAD\n \n \t# Update .gittrees with the original repo url\n@@ -841,46 +846,46 @@ cmd_from-submodule()\n \trm -rf $tmp_repo\n }\n \n-subtree_list() \n+subtree_list()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | 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+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\trepository=$(git config -f .gittrees subtree.$path.url)\n+\t\trefspec=$(git config -f .gittrees subtree.$path.branch)\n+\t\techo \"\t$path\t\t(merged from $repository branch $refspec) \"\n+\tdone\n }\n \n cmd_list()\n {\n-  subtree_list \n+  subtree_list\n }\n \n cmd_prune()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | 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+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tif [ ! -e \"$path\" ]; then\n+\t\t\techo \"pruning $path\"\n+\t\t\tgit config -f .gittrees --remove-section subtree.$path\n+\t\tfi\n+\tdone\n }\n \n cmd_pull-all()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n-        while read path; do\n-            git subtree pull -P $path master || exit $?\n-        done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tgit subtree pull -P $path $(git config -f .gittrees subtree.$path.url) $(git config -f .gittrees subtree.$path.branch) || exit $?\n+\tdone\n }\n \n cmd_push-all()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n-        while read path; do\n-            git subtree push -P $path master || exit $?\n-        done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tgit subtree push -P $path $(git config -f .gittrees subtree.$path.url) $(git config -f .gittrees subtree.$path.branch) || exit $?\n+\tdone\n }\n \n \"cmd_$command\" \"$@\"\n-- \n1.8.2.rc1\n"},{"id":"211012","messageId":"1362958891-26941-23-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 22/23] contrib/subtree: Parameters repository/branch for push/pull are optional","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:30Z","receivedAt":"2013-03-10T23:41:30Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 263ea9f..aaee6ae 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -11,10 +11,10 @@ OPTS_SPEC=\"\\\n git subtree add   --prefix=<prefix> <commit>\n git subtree add   --prefix=<prefix> <repository> <commit>\n git subtree merge --prefix=<prefix> <commit>\n-git subtree pull  --prefix=<prefix> <repository> <refspec...>\n+git subtree pull  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree pull-all\n git subtree push-all\n-git subtree push  --prefix=<prefix> <repository> <refspec...>\n+git subtree push  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree list\n git subtree split --prefix=<prefix> <commit...>\n git subtree diff  --prefix=<prefix> [<repository> [<refspec>...]]\n-- \n1.8.2.rc1\n"},{"id":"211010","messageId":"1362958891-26941-24-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"1362958891-26941-1-git-send-email-pcampbell@kemitix.net","subject":"[PATCH v2 23/23] contrib/subtree: Fix order of case switches so default case is last","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-10T23:41:31Z","receivedAt":"2013-03-10T23:41:31Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex aaee6ae..fb6f044 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -113,9 +113,9 @@ prefix=\"${prefix%/}\";\n command=\"$1\"\n shift\n case \"$command\" in\n-    add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;;\n+\tadd|merge|pull|pull-all|push-all|from-submodule|prune) default= ;;\n+\tsplit|push|diff|list) default=\"--default HEAD\" ;;\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\" != \"push-all\" -a \"$command\" != \"list\" -a \"$command\" != \"prune\" ]; then\n-- \n1.8.2.rc1\n"},{"id":"211018","messageId":"7vwqtebp3m.fsf@alter.siamese.dyndns.org","threadId":"33149","inReplyTo":"1362958891-26941-3-git-send-email-pcampbell@kemitix.net","subject":"Re: [PATCH v2 02/23] contrib/subtree: Add command from-submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-11T03:19:09Z","receivedAt":"2013-03-11T03:19:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Campbell <pcampbell@kemitix.net> writes:\n\n> @@ -721,4 +722,31 @@ cmd_push()\n>  \tfi\n>  }\n>  \n> +cmd_from-submodule()\n> +{\n\nI know contrib/subtree does not work with anything other than bash,\nand bash may accept this as a valid function name, but if you can\navoid it easily I would prefer not to see a non-POSIX construct like\nthis in my tree, even in contrib/ part:\n\n  http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_230\n\nbecause people often reference random parts of the tree and mimick\nwhat existing code does.\n\n> +\tensure_clean\n> +\n> +\tlocal submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2)\n\nIs $prefix guaranteed not to have any $IFS whitespaces?\n\n> +\t# Remove references to submodule.\n> +\tgit config --remove-section submodule.$prefix\n> +\tgit config --file .gitmodules --remove-section submodule.$prefix\n> +\tgit add .gitmodules\n> +\n> +\t# Move submodule aside.\n> +\tlocal tmp_repo=\"$(mktemp -d /tmp/git-subtree.XXXXX)\"\n\nDoesn't \"git subtree\" honor TMPDIR?  Not complaining, but being\ncurious.\n\n> +\trm -r $tmp_repo\n> +\tmv $prefix $tmp_repo\n> +\tgit rm $prefix\n\nIs $prefix guaranteed not to have any $IFS whitespaces?\n\n> +\n> +\t# Commit changes.\n> +\tgit commit -m \"Remove '$prefix/' submodule\"\n> +\n> +\t# subtree add from submodule repo.\n> +\tcmd_add_repository $tmp_repo HEAD\n> +\n> +\t# Remove submodule repo.\n> +\trm -rf $tmp_repo\n> +}\n> +\n>  \"cmd_$command\" \"$@\"\n"},{"id":"211019","messageId":"7vsj42bove.fsf@alter.siamese.dyndns.org","threadId":"33149","inReplyTo":"1362958891-26941-4-git-send-email-pcampbell@kemitix.net","subject":"Re: [PATCH v2 03/23] contrib/subtree: Teach add to store repository & branch in .gittrees","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-11T03:24:05Z","receivedAt":"2013-03-11T03:24:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Campbell <pcampbell@kemitix.net> writes:\n\n> From: Matt Hoffman <matt.hoffman@quantumretail.com>\n>\n> The repository and branch of a subtree added with the add command is\n> stored in the .gittrees file.\n>\n> Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n> ---\n>  contrib/subtree/git-subtree.sh | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index caf4988..7b70251 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -528,6 +528,14 @@ cmd_add_repository()\n>  \trevs=FETCH_HEAD\n>  \tset -- $revs\n>  \tcmd_add_commit \"$@\"\n> +  \n> +  # now add it to our list of repos \n> +  git config -f .gittrees --unset subtree.$dir.url\n> +  git config -f .gittrees --add subtree.$dir.url $repository\n> +  git config -f .gittrees --unset subtree.$dir.path\n> +  git config -f .gittrees --add subtree.$dir.path $dir\n> +  git config -f .gittrees --unset subtree.$dir.branch\n> +  git config -f .gittrees --add subtree.$dir.branch $refspec\n\nExisting code in the function this touches seem to be written\ncarefully to allow $IFS whitespace in $dir, but this change butchers\nit, it seems.\n\nAlso, where does $refspec come from?  When this is called from\ncmd_add_repository(), there is an assignment to the variable, but it\nis not all clear.  As git-subtree declares it won't work with\nanything but bash, I think things like this should take advantage of\nbeing written for bash by using \"local\" and passing arguments\nexplicitly instead of relying on global variables, which POSIX shell\nscripts cannot afford to do but bash scripts can.\n\n>  }\n>  \n>  cmd_add_commit()\n"},{"id":"211020","messageId":"7vobeqbobz.fsf@alter.siamese.dyndns.org","threadId":"33149","inReplyTo":"1362958891-26941-5-git-send-email-pcampbell@kemitix.net","subject":"Re: [PATCH v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-11T03:35:44Z","receivedAt":"2013-03-11T03:35:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"> From: bibendi <bibendi@bk.ru>\n>\n> Look in the config file .gittrees for a default repository and\n> refspec or commit when they are not provided on the command line.\n>\n> Uses the .gittrees config file in a similar way to how git-submodule\n> uses the .gitmodules file.\n\nWhat the patch does can be read from the code, but what benefit\nwould users get by the extra file?\n\n>  cmd_pull()\n>  {\n> -\tensure_clean\n> -\tgit fetch \"$@\" || exit $?\n> -\trevs=FETCH_HEAD\n> -\tset -- $revs\n> -\tcmd_merge \"$@\"\n> +    if [ $# -ne 1 ]; then\n\nBroken indentation?\n\n> +\t    die \"You must provide <branch>\"\n> +\tfi\n\nIt used to allow \"git fetch $there\" and let the configured\nremote.$there.fetch refspec to decide what gets fetched, and also it\nused to allow \"git fetch $there $that_branch\" to explicitly fetch\nthe named branch.  But this change insists that the user has to give\nwhat gets fetched from the command line and forbids the user from\ngiving where to fetch from, it seems.  Isn't it a regression?  Why\nis it a good idea to forbid such uses that the script used to\naccept?\n\nThe proposed log message does not explain why it is not a\nregression, or why accepting some use patterns that the script used\nto allow was a bug that needs to be diagnosed with this new\nconditional.\n\n> +\tif [ -e \"$dir\" ]; then\n> +\t    ensure_clean\n> +\t    repository=$(git config -f .gittrees subtree.$prefix.url)\n> +\t    refspec=$1\n> +\t    git fetch $repository $refspec || exit $?\n> +\t    echo \"git fetch using: \" $repository $refspec\n\nWhy are these variable references outside the dq pair?\n"},{"id":"211022","messageId":"7vk3pebkac.fsf@alter.siamese.dyndns.org","threadId":"33149","inReplyTo":"1362958891-26941-6-git-send-email-pcampbell@kemitix.net","subject":"Re: [PATCH v2 05/23] contrib/subtree: Add commands pull_all and push_all","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-11T05:03:07Z","receivedAt":"2013-03-11T05:03:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Campbell <pcampbell@kemitix.net> writes:\n\n> From: bibendi <bibendi@bk.ru>\n>\n> For each subtree listed in .gittrees perform a push or a pull.\n>\n> Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n>\n> Conflicts:\n> \tcontrib/subtree/git-subtree.sh\n\nThe \"Conflicts:\" part is totally irrelevant.  Please remove.\n\n> ---\n>  contrib/subtree/git-subtree.sh | 25 ++++++++++++++++++++++---\n>  1 file changed, 22 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 1aff956..ddae56e 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -12,6 +12,7 @@ git subtree add   --prefix=<prefix> <commit>\n>  git subtree add   --prefix=<prefix> <repository> <commit>\n>  git subtree merge --prefix=<prefix> <commit>\n>  git subtree pull  --prefix=<prefix> <repository> <refspec...>\n> +git subtree pull_all\n\nWhy isn't it \"pull --all\"?\n\n>  git subtree push  --prefix=<prefix> <repository> <refspec...>\n\nWhere did \"push_all\" go?\n\n> +cmd_pull_all()\n> +{\n> +    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n\n\"grep -o\" is not even in POSIX.  Besides, what is this trying to\nparse?  Is it expected to match lines like\n\n\tpath.subtree=trash\n\nwith this, or is it more like you only want something like this:\n\n\tsubtree.over/there.path=foo\n\nin which case you would want to read with something like\n\n\tsed -n -e 's/^subtree\\...*\\.path=\\(.*\\)/\\1/p'\n\ninstead (modulo the usual caveat on $IFS whitespaces in path)?\n\n> +        while read path; do\n> +            git subtree pull -P $path master || exit $?\n> +        done\n> +}\n\nI'd stop looking at this series myself at this step for now.\n"},{"id":"211036","messageId":"CALeLG_=JbuZJs3dt26aS+kNMyZKC=kBXs4+OMpdQ7fC0nUyTAQ@mail.gmail.com","threadId":"33149","inReplyTo":"7vk3pebkac.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 05/23] contrib/subtree: Add commands pull_all and push_all","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-11T11:49:14Z","receivedAt":"2013-03-11T11:49:14Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"On Mon, Mar 11, 2013 at 5:03 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Paul Campbell <pcampbell@kemitix.net> writes:\n>\n>> From: bibendi <bibendi@bk.ru>\n>>\n>> For each subtree listed in .gittrees perform a push or a pull.\n>>\n>> Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n>>\n>> Conflicts:\n>>       contrib/subtree/git-subtree.sh\n>\n> The \"Conflicts:\" part is totally irrelevant.  Please remove.\n>\n>> ---\n>>  contrib/subtree/git-subtree.sh | 25 ++++++++++++++++++++++---\n>>  1 file changed, 22 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n>> index 1aff956..ddae56e 100755\n>> --- a/contrib/subtree/git-subtree.sh\n>> +++ b/contrib/subtree/git-subtree.sh\n>> @@ -12,6 +12,7 @@ git subtree add   --prefix=<prefix> <commit>\n>>  git subtree add   --prefix=<prefix> <repository> <commit>\n>>  git subtree merge --prefix=<prefix> <commit>\n>>  git subtree pull  --prefix=<prefix> <repository> <refspec...>\n>> +git subtree pull_all\n>\n> Why isn't it \"pull --all\"?\n>\n>>  git subtree push  --prefix=<prefix> <repository> <refspec...>\n>\n> Where did \"push_all\" go?\n>\n>> +cmd_pull_all()\n>> +{\n>> +    git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' |\n>\n> \"grep -o\" is not even in POSIX.  Besides, what is this trying to\n> parse?  Is it expected to match lines like\n>\n>         path.subtree=trash\n>\n> with this, or is it more like you only want something like this:\n>\n>         subtree.over/there.path=foo\n>\n> in which case you would want to read with something like\n>\n>         sed -n -e 's/^subtree\\...*\\.path=\\(.*\\)/\\1/p'\n>\n> instead (modulo the usual caveat on $IFS whitespaces in path)?\n>\n>> +        while read path; do\n>> +            git subtree pull -P $path master || exit $?\n>> +        done\n>> +}\n>\n> I'd stop looking at this series myself at this step for now.\n\nThanks for your feedback. Plenty there for me already to get cracking on.\n\n-- \nPaul [W] Campbell\n"},{"id":"212112","messageId":"CALeLG_nEuH6BOydUPTnDb5CrF=+5tipreHCAooxNnYW2eyVHLQ@mail.gmail.com","threadId":"33149","inReplyTo":"7vsj42bove.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 03/23] contrib/subtree: Teach add to store repository & branch in .gittrees","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-24T20:17:42Z","receivedAt":"2013-03-24T20:17:42Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"On Mon, Mar 11, 2013 at 3:24 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Paul Campbell <pcampbell@kemitix.net> writes:\n>\n>> From: Matt Hoffman <matt.hoffman@quantumretail.com>\n>>\n>> The repository and branch of a subtree added with the add command is\n>> stored in the .gittrees file.\n>>\n>> Signed-off-by: Paul Campbell <pcampbell@kemitix.net>\n>> ---\n>>  contrib/subtree/git-subtree.sh | 8 ++++++++\n>>  1 file changed, 8 insertions(+)\n>>\n>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n>> index caf4988..7b70251 100755\n>> --- a/contrib/subtree/git-subtree.sh\n>> +++ b/contrib/subtree/git-subtree.sh\n>> @@ -528,6 +528,14 @@ cmd_add_repository()\n>>       revs=FETCH_HEAD\n>>       set -- $revs\n>>       cmd_add_commit \"$@\"\n>> +\n>> +  # now add it to our list of repos\n>> +  git config -f .gittrees --unset subtree.$dir.url\n>> +  git config -f .gittrees --add subtree.$dir.url $repository\n>> +  git config -f .gittrees --unset subtree.$dir.path\n>> +  git config -f .gittrees --add subtree.$dir.path $dir\n>> +  git config -f .gittrees --unset subtree.$dir.branch\n>> +  git config -f .gittrees --add subtree.$dir.branch $refspec\n>\n> Existing code in the function this touches seem to be written\n> carefully to allow $IFS whitespace in $dir, but this change butchers\n> it, it seems.\n>\n> Also, where does $refspec come from?  When this is called from\n> cmd_add_repository(), there is an assignment to the variable, but it\n> is not all clear.  As git-subtree declares it won't work with\n> anything but bash, I think things like this should take advantage of\n> being written for bash by using \"local\" and passing arguments\n> explicitly instead of relying on global variables, which POSIX shell\n> scripts cannot afford to do but bash scripts can.\n>\n>>  }\n>>\n>>  cmd_add_commit()\n\n$refspec gets assigned in the third line of the function. The function\nhas only one caller in cmd_add() inside an if clause that requires\nthere be two parameters.\n\nPersonally I'd rather move git-subtree to be more portable and less\ndependant on bash. I've sent some patches earlier to remove that\ndependancy. As far as I could see there wasn't really anything that\nwas bash-only.\n\nReroll of this patch coming shortly allowing for $IFS whitespace.\n\n-- \nPaul [W] Campbell\n"},{"id":"212114","messageId":"1364156521-29318-1-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"CALeLG_nEuH6BOydUPTnDb5CrF=+5tipreHCAooxNnYW2eyVHLQ@mail.gmail.com","subject":"[PATCH] contrib/subtree: Teach add to store repository & branch in .gittrees","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-24T20:22:01Z","receivedAt":"2013-03-24T20:22:01Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"From: Matt Hoffman <matt.hoffman@quantumretail.com>\n\nThe repository and branch of a subtree added with the add command is\nstored in the .gittrees file.\n\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n\nRerolled allowing for $IFS whitespace.\n\n contrib/subtree/git-subtree.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 8a23f58..b6e821e 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -527,6 +527,14 @@ cmd_add_repository()\n \trevs=FETCH_HEAD\n \tset -- $revs\n \tcmd_add_commit \"$@\"\n+\n+\t# now add it to our list of repos\n+\tgit config -f .gittrees --unset subtree.\"$dir\".url\n+\tgit config -f .gittrees --add subtree.\"$dir\".url \"$repository\"\n+\tgit config -f .gittrees --unset subtree.\"$dir\".path\n+\tgit config -f .gittrees --add subtree.\"$dir\".path \"$dir\"\n+\tgit config -f .gittrees --unset subtree.\"$dir\".branch\n+\tgit config -f .gittrees --add subtree.\"$dir\".branch \"$refspec\"\n }\n \n cmd_add_commit()\n-- \n1.8.2\n"},{"id":"212115","messageId":"1364158780-31211-1-git-send-email-pcampbell@kemitix.net","threadId":"33149","inReplyTo":"7vwqtebp3m.fsf@alter.siamese.dyndns.org","subject":"[PATCH] contrib/subtree: Add command from-submodule","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-24T20:59:40Z","receivedAt":"2013-03-24T20:59:40Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"Converts a git-submodule into a git-subtree.\n\nBased-on-patch-by: Peter Jaros <pjaros@pivotallabs.com>\nSigned-off-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 37 +++++++++++++++++++++++++++++++++++--\n 1 file changed, 35 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex a81dfef..5e3c0b8 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -14,6 +14,7 @@ git subtree merge --prefix=<prefix> <commit>\n git subtree pull  --prefix=<prefix> <repository> <refspec...>\n git subtree push  --prefix=<prefix> <repository> <refspec...>\n git subtree split --prefix=<prefix> <commit...>\n+git subtree from-submodule --prefix=<prefix>\n --\n h,help        show the help\n q             quiet\n@@ -114,7 +115,7 @@ prefix=\"${prefix%/}\";\n command=\"$1\"\n shift\n case \"$command\" in\n-\tadd|merge|pull) default= ;;\n+\tadd|merge|pull|from-submodule) default= ;;\n \tsplit|push) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n esac\n@@ -140,7 +141,14 @@ if ( test \"$command\" != \"pull\" ) && ( test \"$command\" != \"add\" ) && ( test \"$com\n \tfi\n fi\n \n+# map command to a function\n+case $command in\n+\tfrom-submodule) cmd=cmd_from_submodule;;\n+\t*) cmd=\"cmd_$command\";;\n+esac\n+\n debug \"command: {$command}\"\n+debug \"function: {$function}\"\n debug \"quiet: {$quiet}\"\n debug \"revs: {$revs}\"\n debug \"dir: {$dir}\"\n@@ -766,4 +774,29 @@ cmd_push()\n \tfi\n }\n \n-\"cmd_$command\" \"$@\"\n+cmd_from_submodule()\n+{\n+\tensure_clean\n+\n+\t# Remove references to submodule.\n+\tgit config --remove-section \"submodule.$prefix\"\n+\tgit config --file .gitmodules --remove-section \"submodule.$prefix\"\n+\tgit add .gitmodules\n+\n+\t# Move submodule aside.\n+\ttmp_repo=\"$(mktemp -d git-subtree.XXXXX)\"\n+\trm -r $tmp_repo\n+\tmv \"$prefix\" $tmp_repo\n+\tgit rm \"$prefix\"\n+\n+\t# Commit changes.\n+\tgit commit -m \"Remove '$prefix/' submodule\"\n+\n+\t# subtree add from submodule repo.\n+\tcmd_add_repository $tmp_repo HEAD\n+\n+\t# Remove submodule repo.\n+\trm -rf $tmp_repo\n+}\n+\n+\"$cmd\" \"$@\"\n-- \n1.8.2\n"},{"id":"212125","messageId":"CALeLG_=pV1Y0Qabw9C=3PACWUWPw2=ajacFG++djBxaO4S6z7g@mail.gmail.com","threadId":"33149","inReplyTo":"7vobeqbobz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-24T21:22:30Z","receivedAt":"2013-03-24T21:22:30Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":"On Mon, Mar 11, 2013 at 3:35 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> From: bibendi <bibendi@bk.ru>\n>>\n>> Look in the config file .gittrees for a default repository and\n>> refspec or commit when they are not provided on the command line.\n>>\n>> Uses the .gittrees config file in a similar way to how git-submodule\n>> uses the .gitmodules file.\n>\n> What the patch does can be read from the code, but what benefit\n> would users get by the extra file?\n\nHow about:\n\n\"Usually push and pull are to the same repository/branch that they were\noriginally added from. Add stores the repository/branch in .gittrees\nwhich push and pull can now default to if not provided on the command\nline.\"\n\n>>  cmd_pull()\n>>  {\n>> -     ensure_clean\n>> -     git fetch \"$@\" || exit $?\n>> -     revs=FETCH_HEAD\n>> -     set -- $revs\n>> -     cmd_merge \"$@\"\n>> +    if [ $# -ne 1 ]; then\n>\n> Broken indentation?\n>\n>> +         die \"You must provide <branch>\"\n>> +     fi\n>\n> It used to allow \"git fetch $there\" and let the configured\n> remote.$there.fetch refspec to decide what gets fetched, and also it\n> used to allow \"git fetch $there $that_branch\" to explicitly fetch\n> the named branch.  But this change insists that the user has to give\n> what gets fetched from the command line and forbids the user from\n> giving where to fetch from, it seems.  Isn't it a regression?  Why\n> is it a good idea to forbid such uses that the script used to\n> accept?\n>\n> The proposed log message does not explain why it is not a\n> regression, or why accepting some use patterns that the script used\n> to allow was a bug that needs to be diagnosed with this new\n> conditional.\n\nI think the patch was based on an older version of git-subtree before\n\"git fetch $there\" support was added. Will need to update it.\n\n>> +     if [ -e \"$dir\" ]; then\n>> +         ensure_clean\n>> +         repository=$(git config -f .gittrees subtree.$prefix.url)\n>> +         refspec=$1\n>> +         git fetch $repository $refspec || exit $?\n>> +         echo \"git fetch using: \" $repository $refspec\n>\n> Why are these variable references outside the dq pair?\n>\n\nThey're inside now.\n\nRerolling once I figure out the update for \"git fetch $there\" support.\n\n-- \nPaul [W] Campbell\n"}]}