{"thread":{"id":"32829","subject":"Assorted contrib/subtree Patches","startedAt":"2013-02-05T04:06:00Z","lastAt":"2013-02-18T19:46:56Z","messageCount":28,"participants":["David A. Greene","Junio C Hamano","Jakub Suder","James Nylen","greened@obbligato.org"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"208666","messageId":"1360037173-23291-1-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":null,"subject":"Assorted contrib/subtree Patches","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:00Z","receivedAt":"2013-02-05T04:06:00Z","isPatch":false,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"All of the patches I have received from others as well as a few of my\nown follow.  Probably the most controversial is a patch to remove\n--annotate.  After some discussion on the list it became clear that we\nreally want a more general commit rewrite feature.  Removing\n--annotate means we don't have to also support --unannotate and carry\nboth forward as backward-compatibility baggage.\n\nBefore --annotate was added, git-subtree would force an annotation of\n\"*\" on every split commit message.  It now does no such thing so\nthere's no need to unannotate anything.\n\nPlease review and integrate.  Thanks!\n\n                        -David\n"},{"id":"208667","messageId":"1360037173-23291-2-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 01/13] contrib/subtree: Remove Test Number Comments","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:01Z","receivedAt":"2013-02-05T04:06:01Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: \"David A. Greene\" <greened@obbligato.org>\n\nDelete the comments indicating test numbers as it causes maintenance\nheadaches.  t*.sh -i will help us find any broken tests.\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/t/t7900-subtree.sh |   55 ------------------------------------\n 1 file changed, 55 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex bc2eeb0..6cf9fb9 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -60,7 +60,6 @@ last_commit_message()\n \tgit log --pretty=format:%s -1\n }\n \n-# 1\n test_expect_success 'init subproj' '\n         test_create_repo subproj\n '\n@@ -68,7 +67,6 @@ test_expect_success 'init subproj' '\n # To the subproject!\n cd subproj\n \n-# 2\n test_expect_success 'add sub1' '\n         create sub1 &&\n         git commit -m \"sub1\" &&\n@@ -76,14 +74,12 @@ test_expect_success 'add sub1' '\n         git branch -m master subproj\n '\n \n-# 3\n test_expect_success 'add sub2' '\n         create sub2 &&\n         git commit -m \"sub2\" &&\n         git branch sub2\n '\n \n-# 4\n test_expect_success 'add sub3' '\n         create sub3 &&\n         git commit -m \"sub3\" &&\n@@ -93,7 +89,6 @@ test_expect_success 'add sub3' '\n # Back to mainline\n cd ..\n \n-# 5\n test_expect_success 'add main4' '\n         create main4 &&\n         git commit -m \"main4\" &&\n@@ -101,101 +96,85 @@ test_expect_success 'add main4' '\n         git branch subdir\n '\n \n-# 6\n test_expect_success 'fetch subproj history' '\n         git fetch ./subproj sub1 &&\n         git branch sub1 FETCH_HEAD\n '\n \n-# 7\n test_expect_success 'no subtree exists in main tree' '\n         test_must_fail git subtree merge --prefix=subdir sub1\n '\n \n-# 8\n test_expect_success 'no pull from non-existant subtree' '\n         test_must_fail git subtree pull --prefix=subdir ./subproj sub1\n '\n \n-# 9\n test_expect_success 'check if --message works for add' '\n         git subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n         check_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n         undo\n '\n \n-# 10\n test_expect_success 'check if --message works as -m and --prefix as -P' '\n         git subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n         check_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n         undo\n '\n \n-# 11\n test_expect_success 'check if --message works with squash too' '\n         git subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n         check_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n         undo\n '\n \n-# 12\n test_expect_success 'add subproj to mainline' '\n         git subtree add --prefix=subdir/ FETCH_HEAD &&\n         check_equal ''\"$(last_commit_message)\"'' \"Add '\"'subdir/'\"' from commit '\"'\"'''\"$(git rev-parse sub1)\"'''\"'\"'\"\n '\n \n-# 13\n # this shouldn't actually do anything, since FETCH_HEAD is already a parent\n test_expect_success 'merge fetched subproj' '\n         git merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n '\n \n-# 14\n test_expect_success 'add main-sub5' '\n         create subdir/main-sub5 &&\n         git commit -m \"main-sub5\"\n '\n \n-# 15\n test_expect_success 'add main6' '\n         create main6 &&\n         git commit -m \"main6 boring\"\n '\n \n-# 16\n test_expect_success 'add main-sub7' '\n         create subdir/main-sub7 &&\n         git commit -m \"main-sub7\"\n '\n \n-# 17\n test_expect_success 'fetch new subproj history' '\n         git fetch ./subproj sub2 &&\n         git branch sub2 FETCH_HEAD\n '\n \n-# 18\n test_expect_success 'check if --message works for merge' '\n         git subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n         check_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n         undo\n '\n \n-# 19\n test_expect_success 'check if --message for merge works with squash too' '\n         git subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n         check_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n         undo\n '\n \n-# 20\n test_expect_success 'merge new subproj history into subdir' '\n         git subtree merge --prefix=subdir FETCH_HEAD &&\n         git branch pre-split &&\n         check_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n '\n \n-# 21\n test_expect_success 'Check that prefix argument is required for split' '\n         echo \"You must provide the --prefix option.\" > expected &&\n         test_must_fail git subtree split > actual 2>&1 &&\n@@ -207,7 +186,6 @@ test_expect_success 'Check that prefix argument is required for split' '\n         rm -f expected actual\n '\n \n-# 22\n test_expect_success 'Check that the <prefix> exists for a split' '\n         echo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n         test_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n@@ -219,7 +197,6 @@ test_expect_success 'Check that the <prefix> exists for a split' '\n #        rm -f expected actual\n '\n \n-# 23\n test_expect_success 'check if --message works for split+rejoin' '\n         spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n         git branch spl1 \"$spl1\" &&\n@@ -227,7 +204,6 @@ test_expect_success 'check if --message works for split+rejoin' '\n         undo\n '\n \n-# 24\n test_expect_success 'check split with --branch' '\n         spl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n         undo &&\n@@ -235,7 +211,6 @@ test_expect_success 'check split with --branch' '\n         check_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n '\n \n-# 25\n test_expect_success 'check split with --branch for an existing branch' '\n         spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n         undo &&\n@@ -244,13 +219,10 @@ test_expect_success 'check split with --branch for an existing branch' '\n         check_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n '\n \n-# 26\n test_expect_success 'check split with --branch for an incompatible branch' '\n         test_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir\n '\n \n-\n-# 27\n test_expect_success 'check split+rejoin' '\n         spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n         undo &&\n@@ -258,7 +230,6 @@ test_expect_success 'check split+rejoin' '\n         check_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n '\n \n-# 28\n test_expect_success 'add main-sub8' '\n         create subdir/main-sub8 &&\n         git commit -m \"main-sub8\"\n@@ -267,14 +238,12 @@ test_expect_success 'add main-sub8' '\n # To the subproject!\n cd ./subproj\n \n-# 29\n test_expect_success 'merge split into subproj' '\n         git fetch .. spl1 &&\n         git branch spl1 FETCH_HEAD &&\n         git merge FETCH_HEAD\n '\n \n-# 30\n test_expect_success 'add sub9' '\n         create sub9 &&\n         git commit -m \"sub9\"\n@@ -283,19 +252,16 @@ test_expect_success 'add sub9' '\n # Back to mainline\n cd ..\n \n-# 31\n test_expect_success 'split for sub8' '\n         split2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n         git branch split2 \"$split2\"\n '\n \n-# 32\n test_expect_success 'add main-sub10' '\n         create subdir/main-sub10 &&\n         git commit -m \"main-sub10\"\n '\n \n-# 33\n test_expect_success 'split for sub10' '\n         spl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n         git branch spl3 \"$spl3\"\n@@ -304,7 +270,6 @@ test_expect_success 'split for sub10' '\n # To the subproject!\n cd ./subproj\n \n-# 34\n test_expect_success 'merge split into subproj' '\n         git fetch .. spl3 &&\n         git branch spl3 FETCH_HEAD &&\n@@ -318,13 +283,11 @@ chkms_sub=$(echo $chkms | multiline | sed 's,^,subdir/,' | fixnl)\n chks=\"sub1 sub2 sub3 sub9\"\n chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)\n \n-# 35\n test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n         subfiles=''\"$(git ls-files | fixnl)\"'' &&\n         check_equal \"$subfiles\" \"$chkms $chks\"\n '\n \n-# 36\n test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '\n         allchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n         check_equal \"$allchanges\" \"$chkms $chks\"\n@@ -333,20 +296,17 @@ test_expect_success 'make sure the subproj history *only* contains commits that\n # Back to mainline\n cd ..\n \n-# 37\n test_expect_success 'pull from subproj' '\n         git fetch ./subproj subproj-merge-spl3 &&\n         git branch subproj-merge-spl3 FETCH_HEAD &&\n         git subtree pull --prefix=subdir ./subproj subproj-merge-spl3\n '\n \n-# 38\n test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n         mainfiles=''\"$(git ls-files | fixnl)\"'' &&\n         check_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n '\n \n-# 39\n test_expect_success 'make sure each filename changed exactly once in the entire history' '\n         # main-sub?? and /subdir/main-sub?? both change, because those are the\n         # changes that were split into their own history.  And subdir/sub?? never\n@@ -355,12 +315,10 @@ test_expect_success 'make sure each filename changed exactly once in the entire\n         check_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n '\n \n-# 40\n test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n         check_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n '\n \n-# 41\n test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n         # They are meaningless to subproj since one side of the merge refers to the mainline\n         check_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n@@ -370,14 +328,12 @@ test_expect_success 'make sure no \"git subtree\" tagged commits make it into subp\n mkdir test2\n cd test2\n \n-# 42\n test_expect_success 'init main' '\n         test_create_repo main\n '\n \n cd main\n \n-# 43\n test_expect_success 'add main1' '\n         create main1 &&\n         git commit -m \"main1\"\n@@ -385,14 +341,12 @@ test_expect_success 'add main1' '\n \n cd ..\n \n-# 44\n test_expect_success 'init sub' '\n         test_create_repo sub\n '\n \n cd sub\n \n-# 45\n test_expect_success 'add sub2' '\n         create sub2 &&\n         git commit -m \"sub2\"\n@@ -402,7 +356,6 @@ cd ../main\n \n # check if split can find proper base without --onto\n \n-# 46\n test_expect_success 'add sub as subdir in main' '\n         git fetch ../sub master &&\n         git branch sub2 FETCH_HEAD &&\n@@ -411,7 +364,6 @@ test_expect_success 'add sub as subdir in main' '\n \n cd ../sub\n \n-# 47\n test_expect_success 'add sub3' '\n         create sub3 &&\n         git commit -m \"sub3\"\n@@ -419,20 +371,17 @@ test_expect_success 'add sub3' '\n \n cd ../main\n \n-# 48\n test_expect_success 'merge from sub' '\n         git fetch ../sub master &&\n         git branch sub3 FETCH_HEAD &&\n         git subtree merge --prefix subdir sub3\n '\n \n-# 49\n test_expect_success 'add main-sub4' '\n         create subdir/main-sub4 &&\n         git commit -m \"main-sub4\"\n '\n \n-# 50\n test_expect_success 'split for main-sub4 without --onto' '\n         git subtree split --prefix subdir --branch mainsub4\n '\n@@ -442,19 +391,16 @@ test_expect_success 'split for main-sub4 without --onto' '\n # have been sub3, but it was not, because its cache was not set to\n # itself)\n \n-# 51\n test_expect_success 'check that the commit parent is sub3' '\n         check_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n '\n \n-# 52\n test_expect_success 'add main-sub5' '\n         mkdir subdir2 &&\n         create subdir2/main-sub5 &&\n         git commit -m \"main-sub5\"\n '\n \n-# 53\n test_expect_success 'split for main-sub5 without --onto' '\n         # also test that we still can split out an entirely new subtree\n         # if the parent of the first commit in the tree is not empty,\n@@ -487,7 +433,6 @@ joincommits()\n \techo \"$commit $all\"\n }\n \n-# 54\n test_expect_success 'verify one file change per commit' '\n         x= &&\n         list=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n-- \n1.7.10.4\n"},{"id":"208668","messageId":"1360037173-23291-3-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 02/13] contrib/subtree: Use %B for Split Subject/Body","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:02Z","receivedAt":"2013-02-05T04:06:02Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nUse %B to format the commit message and body to avoid an extra newline\nif a commit only has a subject line.\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |    2 +-\n contrib/subtree/t/t7900-subtree.sh |   15 +++++++++++++++\n 2 files changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 920c664..5598210 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -296,7 +296,7 @@ copy_commit()\n \t# We're going to set some environment vars here, so\n \t# do it in a subshell to get rid of them safely later\n \tdebug copy_commit \"{$1}\" \"{$2}\" \"{$3}\"\n-\tgit log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%s%n%n%b' \"$1\" |\n+\tgit log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' \"$1\" |\n \t(\n \t\tread GIT_AUTHOR_NAME\n \t\tread GIT_AUTHOR_EMAIL\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 6cf9fb9..3f17f55 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -74,6 +74,10 @@ test_expect_success 'add sub1' '\n         git branch -m master subproj\n '\n \n+# Save this hash for testing later.\n+\n+subdir_hash=`git rev-parse HEAD`\n+\n test_expect_success 'add sub2' '\n         create sub2 &&\n         git commit -m \"sub2\" &&\n@@ -211,6 +215,17 @@ test_expect_success 'check split with --branch' '\n         check_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n '\n \n+test_expect_success 'check hash of split' '\n+        spl1=$(git subtree split --prefix subdir) &&\n+        undo &&\n+        git subtree split --prefix subdir --branch splitbr1test &&\n+        check_equal ''\"$(git rev-parse splitbr1test)\"'' \"$spl1\"\n+        git checkout splitbr1test &&\n+        new_hash=$(git rev-parse HEAD~2) &&\n+        git checkout mainline &&\n+        check_equal ''\"$new_hash\"'' \"$subdir_hash\"\n+'\n+\n test_expect_success 'check split with --branch for an existing branch' '\n         spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n         undo &&\n-- \n1.7.10.4\n"},{"id":"208672","messageId":"1360037173-23291-4-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 03/13] contrib/subtree: Better Error Handling for add","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:03Z","receivedAt":"2013-02-05T04:06:03Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: \"David A. Greene\" <greened@obbligato.org>\n\nCheck refspecs for validity before passing them on to other commands.\nThis lets us generate more helpful error messages.\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh |   12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 5598210..771f39d 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -497,12 +497,18 @@ cmd_add()\n \tensure_clean\n \t\n \tif [ $# -eq 1 ]; then\n-\t\t\"cmd_add_commit\" \"$@\"\n+\t    git rev-parse -q --verify \"$1^{commit}\" >/dev/null ||\n+\t    die \"'$1' does not refer to a commit\"\n+\n+\t    \"cmd_add_commit\" \"$@\"\n \telif [ $# -eq 2 ]; then\n-\t\t\"cmd_add_repository\" \"$@\"\n+\t    git rev-parse -q --verify \"$2^{commit}\" >/dev/null ||\n+\t    die \"'$2' does not refer to a commit\"\n+\n+\t    \"cmd_add_repository\" \"$@\"\n \telse\n \t    say \"error: parameters were '$@'\"\n-\t    die \"Provide either a refspec or a repository and refspec.\"\n+\t    die \"Provide either a commit or a repository and commit.\"\n \tfi\n }\n \n-- \n1.7.10.4\n"},{"id":"208669","messageId":"1360037173-23291-5-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 04/13] contrib/subtree: Fix Synopsis","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:04Z","receivedAt":"2013-02-05T04:06:04Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: \"David A. Greene\" <greened@obbligato.org>\n\nFix the documentation of add to show that a repository can be\nspecified along with a commit.\n\nSuggested by Yann Dirson <dirson@bertin.fr>.\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh  |    6 ++++++\n contrib/subtree/git-subtree.txt |    3 ++-\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 771f39d..8a23f58 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -9,6 +9,7 @@ if [ $# -eq 0 ]; then\n fi\n 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 push  --prefix=<prefix> <repository> <refspec...>\n@@ -502,6 +503,11 @@ cmd_add()\n \n \t    \"cmd_add_commit\" \"$@\"\n \telif [ $# -eq 2 ]; then\n+\t    # Technically we could accept a refspec here but we're\n+\t    # just going to turn around and add FETCH_HEAD under the\n+\t    # specified directory.  Allowing a refspec might be\n+\t    # misleading because we won't do anything with any other\n+\t    # branches fetched via the refspec.\n \t    git rev-parse -q --verify \"$2^{commit}\" >/dev/null ||\n \t    die \"'$2' does not refer to a commit\"\n \ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex c5bce41..7ba853e 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -9,7 +9,8 @@ git-subtree - Merge subtrees together and split repository into subtrees\n SYNOPSIS\n --------\n [verse]\n-'git subtree' add   -P <prefix> <commit>\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-- \n1.7.10.4\n"},{"id":"208670","messageId":"1360037173-23291-6-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 05/13] contrib/subtree: Honor DESTDIR","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:05Z","receivedAt":"2013-02-05T04:06:05Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Adam Tkac <atkac@redhat.com>\n\nTeach git-subtree's Makefile to honor DESTDIR.\n\nSigned-off-by: Adam Tkac <atkac@redhat.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/Makefile |    4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile\nindex 05cdd5c..36ae3e4 100644\n--- a/contrib/subtree/Makefile\n+++ b/contrib/subtree/Makefile\n@@ -30,12 +30,12 @@ $(GIT_SUBTREE): $(GIT_SUBTREE_SH)\n doc: $(GIT_SUBTREE_DOC)\n \n install: $(GIT_SUBTREE)\n-\t$(INSTALL) -m 755 $(GIT_SUBTREE) $(libexecdir)\n+\t$(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(libexecdir)\n \n install-doc: install-man\n \n install-man: $(GIT_SUBTREE_DOC)\n-\t$(INSTALL) -m 644 $^ $(man1dir)\n+\t$(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)\n \n $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)\n \txmlto -m $(MANPAGE_NORMAL_XSL)  man $^\n-- \n1.7.10.4\n"},{"id":"208671","messageId":"1360037173-23291-7-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 06/13] contrib/subtree: Make the Manual Directory if Needed","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:06Z","receivedAt":"2013-02-05T04:06:06Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: \"Jesper L. Nielsen\" <lyager@gmail.com>\n\nBefore install git-subtree documentation, make sure the manpage\ndirectory exists.\n\nSigned-off-by: Jesper L. Nielsen <lyager@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/Makefile |    1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile\nindex 36ae3e4..b507505 100644\n--- a/contrib/subtree/Makefile\n+++ b/contrib/subtree/Makefile\n@@ -35,6 +35,7 @@ install: $(GIT_SUBTREE)\n install-doc: install-man\n \n install-man: $(GIT_SUBTREE_DOC)\n+\t$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)\n \t$(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)\n \n $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)\n-- \n1.7.10.4\n"},{"id":"208675","messageId":"1360037173-23291-8-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 07/13] contrib/subtree: Fix whitespaces","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:07Z","receivedAt":"2013-02-05T04:06:07Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nPrevious code does not fulfill Git's whitespace policy.\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |   68 ++++----\n contrib/subtree/git-subtree.txt    |   42 ++---\n contrib/subtree/t/t7900-subtree.sh |  314 ++++++++++++++++++------------------\n 3 files changed, 212 insertions(+), 212 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 8a23f58..6c3929b 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -5,7 +5,7 @@\n # Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com>\n #\n if [ $# -eq 0 ]; then\n-    set -- -h\n+\tset -- -h\n fi\n OPTS_SPEC=\"\\\n git subtree add   --prefix=<prefix> <commit>\n@@ -111,9 +111,9 @@ if [ -z \"$prefix\" ]; then\n fi\n \n case \"$command\" in\n-\tadd) [ -e \"$prefix\" ] && \n+\tadd) [ -e \"$prefix\" ] &&\n \t\tdie \"prefix '$prefix' already exists.\" ;;\n-\t*)   [ -e \"$prefix\" ] || \n+\t*)   [ -e \"$prefix\" ] ||\n \t\tdie \"'$prefix' does not exist; use 'git subtree add'\" ;;\n esac\n \n@@ -182,8 +182,8 @@ cache_set()\n \toldrev=\"$1\"\n \tnewrev=\"$2\"\n \tif [ \"$oldrev\" != \"latest_old\" \\\n-\t     -a \"$oldrev\" != \"latest_new\" \\\n-\t     -a -e \"$cachedir/$oldrev\" ]; then\n+\t\t-a \"$oldrev\" != \"latest_new\" \\\n+\t\t-a -e \"$cachedir/$oldrev\" ]; then\n \t\tdie \"cache for $oldrev already exists!\"\n \tfi\n \techo \"$newrev\" >\"$cachedir/$oldrev\"\n@@ -305,7 +305,7 @@ copy_commit()\n \t\tread GIT_COMMITTER_NAME\n \t\tread GIT_COMMITTER_EMAIL\n \t\tread GIT_COMMITTER_DATE\n-\t\texport  GIT_AUTHOR_NAME \\\n+\t\texport GIT_AUTHOR_NAME \\\n \t\t\tGIT_AUTHOR_EMAIL \\\n \t\t\tGIT_AUTHOR_DATE \\\n \t\t\tGIT_COMMITTER_NAME \\\n@@ -328,7 +328,7 @@ add_msg()\n \tfi\n \tcat <<-EOF\n \t\t$commit_message\n-\t\t\n+\n \t\tgit-subtree-dir: $dir\n \t\tgit-subtree-mainline: $latest_old\n \t\tgit-subtree-split: $latest_new\n@@ -356,7 +356,7 @@ rejoin_msg()\n \tfi\n \tcat <<-EOF\n \t\t$commit_message\n-\t\t\n+\n \t\tgit-subtree-dir: $dir\n \t\tgit-subtree-mainline: $latest_old\n \t\tgit-subtree-split: $latest_new\n@@ -369,7 +369,7 @@ squash_msg()\n \toldsub=\"$2\"\n \tnewsub=\"$3\"\n \tnewsub_short=$(git rev-parse --short \"$newsub\")\n-\t\n+\n \tif [ -n \"$oldsub\" ]; then\n \t\toldsub_short=$(git rev-parse --short \"$oldsub\")\n \t\techo \"Squashed '$dir/' changes from $oldsub_short..$newsub_short\"\n@@ -379,7 +379,7 @@ squash_msg()\n \telse\n \t\techo \"Squashed '$dir/' content from commit $newsub_short\"\n \tfi\n-\t\n+\n \techo\n \techo \"git-subtree-dir: $dir\"\n \techo \"git-subtree-split: $newsub\"\n@@ -428,7 +428,7 @@ new_squash_commit()\n \tnewsub=\"$3\"\n \ttree=$(toptree_for_commit $newsub) || exit $?\n \tif [ -n \"$old\" ]; then\n-\t\tsquash_msg \"$dir\" \"$oldsub\" \"$newsub\" | \n+\t\tsquash_msg \"$dir\" \"$oldsub\" \"$newsub\" |\n \t\t\tgit commit-tree \"$tree\" -p \"$old\" || exit $?\n \telse\n \t\tsquash_msg \"$dir\" \"\" \"$newsub\" |\n@@ -456,7 +456,7 @@ copy_or_skip()\n \t\telse\n \t\t\tnonidentical=\"$parent\"\n \t\tfi\n-\t\t\n+\n \t\t# sometimes both old parents map to the same newparent;\n \t\t# eliminate duplicates\n \t\tis_new=1\n@@ -471,7 +471,7 @@ copy_or_skip()\n \t\t\tp=\"$p -p $parent\"\n \t\tfi\n \tdone\n-\t\n+\n \tif [ -n \"$identical\" ]; then\n \t\techo $identical\n \telse\n@@ -496,7 +496,7 @@ cmd_add()\n \tfi\n \n \tensure_clean\n-\t\n+\n \tif [ $# -eq 1 ]; then\n \t    git rev-parse -q --verify \"$1^{commit}\" >/dev/null ||\n \t    die \"'$1' does not refer to a commit\"\n@@ -513,8 +513,8 @@ cmd_add()\n \n \t    \"cmd_add_repository\" \"$@\"\n \telse\n-\t    say \"error: parameters were '$@'\"\n-\t    die \"Provide either a commit or a repository and commit.\"\n+\t\tsay \"error: parameters were '$@'\"\n+\t\tdie \"Provide either a commit or a repository and commit.\"\n \tfi\n }\n \n@@ -534,19 +534,19 @@ cmd_add_commit()\n \trevs=$(git rev-parse $default --revs-only \"$@\") || exit $?\n \tset -- $revs\n \trev=\"$1\"\n-\t\n+\n \tdebug \"Adding $dir as '$rev'...\"\n \tgit read-tree --prefix=\"$dir\" $rev || exit $?\n \tgit checkout -- \"$dir\" || exit $?\n \ttree=$(git write-tree) || exit $?\n-\t\n+\n \theadrev=$(git rev-parse HEAD) || exit $?\n \tif [ -n \"$headrev\" -a \"$headrev\" != \"$rev\" ]; then\n \t\theadp=\"-p $headrev\"\n \telse\n \t\theadp=\n \tfi\n-\t\n+\n \tif [ -n \"$squash\" ]; then\n \t\trev=$(new_squash_commit \"\" \"\" \"$rev\") || exit $?\n \t\tcommit=$(add_squashed_msg \"$rev\" \"$dir\" |\n@@ -556,7 +556,7 @@ cmd_add_commit()\n \t\t\t git commit-tree $tree $headp -p \"$rev\") || exit $?\n \tfi\n \tgit reset \"$commit\" || exit $?\n-\t\n+\n \tsay \"Added dir '$dir'\"\n }\n \n@@ -564,7 +564,7 @@ cmd_split()\n {\n \tdebug \"Splitting $dir...\"\n \tcache_setup || exit $?\n-\t\n+\n \tif [ -n \"$onto\" ]; then\n \t\tdebug \"Reading history for --onto=$onto...\"\n \t\tgit rev-list $onto |\n@@ -575,13 +575,13 @@ cmd_split()\n \t\t\tcache_set $rev $rev\n \t\tdone\n \tfi\n-\t\n+\n \tif [ -n \"$ignore_joins\" ]; then\n \t\tunrevs=\n \telse\n \t\tunrevs=\"$(find_existing_splits \"$dir\" \"$revs\")\"\n \tfi\n-\t\n+\n \t# We can't restrict rev-list to only $dir here, because some of our\n \t# parents have the $dir contents the root, and those won't match.\n \t# (and rev-list --follow doesn't seem to solve this)\n@@ -603,12 +603,12 @@ cmd_split()\n \t\tdebug \"  parents: $parents\"\n \t\tnewparents=$(cache_get $parents)\n \t\tdebug \"  newparents: $newparents\"\n-\t\t\n+\n \t\ttree=$(subtree_for_commit $rev \"$dir\")\n \t\tdebug \"  tree is: $tree\"\n \n \t\tcheck_parents $parents\n-\t\t\n+\n \t\t# ugly.  is there no better way to tell if this is a subtree\n \t\t# vs. a mainline commit?  Does it matter?\n \t\tif [ -z $tree ]; then\n@@ -629,7 +629,7 @@ cmd_split()\n \tif [ -z \"$latest_new\" ]; then\n \t\tdie \"No new revisions were found\"\n \tfi\n-\t\n+\n \tif [ -n \"$rejoin\" ]; then\n \t\tdebug \"Merging split branch into HEAD...\"\n \t\tlatest_old=$(cache_get latest_old)\n@@ -657,13 +657,13 @@ cmd_merge()\n {\n \trevs=$(git rev-parse $default --revs-only \"$@\") || exit $?\n \tensure_clean\n-\t\n+\n \tset -- $revs\n \tif [ $# -ne 1 ]; then\n \t\tdie \"You must provide exactly one revision.  Got: '$revs'\"\n \tfi\n \trev=\"$1\"\n-\t\n+\n \tif [ -n \"$squash\" ]; then\n \t\tfirst_split=\"$(find_latest_squash \"$dir\")\"\n \t\tif [ -z \"$first_split\" ]; then\n@@ -709,15 +709,15 @@ cmd_pull()\n cmd_push()\n {\n \tif [ $# -ne 2 ]; then\n-\t    die \"You must provide <repository> <refspec>\"\n+\t\tdie \"You must provide <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-\t    repository=$1\n-\t    refspec=$2\n-\t    echo \"git push using: \" $repository $refspec\n-\t    git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec\n+\t\trepository=$1\n+\t\trefspec=$2\n+\t\techo \"git push using: \" $repository $refspec\n+\t\tgit push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec\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 \ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 7ba853e..aae9d19 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -87,15 +87,15 @@ merge::\n \tgo back in time from v2.5 to v2.4, for example.  If your\n \tmerge introduces a conflict, you can resolve it in the\n \tusual ways.\n-\t\n+\n 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 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+\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@@ -107,19 +107,19 @@ split::\n \tcontents of <prefix> at the root of the project instead\n \tof in a subdirectory.  Thus, the newly created history\n \tis suitable for export as a separate git repository.\n-\t\n+\n \tAfter splitting successfully, a single commit id is\n \tprinted to stdout.  This corresponds to the HEAD of the\n \tnewly created tree, which you can manipulate however you\n \twant.\n-\t\n+\n \tRepeated splits of exactly the same history are\n \tguaranteed to be identical (ie. to produce the same\n \tcommit ids).  Because of this, if you add new commits\n \tand then re-split, the new commits will be attached as\n \tcommits on top of the history you generated last time,\n \tso 'git merge' and friends will work as expected.\n-\t\n+\n \tNote that if you use '--squash' when you merge, you\n \tshould usually not just '--rejoin' when you split.\n \n@@ -156,26 +156,26 @@ OPTIONS FOR add, merge, push, pull\n \tproject, produce only a single commit that contains all\n \tthe differences you want to merge, and then merge that\n \tnew commit into your project.\n-\t\n+\n \tUsing this option helps to reduce log clutter. People\n \trarely want to see every change that happened between\n \tv1.0 and v1.1 of the library they're using, since none of the\n \tinterim versions were ever included in their application.\n-\t\n+\n \tUsing '--squash' also helps avoid problems when the same\n \tsubproject is included multiple times in the same\n \tproject, or is removed and then re-added.  In such a\n \tcase, it doesn't make sense to combine the histories\n \tanyway, since it's unclear which part of the history\n \tbelongs to which subtree.\n-\t\n+\n \tFurthermore, with '--squash', you can switch back and\n \tforth between different versions of a subtree, rather\n \tthan strictly forward.  'git subtree merge --squash'\n \talways adjusts the subtree to match the exactly\n \tspecified commit, even if getting to that commit would\n \trequire undoing some changes that were added earlier.\n-\t\n+\n \tWhether or not you use '--squash', changes made in your\n \tlocal repository remain intact and can be later split\n \tand send upstream to the subproject.\n@@ -191,11 +191,11 @@ OPTIONS FOR split\n \tcommits with the same commit message, but possibly\n \tdifferent content, from the original commits, this can help\n \tto differentiate them and avoid confusion.\n-\t\n+\n \tWhenever you split, you need to use the same\n \t<annotation>, or else you don't have a guarantee that\n \tthe new re-created history will be identical to the old\n-\tone.  That will prevent merging from working correctly. \n+\tone.  That will prevent merging from working correctly.\n \tgit subtree tries to make it work anyway, particularly\n \tif you use --rejoin, but it may not always be effective.\n \n@@ -204,8 +204,8 @@ OPTIONS FOR split\n \tThis option is only valid for the split command.\n \n \tAfter generating the synthetic history, create a new\n-\tbranch called <branch> that contains the new history. \n-\tThis is suitable for immediate pushing upstream. \n+\tbranch called <branch> that contains the new history.\n+\tThis is suitable for immediate pushing upstream.\n \t<branch> must not already exist.\n \n --ignore-joins::\n@@ -228,7 +228,7 @@ OPTIONS FOR split\n \trevision of the subproject's history that was imported\n \tinto your project, and git subtree will attempt to build\n \tits history from there.\n-\t\n+\n \tIf you used 'git subtree add', you should never need\n \tthis option.\n \n@@ -239,18 +239,18 @@ OPTIONS FOR split\n \thistory back into your main project.  That way, future\n \tsplits can search only the part of history that has\n \tbeen added since the most recent --rejoin.\n-\t\n+\n \tIf your split commits end up merged into the upstream\n \tsubproject, and then you want to get the latest upstream\n \tversion, this will allow git's merge algorithm to more\n \tintelligently avoid conflicts (since it knows these\n \tsynthetic commits are already part of the upstream\n \trepository).\n-\t\n+\n \tUnfortunately, using this option results in 'git log'\n \tshowing an extra copy of every new commit that was\n \tcreated (the original, and the synthetic one).\n-\t\n+\n \tIf you do all your merges with '--squash', don't use\n \t'--rejoin' when you split, because you don't want the\n \tsubproject's history to be part of your project anyway.\n@@ -285,7 +285,7 @@ First, get your own copy of the git.git repository:\n \t$ cd test-git\n \n gitweb (commit 1130ef3) was merged into git as of commit\n-0a8f4f0, after which it was no longer maintained separately. \n+0a8f4f0, after which it was no longer maintained separately.\n But imagine it had been maintained separately, and we wanted to\n extract git's changes to gitweb since that time, to share with\n the upstream.  You could do this:\n@@ -295,7 +295,7 @@ the upstream.  You could do this:\n         \t--branch gitweb-latest\n         $ gitk gitweb-latest\n         $ git push git@github.com:whatever/gitweb.git gitweb-latest:master\n-        \n+\n (We use '0a8f4f0^..' because that means \"all the changes from\n 0a8f4f0 to the current version, including 0a8f4f0 itself.\")\n \n@@ -329,7 +329,7 @@ And fast forward again:\n \t$ git subtree merge --prefix=gitweb --squash gitweb-latest\n \n And notice that your change is still intact:\n-\t\n+\n \t$ ls -l gitweb/myfile\n \n And you can split it out and look at your changes versus\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 3f17f55..e6a3702 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -23,7 +23,7 @@ check_equal()\n {\n \ttest_debug 'echo'\n \ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n-\ttest_debug \"echo \\\"      b:\\\" \\\"{$2}\\\"\"\n+\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n \tif [ \"$1\" = \"$2\" ]; then\n \t\treturn 0\n \telse\n@@ -61,17 +61,17 @@ last_commit_message()\n }\n \n test_expect_success 'init subproj' '\n-        test_create_repo subproj\n+\t\ttest_create_repo subproj\n '\n \n # To the subproject!\n cd subproj\n \n test_expect_success 'add sub1' '\n-        create sub1 &&\n-        git commit -m \"sub1\" &&\n-        git branch sub1 &&\n-        git branch -m master subproj\n+\t\tcreate sub1 &&\n+\t\tgit commit -m \"sub1\" &&\n+\t\tgit branch sub1 &&\n+\t\tgit branch -m master subproj\n '\n \n # Save this hash for testing later.\n@@ -79,140 +79,140 @@ test_expect_success 'add sub1' '\n subdir_hash=`git rev-parse HEAD`\n \n test_expect_success 'add sub2' '\n-        create sub2 &&\n-        git commit -m \"sub2\" &&\n-        git branch sub2\n+\t\tcreate sub2 &&\n+\t\tgit commit -m \"sub2\" &&\n+\t\tgit branch sub2\n '\n \n test_expect_success 'add sub3' '\n-        create sub3 &&\n-        git commit -m \"sub3\" &&\n-        git branch sub3\n+\t\tcreate sub3 &&\n+\t\tgit commit -m \"sub3\" &&\n+\t\tgit branch sub3\n '\n \n # Back to mainline\n cd ..\n \n test_expect_success 'add main4' '\n-        create main4 &&\n-        git commit -m \"main4\" &&\n-        git branch -m master mainline &&\n-        git branch subdir\n+\t\tcreate main4 &&\n+\t\tgit commit -m \"main4\" &&\n+\t\tgit branch -m master mainline &&\n+\t\tgit branch subdir\n '\n \n test_expect_success 'fetch subproj history' '\n-        git fetch ./subproj sub1 &&\n-        git branch sub1 FETCH_HEAD\n+\t\tgit fetch ./subproj sub1 &&\n+\t\tgit branch sub1 FETCH_HEAD\n '\n \n test_expect_success 'no subtree exists in main tree' '\n-        test_must_fail git subtree merge --prefix=subdir sub1\n+\t\ttest_must_fail git subtree merge --prefix=subdir sub1\n '\n \n test_expect_success 'no pull from non-existant subtree' '\n-        test_must_fail git subtree pull --prefix=subdir ./subproj sub1\n+\t\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n '\n \n test_expect_success 'check if --message works for add' '\n-        git subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n-        undo\n+\t\tgit subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n+\t\tundo\n '\n \n test_expect_success 'check if --message works as -m and --prefix as -P' '\n-        git subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n-        undo\n+\t\tgit subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n+\t\tundo\n '\n \n test_expect_success 'check if --message works with squash too' '\n-        git subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n-        undo\n+\t\tgit subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n+\t\tundo\n '\n \n test_expect_success 'add subproj to mainline' '\n-        git subtree add --prefix=subdir/ FETCH_HEAD &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Add '\"'subdir/'\"' from commit '\"'\"'''\"$(git rev-parse sub1)\"'''\"'\"'\"\n+\t\tgit subtree add --prefix=subdir/ FETCH_HEAD &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Add '\"'subdir/'\"' from commit '\"'\"'''\"$(git rev-parse sub1)\"'''\"'\"'\"\n '\n \n # this shouldn't actually do anything, since FETCH_HEAD is already a parent\n test_expect_success 'merge fetched subproj' '\n-        git merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n+\t\tgit merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n '\n \n test_expect_success 'add main-sub5' '\n-        create subdir/main-sub5 &&\n-        git commit -m \"main-sub5\"\n+\t\tcreate subdir/main-sub5 &&\n+\t\tgit commit -m \"subproj: main-sub5\"\n '\n \n test_expect_success 'add main6' '\n-        create main6 &&\n-        git commit -m \"main6 boring\"\n+\t\tcreate main6 &&\n+\t\tgit commit -m \"main6 boring\"\n '\n \n test_expect_success 'add main-sub7' '\n-        create subdir/main-sub7 &&\n-        git commit -m \"main-sub7\"\n+\t\tcreate subdir/main-sub7 &&\n+\t\tgit commit -m \"subproj: main-sub7\"\n '\n \n test_expect_success 'fetch new subproj history' '\n-        git fetch ./subproj sub2 &&\n-        git branch sub2 FETCH_HEAD\n+\t\tgit fetch ./subproj sub2 &&\n+\t\tgit branch sub2 FETCH_HEAD\n '\n \n test_expect_success 'check if --message works for merge' '\n-        git subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n-        undo\n+\t\tgit subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n+\t\tundo\n '\n \n test_expect_success 'check if --message for merge works with squash too' '\n-        git subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n-        undo\n+\t\tgit subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n+\t\tundo\n '\n \n test_expect_success 'merge new subproj history into subdir' '\n-        git subtree merge --prefix=subdir FETCH_HEAD &&\n-        git branch pre-split &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit branch pre-split &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n '\n \n test_expect_success 'Check that prefix argument is required for split' '\n-        echo \"You must provide the --prefix option.\" > expected &&\n-        test_must_fail git subtree split > actual 2>&1 &&\n-        test_debug \"echo -n expected: \" &&\n-        test_debug \"cat expected\" &&\n-        test_debug \"echo -n actual: \" &&\n-        test_debug \"cat actual\" &&\n-        test_cmp expected actual &&\n-        rm -f expected actual\n+\t\techo \"You must provide the --prefix option.\" > expected &&\n+\t\ttest_must_fail git subtree split > actual 2>&1 &&\n+\t\ttest_debug \"echo -n expected: \" &&\n+\t\ttest_debug \"cat expected\" &&\n+\t\ttest_debug \"echo -n actual: \" &&\n+\t\ttest_debug \"cat actual\" &&\n+\t\ttest_cmp expected actual &&\n+\t\trm -f expected actual\n '\n \n test_expect_success 'Check that the <prefix> exists for a split' '\n-        echo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n-        test_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n-        test_debug \"echo -n expected: \" &&\n-        test_debug \"cat expected\" &&\n-        test_debug \"echo -n actual: \" &&\n-        test_debug \"cat actual\" &&\n-        test_cmp expected actual\n-#        rm -f expected actual\n+\t\techo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n+\t\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n+\t\ttest_debug \"echo -n expected: \" &&\n+\t\ttest_debug \"cat expected\" &&\n+\t\ttest_debug \"echo -n actual: \" &&\n+\t\ttest_debug \"cat actual\" &&\n+\t\ttest_cmp expected actual\n+#\t\t rm -f expected actual\n '\n \n test_expect_success 'check if --message works for split+rejoin' '\n-        spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n-        git branch spl1 \"$spl1\" &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n-        undo\n+\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\t\tgit branch spl1 \"$spl1\" &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n+\t\tundo\n '\n \n test_expect_success 'check split with --branch' '\n-        spl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n-        undo &&\n-        git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr1 &&\n-        check_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n+\t\tspl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n+\t\tundo &&\n+\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr1 &&\n+\t\tcheck_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n '\n \n test_expect_success 'check hash of split' '\n@@ -227,69 +227,69 @@ test_expect_success 'check hash of split' '\n '\n \n test_expect_success 'check split with --branch for an existing branch' '\n-        spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n-        undo &&\n-        git branch splitbr2 sub1 &&\n-        git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n-        check_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n+\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\t\tundo &&\n+\t\tgit branch splitbr2 sub1 &&\n+\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n+\t\tcheck_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n '\n \n test_expect_success 'check split with --branch for an incompatible branch' '\n-        test_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir\n+\t\ttest_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir\n '\n \n test_expect_success 'check split+rejoin' '\n-        spl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n-        undo &&\n-        git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n-        check_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n+\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\t\tundo &&\n+\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n+\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n '\n \n test_expect_success 'add main-sub8' '\n-        create subdir/main-sub8 &&\n-        git commit -m \"main-sub8\"\n+\t\tcreate subdir/main-sub8 &&\n+\t\tgit commit -m \"main-sub8\"\n '\n \n # To the subproject!\n cd ./subproj\n \n test_expect_success 'merge split into subproj' '\n-        git fetch .. spl1 &&\n-        git branch spl1 FETCH_HEAD &&\n-        git merge FETCH_HEAD\n+\t\tgit fetch .. spl1 &&\n+\t\tgit branch spl1 FETCH_HEAD &&\n+\t\tgit merge FETCH_HEAD\n '\n \n test_expect_success 'add sub9' '\n-        create sub9 &&\n-        git commit -m \"sub9\"\n+\t\tcreate sub9 &&\n+\t\tgit commit -m \"sub9\"\n '\n \n # Back to mainline\n cd ..\n \n test_expect_success 'split for sub8' '\n-        split2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n-        git branch split2 \"$split2\"\n+\t\tsplit2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n+\t\tgit branch split2 \"$split2\"\n '\n \n test_expect_success 'add main-sub10' '\n-        create subdir/main-sub10 &&\n-        git commit -m \"main-sub10\"\n+\t\tcreate subdir/main-sub10 &&\n+\t\tgit commit -m \"main-sub10\"\n '\n \n test_expect_success 'split for sub10' '\n-        spl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n-        git branch spl3 \"$spl3\"\n+\t\tspl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n+\t\tgit branch spl3 \"$spl3\"\n '\n \n # To the subproject!\n cd ./subproj\n \n test_expect_success 'merge split into subproj' '\n-        git fetch .. spl3 &&\n-        git branch spl3 FETCH_HEAD &&\n-        git merge FETCH_HEAD &&\n-        git branch subproj-merge-spl3\n+\t\tgit fetch .. spl3 &&\n+\t\tgit branch spl3 FETCH_HEAD &&\n+\t\tgit merge FETCH_HEAD &&\n+\t\tgit branch subproj-merge-spl3\n '\n \n chkm=\"main4 main6\"\n@@ -299,44 +299,44 @@ chks=\"sub1 sub2 sub3 sub9\"\n chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)\n \n test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n-        subfiles=''\"$(git ls-files | fixnl)\"'' &&\n-        check_equal \"$subfiles\" \"$chkms $chks\"\n+\t\tsubfiles=''\"$(git ls-files | fixnl)\"'' &&\n+\t\tcheck_equal \"$subfiles\" \"$chkms $chks\"\n '\n \n test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '\n-        allchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-        check_equal \"$allchanges\" \"$chkms $chks\"\n+\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n+\t\tcheck_equal \"$allchanges\" \"$chkms $chks\"\n '\n \n # Back to mainline\n cd ..\n \n test_expect_success 'pull from subproj' '\n-        git fetch ./subproj subproj-merge-spl3 &&\n-        git branch subproj-merge-spl3 FETCH_HEAD &&\n-        git subtree pull --prefix=subdir ./subproj subproj-merge-spl3\n+\t\tgit fetch ./subproj subproj-merge-spl3 &&\n+\t\tgit branch subproj-merge-spl3 FETCH_HEAD &&\n+\t\tgit subtree pull --prefix=subdir ./subproj subproj-merge-spl3\n '\n \n test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n-        mainfiles=''\"$(git ls-files | fixnl)\"'' &&\n-        check_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n+\t\tmainfiles=''\"$(git ls-files | fixnl)\"'' &&\n+\t\tcheck_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n '\n \n test_expect_success 'make sure each filename changed exactly once in the entire history' '\n-        # main-sub?? and /subdir/main-sub?? both change, because those are the\n-        # changes that were split into their own history.  And subdir/sub?? never\n-        # change, since they were *only* changed in the subtree branch.\n-        allchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-        check_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n+\t\t# main-sub?? and /subdir/main-sub?? both change, because those are the\n+\t\t# changes that were split into their own history.  And subdir/sub?? never\n+\t\t# change, since they were *only* changed in the subtree branch.\n+\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n+\t\tcheck_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n '\n \n test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n-        check_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n+\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n '\n \n test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n-        # They are meaningless to subproj since one side of the merge refers to the mainline\n-        check_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n+\t\t# They are meaningless to subproj since one side of the merge refers to the mainline\n+\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n '\n \n # prepare second pair of repositories\n@@ -344,27 +344,27 @@ mkdir test2\n cd test2\n \n test_expect_success 'init main' '\n-        test_create_repo main\n+\t\ttest_create_repo main\n '\n \n cd main\n \n test_expect_success 'add main1' '\n-        create main1 &&\n-        git commit -m \"main1\"\n+\t\tcreate main1 &&\n+\t\tgit commit -m \"main1\"\n '\n \n cd ..\n \n test_expect_success 'init sub' '\n-        test_create_repo sub\n+\t\ttest_create_repo sub\n '\n \n cd sub\n \n test_expect_success 'add sub2' '\n-        create sub2 &&\n-        git commit -m \"sub2\"\n+\t\tcreate sub2 &&\n+\t\tgit commit -m \"sub2\"\n '\n \n cd ../main\n@@ -372,33 +372,33 @@ cd ../main\n # check if split can find proper base without --onto\n \n test_expect_success 'add sub as subdir in main' '\n-        git fetch ../sub master &&\n-        git branch sub2 FETCH_HEAD &&\n-        git subtree add --prefix subdir sub2\n+\t\tgit fetch ../sub master &&\n+\t\tgit branch sub2 FETCH_HEAD &&\n+\t\tgit subtree add --prefix subdir sub2\n '\n \n cd ../sub\n \n test_expect_success 'add sub3' '\n-        create sub3 &&\n-        git commit -m \"sub3\"\n+\t\tcreate sub3 &&\n+\t\tgit commit -m \"sub3\"\n '\n \n cd ../main\n \n test_expect_success 'merge from sub' '\n-        git fetch ../sub master &&\n-        git branch sub3 FETCH_HEAD &&\n-        git subtree merge --prefix subdir sub3\n+\t\tgit fetch ../sub master &&\n+\t\tgit branch sub3 FETCH_HEAD &&\n+\t\tgit subtree merge --prefix subdir sub3\n '\n \n test_expect_success 'add main-sub4' '\n-        create subdir/main-sub4 &&\n-        git commit -m \"main-sub4\"\n+\t\tcreate subdir/main-sub4 &&\n+\t\tgit commit -m \"main-sub4\"\n '\n \n test_expect_success 'split for main-sub4 without --onto' '\n-        git subtree split --prefix subdir --branch mainsub4\n+\t\tgit subtree split --prefix subdir --branch mainsub4\n '\n \n # at this point, the new commit parent should be sub3 if it is not,\n@@ -407,21 +407,21 @@ test_expect_success 'split for main-sub4 without --onto' '\n # itself)\n \n test_expect_success 'check that the commit parent is sub3' '\n-        check_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n+\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n '\n \n test_expect_success 'add main-sub5' '\n-        mkdir subdir2 &&\n-        create subdir2/main-sub5 &&\n-        git commit -m \"main-sub5\"\n+\t\tmkdir subdir2 &&\n+\t\tcreate subdir2/main-sub5 &&\n+\t\tgit commit -m \"main-sub5\"\n '\n \n test_expect_success 'split for main-sub5 without --onto' '\n-        # also test that we still can split out an entirely new subtree\n-        # if the parent of the first commit in the tree is not empty,\n-        # then the new subtree has accidently been attached to something\n-        git subtree split --prefix subdir2 --branch mainsub5 &&\n-        check_equal ''\"$(git log --pretty=format:%P -1 mainsub5)\"'' \"\"\n+\t\t# also test that we still can split out an entirely new subtree\n+\t\t# if the parent of the first commit in the tree is not empty,\n+\t\t# then the new subtree has accidently been attached to something\n+\t\tgit subtree split --prefix subdir2 --branch mainsub5 &&\n+\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub5)\"'' \"\"\n '\n \n # make sure no patch changes more than one file.  The original set of commits\n@@ -449,20 +449,20 @@ joincommits()\n }\n \n test_expect_success 'verify one file change per commit' '\n-        x= &&\n-        list=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n-#        test_debug \"echo HERE\" &&\n-#        test_debug \"echo ''\"$list\"''\" &&\n-        (git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n-        (       while read commit a b; do\n-\t\t        test_debug \"echo Verifying commit \"''\"$commit\"''\n-\t\t        test_debug \"echo a: \"''\"$a\"''\n-\t\t        test_debug \"echo b: \"''\"$b\"''\n-\t\t        check_equal \"$b\" \"\"\n-\t\t        x=1\n-\t        done\n-\t        check_equal \"$x\" 1\n-        ))\n+\t\tx= &&\n+\t\tlist=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n+#\t\t test_debug \"echo HERE\" &&\n+#\t\t test_debug \"echo ''\"$list\"''\" &&\n+\t\t(git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n+\t\t(\t\twhile read commit a b; do\n+\t\t\t\ttest_debug \"echo Verifying commit \"''\"$commit\"''\n+\t\t\t\ttest_debug \"echo a: \"''\"$a\"''\n+\t\t\t\ttest_debug \"echo b: \"''\"$b\"''\n+\t\t\t\tcheck_equal \"$b\" \"\"\n+\t\t\t\tx=1\n+\t\t\tdone\n+\t\t\tcheck_equal \"$x\" 1\n+\t\t))\n '\n \n test_done\n-- \n1.7.10.4\n"},{"id":"208674","messageId":"1360037173-23291-9-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 08/13] contrib/subtree: Add vim modeline","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:08Z","receivedAt":"2013-02-05T04:06:08Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |    2 ++\n contrib/subtree/t/t7900-subtree.sh |    2 ++\n 2 files changed, 4 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 6c3929b..c72af95 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -722,3 +722,5 @@ cmd_push()\n }\n \n \"cmd_$command\" \"$@\"\n+\n+# vim: set ts=4 sw=4 noet\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex e6a3702..e6bcd50 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -466,3 +466,5 @@ test_expect_success 'verify one file change per commit' '\n '\n \n test_done\n+\n+# vim: set ts=4 sw=4 noet\n-- \n1.7.10.4\n"},{"id":"208673","messageId":"1360037173-23291-10-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 09/13] contrib/subtree: Ignore testing directory","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:09Z","receivedAt":"2013-02-05T04:06:09Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/.gitignore |    5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/subtree/.gitignore b/contrib/subtree/.gitignore\nindex 91360a3..59aeeb4 100644\n--- a/contrib/subtree/.gitignore\n+++ b/contrib/subtree/.gitignore\n@@ -1,6 +1,5 @@\n *~\n git-subtree\n-git-subtree.xml\n git-subtree.1\n-mainline\n-subproj\n+git-subtree.xml\n+t/trash\\ directory.*\n-- \n1.7.10.4\n"},{"id":"208680","messageId":"1360037173-23291-11-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 10/13] contrib/subtree: Code cleaning and refactoring","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:10Z","receivedAt":"2013-02-05T04:06:10Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nMostly prepare for the later tests refactoring.\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/t/t7900-subtree.sh |  270 ++++++++++++++++++------------------\n 1 file changed, 136 insertions(+), 134 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex e6bcd50..9cfaaf9 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -4,7 +4,7 @@\n #\n test_description='Basic porcelain support for subtrees\n \n-This test verifies the basic operation of the merge, pull, add\n+This test verifies the basic operation of the add, pull, merge\n and split subcommands of git subtree.\n '\n \n@@ -18,19 +18,6 @@ create()\n \tgit add \"$1\"\n }\n \n-\n-check_equal()\n-{\n-\ttest_debug 'echo'\n-\ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n-\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n-\tif [ \"$1\" = \"$2\" ]; then\n-\t\treturn 0\n-\telse\n-\t\treturn 1\n-\tfi\n-}\n-\n fixnl()\n {\n \tt=\"\"\n@@ -55,6 +42,42 @@ undo()\n \tgit reset --hard HEAD~\n }\n \n+test_equal()\n+{\n+\ttest_debug 'echo'\n+\ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n+\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n+\tif [ \"$1\" = \"$2\" ]; then\n+\t\treturn 0\n+\telse\n+\t\treturn 1\n+\tfi\n+}\n+\n+# Make sure no patch changes more than one file.\n+# The original set of commits changed only one file each.\n+# A multi-file change would imply that we pruned commits\n+# too aggressively.\n+join_commits()\n+{\n+\tcommit=\n+\tall=\n+\twhile read x y; do\n+\t\tif [ -z \"$x\" ]; then\n+\t\t\tcontinue\n+\t\telif [ \"$x\" = \"commit:\" ]; then\n+\t\t\tif [ -n \"$commit\" ]; then\n+\t\t\t\techo \"$commit $all\"\n+\t\t\t\tall=\n+\t\t\tfi\n+\t\t\tcommit=\"$y\"\n+\t\telse\n+\t\t\tall=\"$all $y\"\n+\t\tfi\n+\tdone\n+\techo \"$commit $all\"\n+}\n+\n last_commit_message()\n {\n \tgit log --pretty=format:%s -1\n@@ -97,7 +120,7 @@ test_expect_success 'add main4' '\n \t\tcreate main4 &&\n \t\tgit commit -m \"main4\" &&\n \t\tgit branch -m master mainline &&\n-\t\tgit branch subdir\n+\t\tgit branch init\n '\n \n test_expect_success 'fetch subproj history' '\n@@ -105,40 +128,43 @@ test_expect_success 'fetch subproj history' '\n \t\tgit branch sub1 FETCH_HEAD\n '\n \n-test_expect_success 'no subtree exists in main tree' '\n-\t\ttest_must_fail git subtree merge --prefix=subdir sub1\n-'\n-\n test_expect_success 'no pull from non-existant subtree' '\n \t\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n '\n \n-test_expect_success 'check if --message works for add' '\n-\t\tgit subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n+test_expect_success 'no merge from non-existant subtree' '\n+\t\ttest_must_fail git subtree merge --prefix=subdir FETCH_HEAD\n+'\n+\n+test_expect_success 'add subproj as subtree into subdir/ with --prefix' '\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\" &&\n \t\tundo\n '\n \n-test_expect_success 'check if --message works as -m and --prefix as -P' '\n-\t\tgit subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n+test_expect_success 'add subproj as subtree into subdir/ with --prefix and --message' '\n+\t\tgit subtree add --prefix=subdir --message=\"Added subproject\" FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n \t\tundo\n '\n \n-test_expect_success 'check if --message works with squash too' '\n-\t\tgit subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n+test_expect_success 'add subproj as subtree into subdir/ with --prefix as -P and --message as -m' '\n+\t\tgit subtree add -P subdir -m \"Added subproject\" FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n \t\tundo\n '\n \n-test_expect_success 'add subproj to mainline' '\n-\t\tgit subtree add --prefix=subdir/ FETCH_HEAD &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Add '\"'subdir/'\"' from commit '\"'\"'''\"$(git rev-parse sub1)\"'''\"'\"'\"\n+test_expect_success 'add subproj as subtree into subdir/ with --squash and --prefix and --message' '\n+\t\tgit subtree add --prefix=subdir --message=\"Added subproject with squash\" --squash FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\" &&\n+\t\tundo\n '\n \n-# this shouldn't actually do anything, since FETCH_HEAD is already a parent\n-test_expect_success 'merge fetched subproj' '\n-\t\tgit merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n+test_expect_success 'merge the added subproj again, should do nothing' '\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n+\t\t# this shouldn not actually do anything, since FETCH_HEAD\n+\t\t# is already a parent\n+\t\tgit merge -s ours -m \"merge -s -ours\" FETCH_HEAD\n '\n \n test_expect_success 'add main-sub5' '\n@@ -161,25 +187,30 @@ test_expect_success 'fetch new subproj history' '\n \t\tgit branch sub2 FETCH_HEAD\n '\n \n-test_expect_success 'check if --message works for merge' '\n-\t\tgit subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n+test_expect_success 'merge new subproj history into subdir/ with --prefix' '\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\'' into mainline\" &&\n \t\tundo\n '\n \n-test_expect_success 'check if --message for merge works with squash too' '\n-\t\tgit subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n+test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '\n+\t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject\" FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\" &&\n \t\tundo\n '\n \n-test_expect_success 'merge new subproj history into subdir' '\n+test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '\n+\t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject using squash\" --squash FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\" &&\n+\t\tundo\n+'\n+\n+test_expect_success 'merge new subproj history into subdir/' '\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit branch pre-split &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n+\t\tgit branch pre-split\n '\n \n-test_expect_success 'Check that prefix argument is required for split' '\n+test_expect_success 'split requires option --prefix' '\n \t\techo \"You must provide the --prefix option.\" > expected &&\n \t\ttest_must_fail git subtree split > actual 2>&1 &&\n \t\ttest_debug \"echo -n expected: \" &&\n@@ -190,59 +221,56 @@ test_expect_success 'Check that prefix argument is required for split' '\n \t\trm -f expected actual\n '\n \n-test_expect_success 'Check that the <prefix> exists for a split' '\n-\t\techo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n+test_expect_success 'split requires path given by option --prefix must exist' '\n+\t\techo \"'\\''non-existent-directory'\\'' does not exist; use '\\''git subtree add'\\''\" > expected &&\n \t\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n \t\ttest_debug \"echo -n expected: \" &&\n \t\ttest_debug \"cat expected\" &&\n \t\ttest_debug \"echo -n actual: \" &&\n \t\ttest_debug \"cat actual\" &&\n-\t\ttest_cmp expected actual\n-#\t\t rm -f expected actual\n+\t\ttest_cmp expected actual &&\n+\t\trm -f expected actual\n '\n \n-test_expect_success 'check if --message works for split+rejoin' '\n-\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n-\t\tgit branch spl1 \"$spl1\" &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n-\t\tundo\n-'\n+test_expect_success 'split subdir/ with --rejoin' '\n+\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n+ \t\tgit branch spl1 \"$spl1\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$spl1'\\''\" &&\n+ \t\tundo\n+ '\n \n-test_expect_success 'check split with --branch' '\n-\t\tspl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n-\t\tundo &&\n-\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr1 &&\n-\t\tcheck_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n+test_expect_success 'split subdir/ with --rejoin and --message' '\n+\t\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\" &&\n+\t\tundo\n '\n \n-test_expect_success 'check hash of split' '\n-        spl1=$(git subtree split --prefix subdir) &&\n-        undo &&\n-        git subtree split --prefix subdir --branch splitbr1test &&\n-        check_equal ''\"$(git rev-parse splitbr1test)\"'' \"$spl1\"\n-        git checkout splitbr1test &&\n-        new_hash=$(git rev-parse HEAD~2) &&\n-        git checkout mainline &&\n-        check_equal ''\"$new_hash\"'' \"$subdir_hash\"\n-'\n+test_expect_success 'split subdir/ with --branch' '\n+\t\tspl1=$(git subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin) &&\n+ \t\tundo &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr1 &&\n+\t\ttest_equal \"$(git rev-parse splitbr1)\" \"$spl1\"\n+ '\n \n-test_expect_success 'check split with --branch for an existing branch' '\n-\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+test_expect_success 'split subdir/ with --branch for an existing branch' '\n+\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\" --message=\"Split & rejoin\" --rejoin) &&\n \t\tundo &&\n \t\tgit branch splitbr2 sub1 &&\n-\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n-\t\tcheck_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr2 &&\n+\t\ttest_equal \"$(git rev-parse splitbr2)\" \"$spl1\"\n '\n \n-test_expect_success 'check split with --branch for an incompatible branch' '\n-\t\ttest_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir\n+test_expect_success 'split subdir/ with --branch for an incompatible branch' '\n+\t\ttest_must_fail git subtree split --prefix=subdir --branch init\n '\n \n-test_expect_success 'check split+rejoin' '\n-\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+test_expect_success 'check --unannotate' '\n+\t\tspl1=$(git subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n \t\tundo &&\n-\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n-\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n+ \t\tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n+\t\ttest_equal \"$(git rev-parse splitunann)\" \"$spl1\" &&\n+\t\ttest_equal \"$(git log splitunann | grep subproj)\" \"\"\n '\n \n test_expect_success 'add main-sub8' '\n@@ -268,8 +296,8 @@ test_expect_success 'add sub9' '\n cd ..\n \n test_expect_success 'split for sub8' '\n-\t\tsplit2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n-\t\tgit branch split2 \"$split2\"\n+\t\tspl2=$(git subtree split --prefix=subdir/ --annotate=\"*\" --rejoin) &&\n+\t\tgit branch spl2 \"$spl2\"\n '\n \n test_expect_success 'add main-sub10' '\n@@ -278,7 +306,7 @@ test_expect_success 'add main-sub10' '\n '\n \n test_expect_success 'split for sub10' '\n-\t\tspl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n+\t\tspl3=$(git subtree split --prefix=subdir --annotate=\"*\" --rejoin) &&\n \t\tgit branch spl3 \"$spl3\"\n '\n \n@@ -299,13 +327,13 @@ chks=\"sub1 sub2 sub3 sub9\"\n chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)\n \n test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n-\t\tsubfiles=''\"$(git ls-files | fixnl)\"'' &&\n-\t\tcheck_equal \"$subfiles\" \"$chkms $chks\"\n+\t\tsubfiles=$(git ls-files | fixnl) &&\n+\t\ttest_equal \"$subfiles\" \"$chkms $chks\"\n '\n \n-test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '\n-\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-\t\tcheck_equal \"$allchanges\" \"$chkms $chks\"\n+test_expect_success 'make sure the subproj *only* contains commits that affect the subdir' '\n+\t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n+\t\ttest_equal \"$allchanges\" \"$chkms $chks\"\n '\n \n # Back to mainline\n@@ -318,25 +346,25 @@ test_expect_success 'pull from subproj' '\n '\n \n test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n-\t\tmainfiles=''\"$(git ls-files | fixnl)\"'' &&\n-\t\tcheck_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n+\t\tmainfiles=$(git ls-files | fixnl) &&\n+\t\ttest_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n '\n \n test_expect_success 'make sure each filename changed exactly once in the entire history' '\n \t\t# main-sub?? and /subdir/main-sub?? both change, because those are the\n \t\t# changes that were split into their own history.  And subdir/sub?? never\n \t\t# change, since they were *only* changed in the subtree branch.\n-\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-\t\tcheck_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n+\t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n+\t\ttest_equal \"$allchanges\" \"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"\n '\n \n test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n-\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n+\t\ttest_equal \"$(git log --pretty=format:\"%s\" HEAD^2 | grep -i split)\" \"\"\n '\n \n test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n \t\t# They are meaningless to subproj since one side of the merge refers to the mainline\n-\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n+\t\ttest_equal \"$(git log --pretty=format:\"%s%n%b\" HEAD^2 | grep \"git-subtree.*:\")\" \"\"\n '\n \n # prepare second pair of repositories\n@@ -374,7 +402,7 @@ cd ../main\n test_expect_success 'add sub as subdir in main' '\n \t\tgit fetch ../sub master &&\n \t\tgit branch sub2 FETCH_HEAD &&\n-\t\tgit subtree add --prefix subdir sub2\n+\t\tgit subtree add --prefix=subdir sub2\n '\n \n cd ../sub\n@@ -389,7 +417,7 @@ cd ../main\n test_expect_success 'merge from sub' '\n \t\tgit fetch ../sub master &&\n \t\tgit branch sub3 FETCH_HEAD &&\n-\t\tgit subtree merge --prefix subdir sub3\n+\t\tgit subtree merge --prefix=subdir sub3\n '\n \n test_expect_success 'add main-sub4' '\n@@ -398,7 +426,7 @@ test_expect_success 'add main-sub4' '\n '\n \n test_expect_success 'split for main-sub4 without --onto' '\n-\t\tgit subtree split --prefix subdir --branch mainsub4\n+\t\tgit subtree split --prefix=subdir --branch mainsub4\n '\n \n # at this point, the new commit parent should be sub3 if it is not,\n@@ -407,7 +435,7 @@ test_expect_success 'split for main-sub4 without --onto' '\n # itself)\n \n test_expect_success 'check that the commit parent is sub3' '\n-\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n+\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub4)\" \"$(git rev-parse sub3)\"\n '\n \n test_expect_success 'add main-sub5' '\n@@ -420,49 +448,23 @@ test_expect_success 'split for main-sub5 without --onto' '\n \t\t# also test that we still can split out an entirely new subtree\n \t\t# if the parent of the first commit in the tree is not empty,\n \t\t# then the new subtree has accidently been attached to something\n-\t\tgit subtree split --prefix subdir2 --branch mainsub5 &&\n-\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub5)\"'' \"\"\n+\t\tgit subtree split --prefix=subdir2 --branch mainsub5 &&\n+\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub5)\" \"\"\n '\n \n-# make sure no patch changes more than one file.  The original set of commits\n-# changed only one file each.  A multi-file change would imply that we pruned\n-# commits too aggressively.\n-joincommits()\n-{\n-\tcommit=\n-\tall=\n-\twhile read x y; do\n-\t\t#echo \"{$x}\" >&2\n-\t\tif [ -z \"$x\" ]; then\n-\t\t\tcontinue\n-\t\telif [ \"$x\" = \"commit:\" ]; then\n-\t\t\tif [ -n \"$commit\" ]; then\n-\t\t\t\techo \"$commit $all\"\n-\t\t\t\tall=\n-\t\t\tfi\n-\t\t\tcommit=\"$y\"\n-\t\telse\n-\t\t\tall=\"$all $y\"\n-\t\tfi\n-\tdone\n-\techo \"$commit $all\"\n-}\n-\n test_expect_success 'verify one file change per commit' '\n \t\tx= &&\n-\t\tlist=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n-#\t\t test_debug \"echo HERE\" &&\n-#\t\t test_debug \"echo ''\"$list\"''\" &&\n-\t\t(git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n-\t\t(\t\twhile read commit a b; do\n-\t\t\t\ttest_debug \"echo Verifying commit \"''\"$commit\"''\n-\t\t\t\ttest_debug \"echo a: \"''\"$a\"''\n-\t\t\t\ttest_debug \"echo b: \"''\"$b\"''\n-\t\t\t\tcheck_equal \"$b\" \"\"\n+\t\tgit log --pretty=format:\"commit: %H\" | join_commits |\n+\t\t(\n+\t\t\twhile read commit a b; do\n+\t\t\t\ttest_debug \"echo Verifying commit $commit\"\n+\t\t\t\ttest_debug \"echo a: $a\"\n+\t\t\t\ttest_debug \"echo b: $b\"\n+\t\t\t\ttest_equal \"$b\" \"\"\n \t\t\t\tx=1\n \t\t\tdone\n-\t\t\tcheck_equal \"$x\" 1\n-\t\t))\n+\t\t\ttest_equal \"$x\" 1\n+\t\t)\n '\n \n test_done\n-- \n1.7.10.4\n"},{"id":"208681","messageId":"1360037173-23291-12-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 11/13] contrib/subtree: Make each test self-contained","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:11Z","receivedAt":"2013-02-05T04:06:11Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/t/t7900-subtree.sh |  871 +++++++++++++++++++++++++-----------\n 1 file changed, 613 insertions(+), 258 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 9cfaaf9..769b116 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -12,12 +12,6 @@ export TEST_DIRECTORY=$(pwd)/../../../t\n \n . ../../../t/test-lib.sh\n \n-create()\n-{\n-\techo \"$1\" >\"$1\"\n-\tgit add \"$1\"\n-}\n-\n fixnl()\n {\n \tt=\"\"\n@@ -37,11 +31,6 @@ multiline()\n \tdone\n }\n \n-undo()\n-{\n-\tgit reset --hard HEAD~\n-}\n-\n test_equal()\n {\n \ttest_debug 'echo'\n@@ -78,381 +67,746 @@ join_commits()\n \techo \"$commit $all\"\n }\n \n+test_create_commit() (\n+\trepo=$1\n+\tcommit=$2\n+\tcd \"$repo\"\n+\tmkdir -p \"$(dirname \"$commit\")\"\n+\techo \"$commit\" > \"$commit\"\n+\tgit add \"$commit\"\n+\tgit commit -m \"$commit\"\n+)\n+\n last_commit_message()\n {\n \tgit log --pretty=format:%s -1\n }\n \n-test_expect_success 'init subproj' '\n-\t\ttest_create_repo subproj\n-'\n-\n-# To the subproject!\n-cd subproj\n-\n-test_expect_success 'add sub1' '\n-\t\tcreate sub1 &&\n-\t\tgit commit -m \"sub1\" &&\n-\t\tgit branch sub1 &&\n-\t\tgit branch -m master subproj\n-'\n-\n-# Save this hash for testing later.\n-\n-subdir_hash=`git rev-parse HEAD`\n-\n-test_expect_success 'add sub2' '\n-\t\tcreate sub2 &&\n-\t\tgit commit -m \"sub2\" &&\n-\t\tgit branch sub2\n-'\n-\n-test_expect_success 'add sub3' '\n-\t\tcreate sub3 &&\n-\t\tgit commit -m \"sub3\" &&\n-\t\tgit branch sub3\n-'\n-\n-# Back to mainline\n-cd ..\n-\n-test_expect_success 'add main4' '\n-\t\tcreate main4 &&\n-\t\tgit commit -m \"main4\" &&\n-\t\tgit branch -m master mainline &&\n-\t\tgit branch init\n-'\n+#\n+# Tests for 'git subtree add'\n+#\n \n-test_expect_success 'fetch subproj history' '\n-\t\tgit fetch ./subproj sub1 &&\n-\t\tgit branch sub1 FETCH_HEAD\n-'\n \n test_expect_success 'no pull from non-existant subtree' '\n-\t\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\ttest_must_fail git subtree pull --prefix=subdir ./subproj master\n+\t)\n '\n \n test_expect_success 'no merge from non-existant subtree' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\ttest_must_fail git subtree merge --prefix=subdir FETCH_HEAD\n+\t)\n '\n \n test_expect_success 'add subproj as subtree into subdir/ with --prefix' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\"\n+\t)\n '\n \n test_expect_success 'add subproj as subtree into subdir/ with --prefix and --message' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree add --prefix=subdir --message=\"Added subproject\" FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\"\n+\t)\n '\n \n test_expect_success 'add subproj as subtree into subdir/ with --prefix as -P and --message as -m' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree add -P subdir -m \"Added subproject\" FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\"\n+\t)\n '\n \n test_expect_success 'add subproj as subtree into subdir/ with --squash and --prefix and --message' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree add --prefix=subdir --message=\"Added subproject with squash\" --squash FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\"\n+\t)\n '\n \n test_expect_success 'merge the added subproj again, should do nothing' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n \t\t# this shouldn not actually do anything, since FETCH_HEAD\n \t\t# is already a parent\n \t\tgit merge -s ours -m \"merge -s -ours\" FETCH_HEAD\n+\t)\n '\n \n-test_expect_success 'add main-sub5' '\n-\t\tcreate subdir/main-sub5 &&\n-\t\tgit commit -m \"subproj: main-sub5\"\n-'\n-\n-test_expect_success 'add main6' '\n-\t\tcreate main6 &&\n-\t\tgit commit -m \"main6 boring\"\n-'\n-\n-test_expect_success 'add main-sub7' '\n-\t\tcreate subdir/main-sub7 &&\n-\t\tgit commit -m \"subproj: main-sub7\"\n-'\n-\n-test_expect_success 'fetch new subproj history' '\n-\t\tgit fetch ./subproj sub2 &&\n-\t\tgit branch sub2 FETCH_HEAD\n-'\n+#\n+# Tests for 'git subtree merge'\n+#\n \n test_expect_success 'merge new subproj history into subdir/ with --prefix' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\'' into mainline\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\''\"\n+\t)\n '\n \n test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject\" FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\"\n+\t)\n '\n \n test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject using squash\" --squash FETCH_HEAD &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\"\n+\t)\n '\n \n-test_expect_success 'merge new subproj history into subdir/' '\n-\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit branch pre-split\n-'\n+#\n+# Tests for 'git subtree split'\n+#\n \n test_expect_success 'split requires option --prefix' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n \t\techo \"You must provide the --prefix option.\" > expected &&\n \t\ttest_must_fail git subtree split > actual 2>&1 &&\n \t\ttest_debug \"echo -n expected: \" &&\n \t\ttest_debug \"cat expected\" &&\n \t\ttest_debug \"echo -n actual: \" &&\n \t\ttest_debug \"cat actual\" &&\n-\t\ttest_cmp expected actual &&\n-\t\trm -f expected actual\n+\t\ttest_cmp expected actual\n+\t)\n '\n \n test_expect_success 'split requires path given by option --prefix must exist' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n \t\techo \"'\\''non-existent-directory'\\'' does not exist; use '\\''git subtree add'\\''\" > expected &&\n \t\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n \t\ttest_debug \"echo -n expected: \" &&\n \t\ttest_debug \"cat expected\" &&\n \t\ttest_debug \"echo -n actual: \" &&\n \t\ttest_debug \"cat actual\" &&\n-\t\ttest_cmp expected actual &&\n-\t\trm -f expected actual\n+\t\ttest_cmp expected actual\n+\t)\n '\n \n test_expect_success 'split subdir/ with --rejoin' '\n-\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n- \t\tgit branch spl1 \"$spl1\" &&\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n \t\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$spl1'\\''\" &&\n- \t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$split_hash'\\''\"\n+\t)\n  '\n \n test_expect_success 'split subdir/ with --rejoin and --message' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n \t\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n-\t\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\" &&\n-\t\tundo\n+\t\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\"\n+\t)\n '\n \n test_expect_success 'split subdir/ with --branch' '\n-\t\tspl1=$(git subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin) &&\n- \t\tundo &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr1 &&\n-\t\ttest_equal \"$(git rev-parse splitbr1)\" \"$spl1\"\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br &&\n+\t\ttest_equal \"$(git rev-parse subproj-br)\" \"$split_hash\"\n+\t)\n  '\n \n test_expect_success 'split subdir/ with --branch for an existing branch' '\n-\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\" --message=\"Split & rejoin\" --rejoin) &&\n-\t\tundo &&\n-\t\tgit branch splitbr2 sub1 &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr2 &&\n-\t\ttest_equal \"$(git rev-parse splitbr2)\" \"$spl1\"\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit branch subproj-br FETCH_HEAD &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br &&\n+\t\ttest_equal \"$(git rev-parse subproj-br)\" \"$split_hash\"\n+\t)\n '\n \n test_expect_success 'split subdir/ with --branch for an incompatible branch' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit branch init HEAD &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n \t\ttest_must_fail git subtree split --prefix=subdir --branch init\n+\t)\n '\n \n-test_expect_success 'check --unannotate' '\n-\t\tspl1=$(git subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n-\t\tundo &&\n- \t\tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n-\t\ttest_equal \"$(git rev-parse splitunann)\" \"$spl1\" &&\n-\t\ttest_equal \"$(git log splitunann | grep subproj)\" \"\"\n-'\n-\n-test_expect_success 'add main-sub8' '\n-\t\tcreate subdir/main-sub8 &&\n-\t\tgit commit -m \"main-sub8\"\n-'\n-\n-# To the subproject!\n-cd ./subproj\n-\n-test_expect_success 'merge split into subproj' '\n-\t\tgit fetch .. spl1 &&\n-\t\tgit branch spl1 FETCH_HEAD &&\n-\t\tgit merge FETCH_HEAD\n-'\n-\n-test_expect_success 'add sub9' '\n-\t\tcreate sub9 &&\n-\t\tgit commit -m \"sub9\"\n-'\n-\n-# Back to mainline\n-cd ..\n-\n-test_expect_success 'split for sub8' '\n-\t\tspl2=$(git subtree split --prefix=subdir/ --annotate=\"*\" --rejoin) &&\n-\t\tgit branch spl2 \"$spl2\"\n-'\n-\n-test_expect_success 'add main-sub10' '\n-\t\tcreate subdir/main-sub10 &&\n-\t\tgit commit -m \"main-sub10\"\n-'\n-\n-test_expect_success 'split for sub10' '\n-\t\tspl3=$(git subtree split --prefix=subdir --annotate=\"*\" --rejoin) &&\n-\t\tgit branch spl3 \"$spl3\"\n-'\n-\n-# To the subproject!\n-cd ./subproj\n-\n-test_expect_success 'merge split into subproj' '\n-\t\tgit fetch .. spl3 &&\n-\t\tgit branch spl3 FETCH_HEAD &&\n-\t\tgit merge FETCH_HEAD &&\n-\t\tgit branch subproj-merge-spl3\n-'\n-\n-chkm=\"main4 main6\"\n-chkms=\"main-sub10 main-sub5 main-sub7 main-sub8\"\n-chkms_sub=$(echo $chkms | multiline | sed 's,^,subdir/,' | fixnl)\n-chks=\"sub1 sub2 sub3 sub9\"\n-chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)\n+#\n+# Validity checking\n+#\n \n test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD &&\n+\n+\t\tchks=\"sub1 sub2 sub3 sub4\" &&\n+\t\tchks_sub=$(echo $chks | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\t\tchkms=\"main-sub1 main-sub2 main-sub3 main-sub4\" &&\n+\t\tchkms_sub=$(echo $chkms | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\n \t\tsubfiles=$(git ls-files | fixnl) &&\n \t\ttest_equal \"$subfiles\" \"$chkms $chks\"\n+\t)\n '\n \n test_expect_success 'make sure the subproj *only* contains commits that affect the subdir' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD &&\n+\n+\t\tchks=\"sub1 sub2 sub3 sub4\" &&\n+\t\tchks_sub=$(echo $chks | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\t\tchkms=\"main-sub1 main-sub2 main-sub3 main-sub4\" &&\n+\t\tchkms_sub=$(echo $chkms | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\n \t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n \t\ttest_equal \"$allchanges\" \"$chkms $chks\"\n-'\n-\n-# Back to mainline\n-cd ..\n-\n-test_expect_success 'pull from subproj' '\n-\t\tgit fetch ./subproj subproj-merge-spl3 &&\n-\t\tgit branch subproj-merge-spl3 FETCH_HEAD &&\n-\t\tgit subtree pull --prefix=subdir ./subproj subproj-merge-spl3\n+\t)\n '\n \n test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n+\n+\t\tchkm=\"main1 main2\" &&\n+\t\tchks=\"sub1 sub2 sub3 sub4\" &&\n+\t\tchks_sub=$(echo $chks | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\t\tchkms=\"main-sub1 main-sub2 main-sub3 main-sub4\" &&\n+\t\tchkms_sub=$(echo $chkms | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n \t\tmainfiles=$(git ls-files | fixnl) &&\n \t\ttest_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n+\t)\n '\n \n test_expect_success 'make sure each filename changed exactly once in the entire history' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n+\n+\t\tchkm=\"main1 main2\" &&\n+\t\tchks=\"sub1 sub2 sub3 sub4\" &&\n+\t\tchks_sub=$(echo $chks | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\t\tchkms=\"main-sub1 main-sub2 main-sub3 main-sub4\" &&\n+\t\tchkms_sub=$(echo $chkms | multiline | sed '\\''s,^,subdir/,'\\'' | fixnl) &&\n+\n \t\t# main-sub?? and /subdir/main-sub?? both change, because those are the\n \t\t# changes that were split into their own history.  And subdir/sub?? never\n \t\t# change, since they were *only* changed in the subtree branch.\n \t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n \t\ttest_equal \"$allchanges\" \"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"\n+\t)\n '\n \n test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n+\n \t\ttest_equal \"$(git log --pretty=format:\"%s\" HEAD^2 | grep -i split)\" \"\"\n+\t)\n '\n \n test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$test_count\" main2 &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n+\n \t\t# They are meaningless to subproj since one side of the merge refers to the mainline\n \t\ttest_equal \"$(git log --pretty=format:\"%s%n%b\" HEAD^2 | grep \"git-subtree.*:\")\" \"\"\n+\t)\n '\n \n-# prepare second pair of repositories\n-mkdir test2\n-cd test2\n-\n-test_expect_success 'init main' '\n-\t\ttest_create_repo main\n-'\n-\n-cd main\n-\n-test_expect_success 'add main1' '\n-\t\tcreate main1 &&\n-\t\tgit commit -m \"main1\"\n-'\n-\n-cd ..\n-\n-test_expect_success 'init sub' '\n-\t\ttest_create_repo sub\n-'\n-\n-cd sub\n-\n-test_expect_success 'add sub2' '\n-\t\tcreate sub2 &&\n-\t\tgit commit -m \"sub2\"\n-'\n-\n-cd ../main\n-\n-# check if split can find proper base without --onto\n-\n-test_expect_success 'add sub as subdir in main' '\n-\t\tgit fetch ../sub master &&\n-\t\tgit branch sub2 FETCH_HEAD &&\n-\t\tgit subtree add --prefix=subdir sub2\n-'\n-\n-cd ../sub\n-\n-test_expect_success 'add sub3' '\n-\t\tcreate sub3 &&\n-\t\tgit commit -m \"sub3\"\n-'\n-\n-cd ../main\n-\n-test_expect_success 'merge from sub' '\n-\t\tgit fetch ../sub master &&\n-\t\tgit branch sub3 FETCH_HEAD &&\n-\t\tgit subtree merge --prefix=subdir sub3\n-'\n-\n-test_expect_success 'add main-sub4' '\n-\t\tcreate subdir/main-sub4 &&\n-\t\tgit commit -m \"main-sub4\"\n-'\n-\n-test_expect_success 'split for main-sub4 without --onto' '\n-\t\tgit subtree split --prefix=subdir --branch mainsub4\n-'\n-\n-# at this point, the new commit parent should be sub3 if it is not,\n-# something went wrong (the \"newparent\" of \"master~\" commit should\n-# have been sub3, but it was not, because its cache was not set to\n-# itself)\n-\n-test_expect_success 'check that the commit parent is sub3' '\n-\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub4)\" \"$(git rev-parse sub3)\"\n-'\n+#\n+# A new set of tests\n+#\n \n-test_expect_success 'add main-sub5' '\n-\t\tmkdir subdir2 &&\n-\t\tcreate subdir2/main-sub5 &&\n-\t\tgit commit -m \"main-sub5\"\n-'\n+test_expect_success 'make sure \"git subtree split\" find the correct parent' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit branch subproj-ref FETCH_HEAD &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br &&\n+\n+\t\t# at this point, the new commit parent should be subproj-ref, if it is\n+\t\t# not, something went wrong (the \"newparent\" of \"master~\" commit should\n+\t\t# have been sub2, but it was not, because its cache was not set to\n+\t\t# itself)\n+\t\ttest_equal \"$(git log --pretty=format:%P -1 subproj-br)\" \"$(git rev-parse subproj-ref)\"\n+\t)\n+'\n+\n+test_expect_success 'split a new subtree without --onto option' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir2/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n \n-test_expect_success 'split for main-sub5 without --onto' '\n \t\t# also test that we still can split out an entirely new subtree\n \t\t# if the parent of the first commit in the tree is not empty,\n \t\t# then the new subtree has accidently been attached to something\n-\t\tgit subtree split --prefix=subdir2 --branch mainsub5 &&\n-\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub5)\" \"\"\n+\t\tgit subtree split --prefix=subdir2 --branch subproj2-br &&\n+\t\ttest_equal \"$(git log --pretty=format:%P -1 subproj2-br)\" \"\"\n+\t)\n '\n \n test_expect_success 'verify one file change per commit' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit branch sub1 FETCH_HEAD &&\n+\t\tgit subtree add --prefix=subdir sub1\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br\n+\t) &&\n+\ttest_create_commit \"$test_count\" subdir2/main-sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit subtree split --prefix=subdir2 --branch subproj2-br &&\n+\n \t\tx= &&\n \t\tgit log --pretty=format:\"commit: %H\" | join_commits |\n \t\t(\n@@ -465,6 +819,7 @@ test_expect_success 'verify one file change per commit' '\n \t\t\tdone\n \t\t\ttest_equal \"$x\" 1\n \t\t)\n+\t)\n '\n \n test_done\n-- \n1.7.10.4\n"},{"id":"208678","messageId":"1360037173-23291-13-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 12/13] contrib/subtree: Handle '--prefix' argument with a slash appended","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:12Z","receivedAt":"2013-02-05T04:06:12Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: Techlive Zheng <techlivezheng@gmail.com>\n\n'git subtree merge' will fail if the argument of '--prefix' has a slash\nappended.\n\nSigned-off-by: Techlive Zheng <techlivezheng@gmail.com>\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |    2 +-\n contrib/subtree/t/t7900-subtree.sh |   19 +++++++++++++++++++\n 2 files changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex c72af95..0493e47 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -82,7 +82,7 @@ while [ $# -gt 0 ]; do\n \t\t--annotate) annotate=\"$1\"; shift ;;\n \t\t--no-annotate) annotate= ;;\n \t\t-b) branch=\"$1\"; shift ;;\n-\t\t-P) prefix=\"$1\"; shift ;;\n+\t\t-P) prefix=\"${1%/}\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n \t\t--no-prefix) prefix= ;;\n \t\t--onto) onto=\"$1\"; shift ;;\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 769b116..1afd544 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -239,6 +239,25 @@ test_expect_success 'merge new subproj history into subdir/ with --squash and --\n \t)\n '\n \n+test_expect_success 'merge new subproj history into subdir/ with a slash appended to the argument of --prefix' '\n+\ttest_create_repo \"$test_count\" &&\n+\ttest_create_repo \"$test_count/subproj\" &&\n+\ttest_create_commit \"$test_count\" main1 &&\n+\ttest_create_commit \"$test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir/ FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir/ FETCH_HEAD &&\n+\t\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\''\"\n+\t)\n+'\n+\n #\n # Tests for 'git subtree split'\n #\n-- \n1.7.10.4\n"},{"id":"208679","messageId":"1360037173-23291-14-git-send-email-greened@obbligato.org","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"[PATCH 13/13] contrib/subtree: Remove --annotate","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-05T04:06:13Z","receivedAt":"2013-02-05T04:06:13Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: \"David A. Greene\" <greened@obbligato.org>\n\nRemove --annotate.  This obviates the need for an --unannotate\ncommand.  We really want a more generalized commit message rewrite\nmechanism.\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |    6 +----\n contrib/subtree/t/t7900-subtree.sh |   50 ++++++++++++++++++------------------\n 2 files changed, 26 insertions(+), 30 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 0493e47..888a191 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -21,7 +21,6 @@ d             show debug messages\n P,prefix=     the name of the subdir to split out\n m,message=    use the given message as the commit message for the merge commit\n  options for 'split'\n-annotate=     add a prefix to commit message of new commits\n 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@@ -43,7 +42,6 @@ command=\n onto=\n rejoin=\n ignore_joins=\n-annotate=\n squash=\n message=\n \n@@ -79,8 +77,6 @@ while [ $# -gt 0 ]; do\n \tcase \"$opt\" in\n \t\t-q) quiet=1 ;;\n \t\t-d) debug=1 ;;\n-\t\t--annotate) annotate=\"$1\"; shift ;;\n-\t\t--no-annotate) annotate= ;;\n \t\t-b) branch=\"$1\"; shift ;;\n \t\t-P) prefix=\"${1%/}\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n@@ -311,7 +307,7 @@ copy_commit()\n \t\t\tGIT_COMMITTER_NAME \\\n \t\t\tGIT_COMMITTER_EMAIL \\\n \t\t\tGIT_COMMITTER_DATE\n-\t\t(echo -n \"$annotate\"; cat ) |\n+\t\t(echo -n \"\"; cat ) |\n \t\tgit commit-tree \"$2\" $3  # reads the rest of stdin\n \t) || die \"Can't copy commit $1\"\n }\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 1afd544..59889f1 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -318,8 +318,8 @@ test_expect_success 'split subdir/ with --rejoin' '\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir) &&\n+\t\tgit subtree split --prefix=subdir --rejoin &&\n \t\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$split_hash'\\''\"\n \t)\n  '\n@@ -342,7 +342,7 @@ test_expect_success 'split subdir/ with --rejoin and --message' '\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n+\t\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --rejoin &&\n \t\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\"\n \t)\n '\n@@ -365,8 +365,8 @@ test_expect_success 'split subdir/ with --branch' '\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir) &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br &&\n \t\ttest_equal \"$(git rev-parse subproj-br)\" \"$split_hash\"\n \t)\n  '\n@@ -390,8 +390,8 @@ test_expect_success 'split subdir/ with --branch for an existing branch' '\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tsplit_hash=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br &&\n+\t\tsplit_hash=$(git subtree split --prefix=subdir) &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br &&\n \t\ttest_equal \"$(git rev-parse subproj-br)\" \"$split_hash\"\n \t)\n '\n@@ -441,7 +441,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -452,12 +452,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n@@ -491,7 +491,7 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -502,12 +502,12 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n@@ -541,7 +541,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -552,12 +552,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n@@ -595,7 +595,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -606,12 +606,12 @@ test_expect_success 'make sure each filename changed exactly once in the entire\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n@@ -653,7 +653,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -664,12 +664,12 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n@@ -701,7 +701,7 @@ test_expect_success 'make sure no \"git subtree\" tagged commits make it into subp\n \t\tcd \"$test_count\" &&\n \t\tgit fetch ./subproj master &&\n \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count/subproj\" sub3 &&\n \ttest_create_commit \"$test_count\" subdir/main-sub3 &&\n@@ -712,12 +712,12 @@ test_expect_success 'make sure no \"git subtree\" tagged commits make it into subp\n \ttest_create_commit \"$test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \ttest_create_commit \"$test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t\tgit subtree split --prefix=subdir --branch subproj-br --rejoin\n \t) &&\n \t(\n \t\tcd \"$test_count/subproj\" &&\n-- \n1.7.10.4\n"},{"id":"208676","messageId":"7vtxprxtx0.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-9-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 08/13] contrib/subtree: Add vim modeline","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T04:32:11Z","receivedAt":"2013-02-05T04:32:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/git-subtree.sh     |    2 ++\n>  contrib/subtree/t/t7900-subtree.sh |    2 ++\n>  2 files changed, 4 insertions(+)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 6c3929b..c72af95 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -722,3 +722,5 @@ cmd_push()\n>  }\n>  \n>  \"cmd_$command\" \"$@\"\n> +\n> +# vim: set ts=4 sw=4 noet\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index e6a3702..e6bcd50 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -466,3 +466,5 @@ test_expect_success 'verify one file change per commit' '\n>  '\n>  \n>  test_done\n> +\n> +# vim: set ts=4 sw=4 noet\n\nPlease don't.\n"},{"id":"208677","messageId":"7vpq0fxtpp.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-10-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 09/13] contrib/subtree: Ignore testing directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T04:36:34Z","receivedAt":"2013-02-05T04:36:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n\nJustification is missing here.\n\ncontrib/subtree/Makefile seems to do \"rm -rf\" on 'mainline' and\n'subproj' in its \"clean\" target, which makes them look like\nbuild/test artifacts that need to be ignored.\n\nIf they are no longer build/test artifacts, perhaps their removal\nalso need to be dropped from the Makefile?\n\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/.gitignore |    5 ++---\n>  1 file changed, 2 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/subtree/.gitignore b/contrib/subtree/.gitignore\n> index 91360a3..59aeeb4 100644\n> --- a/contrib/subtree/.gitignore\n> +++ b/contrib/subtree/.gitignore\n> @@ -1,6 +1,5 @@\n>  *~\n>  git-subtree\n> -git-subtree.xml\n>  git-subtree.1\n> -mainline\n> -subproj\n> +git-subtree.xml\n> +t/trash\\ directory.*\n"},{"id":"208682","messageId":"7va9rjxtkn.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-2-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 01/13] contrib/subtree: Remove Test Number Comments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T04:39:36Z","receivedAt":"2013-02-05T04:39:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nThis is minor but I'd prefer to see that Subject lines Not To Do\nTitle Case (please see \"git log --oneline --no-merges -20 master\"\nand imitate them for uniformity).\n\nI'll tweak them while queuing so this alone is not a reason for\nhaving to resend.\n\nThanks.\n"},{"id":"208683","messageId":"7v6227xtf1.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-8-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 07/13] contrib/subtree: Fix whitespaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T04:42:58Z","receivedAt":"2013-02-05T04:42:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Previous code does not fulfill Git's whitespace policy.\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n\nThis does not seem to apply; I hand-tweaked it to make it apply, but\nthe reindentation of t/t7900 does not look correct.\n\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 3f17f55..e6a3702 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -23,7 +23,7 @@ check_equal()\n>  {\n>  \ttest_debug 'echo'\n>  \ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n> -\ttest_debug \"echo \\\"      b:\\\" \\\"{$2}\\\"\"\n> +\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n>  \tif [ \"$1\" = \"$2\" ]; then\n>  \t\treturn 0\n>  \telse\n> @@ -61,17 +61,17 @@ last_commit_message()\n>  }\n>  \n>  test_expect_success 'init subproj' '\n> -        test_create_repo subproj\n> +\t\ttest_create_repo subproj\n\nPerhaps this was originally done with an editor whose tabwidth was\nset to 4?  It gives too much indentation when standard tabwidth of 8\nis used.\n"},{"id":"208684","messageId":"7v1ucvxskg.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-11-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 10/13] contrib/subtree: Code cleaning and refactoring","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T05:01:19Z","receivedAt":"2013-02-05T05:01:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Mostly prepare for the later tests refactoring.\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/t/t7900-subtree.sh |  270 ++++++++++++++++++------------------\n>  1 file changed, 136 insertions(+), 134 deletions(-)\n>\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index e6bcd50..9cfaaf9 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -4,7 +4,7 @@\n>  #\n>  test_description='Basic porcelain support for subtrees\n>  \n> -This test verifies the basic operation of the merge, pull, add\n> +This test verifies the basic operation of the add, pull, merge\n>  and split subcommands of git subtree.\n>  '\n>  \n> @@ -18,19 +18,6 @@ create()\n>  \tgit add \"$1\"\n>  }\n>  \n> -\n> -check_equal()\n> -{\n> -\ttest_debug 'echo'\n> -\ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n> -\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n> -\tif [ \"$1\" = \"$2\" ]; then\n> -\t\treturn 0\n> -\telse\n> -\t\treturn 1\n> -\tfi\n> -}\n> -\n>  fixnl()\n>  {\n>  \tt=\"\"\n> @@ -55,6 +42,42 @@ undo()\n>  \tgit reset --hard HEAD~\n>  }\n>  \n> +test_equal()\n> +{\n> +\ttest_debug 'echo'\n> +\ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n> +\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\n> +\tif [ \"$1\" = \"$2\" ]; then\n> +\t\treturn 0\n> +\telse\n> +\t\treturn 1\n> +\tfi\n> +}\n\nWhy is the above improvement?  It does not seem to be fixing shell\nscript style to conform to the CodingGuidelines; the only thing I\ncan see it change is the name of the heper function.\n\nAdditional helper functions introduced by this patch seem to\nintroduce even more style violations.\n\nThis may be a tangent, but I would have expected \"we expect these\ntwo things to be the same, but help me debug the situation when then\ndiffer\" to be written more like this:\n\n\ttest_equal () {\n\t\tif test \"x$1\" = \"x$2\"\n\t\tthen\n\t\t\treturn 0\n\t\telse\n                \ttest_debug \"echo\" ...\n                        return 1\n\t\tfi\n\t}\n\n> +# Make sure no patch changes more than one file.\n> +# The original set of commits changed only one file each.\n> +# A multi-file change would imply that we pruned commits\n> +# too aggressively.\n> +join_commits()\n> +{\n> +\tcommit=\n> +\tall=\n> +\twhile read x y; do\n> +\t\tif [ -z \"$x\" ]; then\n> +\t\t\tcontinue\n> +\t\telif [ \"$x\" = \"commit:\" ]; then\n> +\t\t\tif [ -n \"$commit\" ]; then\n> +\t\t\t\techo \"$commit $all\"\n> +\t\t\t\tall=\n> +\t\t\tfi\n> +\t\t\tcommit=\"$y\"\n> +\t\telse\n> +\t\t\tall=\"$all $y\"\n> +\t\tfi\n> +\tdone\n> +\techo \"$commit $all\"\n> +}\n\nSwapped location in the file and renamed the function?  Doing\nanything else?\n\nThis only reads from \n\n    git log --pretty=\"format:commit: %H\"\n\nso I am not sure how $all is ever relevant.\n\nDoesn't it always see \"$x=commit:\" with \"$y=<commit object name>\"?\n\n>  last_commit_message()\n>  {\n>  \tgit log --pretty=format:%s -1\n> @@ -97,7 +120,7 @@ test_expect_success 'add main4' '\n>  \t\tcreate main4 &&\n>  \t\tgit commit -m \"main4\" &&\n>  \t\tgit branch -m master mainline &&\n> -\t\tgit branch subdir\n> +\t\tgit branch init\n>  '\n>  \n>  test_expect_success 'fetch subproj history' '\n> @@ -105,40 +128,43 @@ test_expect_success 'fetch subproj history' '\n>  \t\tgit branch sub1 FETCH_HEAD\n>  '\n>  \n> -test_expect_success 'no subtree exists in main tree' '\n> -\t\ttest_must_fail git subtree merge --prefix=subdir sub1\n> -'\n> -\n>  test_expect_success 'no pull from non-existant subtree' '\n>  \t\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n>  '\n>  \nv> -test_expect_success 'check if --message works for add' '\n> -\t\tgit subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n> +test_expect_success 'no merge from non-existant subtree' '\n\ns/tant/tent/\n\nThe remainder of the patch not snipped for others.\n\n> +\t\ttest_must_fail git subtree merge --prefix=subdir FETCH_HEAD\n> +'\n> +\n> +test_expect_success 'add subproj as subtree into subdir/ with --prefix' '\n> +\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\" &&\n>  \t\tundo\n>  '\n>  \n> -test_expect_success 'check if --message works as -m and --prefix as -P' '\n> -\t\tgit subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n> +test_expect_success 'add subproj as subtree into subdir/ with --prefix and --message' '\n> +\t\tgit subtree add --prefix=subdir --message=\"Added subproject\" FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n>  \t\tundo\n>  '\n>  \n> -test_expect_success 'check if --message works with squash too' '\n> -\t\tgit subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n> +test_expect_success 'add subproj as subtree into subdir/ with --prefix as -P and --message as -m' '\n> +\t\tgit subtree add -P subdir -m \"Added subproject\" FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n>  \t\tundo\n>  '\n>  \n> -test_expect_success 'add subproj to mainline' '\n> -\t\tgit subtree add --prefix=subdir/ FETCH_HEAD &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Add '\"'subdir/'\"' from commit '\"'\"'''\"$(git rev-parse sub1)\"'''\"'\"'\"\n> +test_expect_success 'add subproj as subtree into subdir/ with --squash and --prefix and --message' '\n> +\t\tgit subtree add --prefix=subdir --message=\"Added subproject with squash\" --squash FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\" &&\n> +\t\tundo\n>  '\n>  \n> -# this shouldn't actually do anything, since FETCH_HEAD is already a parent\n> -test_expect_success 'merge fetched subproj' '\n> -\t\tgit merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n> +test_expect_success 'merge the added subproj again, should do nothing' '\n> +\t\tgit subtree add --prefix=subdir FETCH_HEAD &&\n> +\t\t# this shouldn not actually do anything, since FETCH_HEAD\n> +\t\t# is already a parent\n> +\t\tgit merge -s ours -m \"merge -s -ours\" FETCH_HEAD\n>  '\n>  \n>  test_expect_success 'add main-sub5' '\n> @@ -161,25 +187,30 @@ test_expect_success 'fetch new subproj history' '\n>  \t\tgit branch sub2 FETCH_HEAD\n>  '\n>  \n> -test_expect_success 'check if --message works for merge' '\n> -\t\tgit subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n> +test_expect_success 'merge new subproj history into subdir/ with --prefix' '\n> +\t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\'' into mainline\" &&\n>  \t\tundo\n>  '\n>  \n> -test_expect_success 'check if --message for merge works with squash too' '\n> -\t\tgit subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n> +test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '\n> +\t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject\" FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\" &&\n>  \t\tundo\n>  '\n>  \n> -test_expect_success 'merge new subproj history into subdir' '\n> +test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '\n> +\t\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject using squash\" --squash FETCH_HEAD &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\" &&\n> +\t\tundo\n> +'\n> +\n> +test_expect_success 'merge new subproj history into subdir/' '\n>  \t\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n> -\t\tgit branch pre-split &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n> +\t\tgit branch pre-split\n>  '\n>  \n> -test_expect_success 'Check that prefix argument is required for split' '\n> +test_expect_success 'split requires option --prefix' '\n>  \t\techo \"You must provide the --prefix option.\" > expected &&\n>  \t\ttest_must_fail git subtree split > actual 2>&1 &&\n>  \t\ttest_debug \"echo -n expected: \" &&\n> @@ -190,59 +221,56 @@ test_expect_success 'Check that prefix argument is required for split' '\n>  \t\trm -f expected actual\n>  '\n>  \n> -test_expect_success 'Check that the <prefix> exists for a split' '\n> -\t\techo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n> +test_expect_success 'split requires path given by option --prefix must exist' '\n> +\t\techo \"'\\''non-existent-directory'\\'' does not exist; use '\\''git subtree add'\\''\" > expected &&\n>  \t\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n>  \t\ttest_debug \"echo -n expected: \" &&\n>  \t\ttest_debug \"cat expected\" &&\n>  \t\ttest_debug \"echo -n actual: \" &&\n>  \t\ttest_debug \"cat actual\" &&\n> -\t\ttest_cmp expected actual\n> -#\t\t rm -f expected actual\n> +\t\ttest_cmp expected actual &&\n> +\t\trm -f expected actual\n>  '\n>  \n> -test_expect_success 'check if --message works for split+rejoin' '\n> -\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n> -\t\tgit branch spl1 \"$spl1\" &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n> -\t\tundo\n> -'\n> +test_expect_success 'split subdir/ with --rejoin' '\n> +\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n> + \t\tgit branch spl1 \"$spl1\" &&\n> +\t\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$spl1'\\''\" &&\n> + \t\tundo\n> + '\n>  \n> -test_expect_success 'check split with --branch' '\n> -\t\tspl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n> -\t\tundo &&\n> -\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr1 &&\n> -\t\tcheck_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n> +test_expect_success 'split subdir/ with --rejoin and --message' '\n> +\t\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n> +\t\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\" &&\n> +\t\tundo\n>  '\n>  \n> -test_expect_success 'check hash of split' '\n> -        spl1=$(git subtree split --prefix subdir) &&\n> -        undo &&\n> -        git subtree split --prefix subdir --branch splitbr1test &&\n> -        check_equal ''\"$(git rev-parse splitbr1test)\"'' \"$spl1\"\n> -        git checkout splitbr1test &&\n> -        new_hash=$(git rev-parse HEAD~2) &&\n> -        git checkout mainline &&\n> -        check_equal ''\"$new_hash\"'' \"$subdir_hash\"\n> -'\n> +test_expect_success 'split subdir/ with --branch' '\n> +\t\tspl1=$(git subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin) &&\n> + \t\tundo &&\n> +\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr1 &&\n> +\t\ttest_equal \"$(git rev-parse splitbr1)\" \"$spl1\"\n> + '\n>  \n> -test_expect_success 'check split with --branch for an existing branch' '\n> -\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n> +test_expect_success 'split subdir/ with --branch for an existing branch' '\n> +\t\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\" --message=\"Split & rejoin\" --rejoin) &&\n>  \t\tundo &&\n>  \t\tgit branch splitbr2 sub1 &&\n> -\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n> -\t\tcheck_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n> +\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr2 &&\n> +\t\ttest_equal \"$(git rev-parse splitbr2)\" \"$spl1\"\n>  '\n>  \n> -test_expect_success 'check split with --branch for an incompatible branch' '\n> -\t\ttest_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir\n> +test_expect_success 'split subdir/ with --branch for an incompatible branch' '\n> +\t\ttest_must_fail git subtree split --prefix=subdir --branch init\n>  '\n>  \n> -test_expect_success 'check split+rejoin' '\n> -\t\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n> +test_expect_success 'check --unannotate' '\n> +\t\tspl1=$(git subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n>  \t\tundo &&\n> -\t\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n> -\t\tcheck_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n> + \t\tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n> +\t\ttest_equal \"$(git rev-parse splitunann)\" \"$spl1\" &&\n> +\t\ttest_equal \"$(git log splitunann | grep subproj)\" \"\"\n>  '\n>  \n>  test_expect_success 'add main-sub8' '\n> @@ -268,8 +296,8 @@ test_expect_success 'add sub9' '\n>  cd ..\n>  \n>  test_expect_success 'split for sub8' '\n> -\t\tsplit2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n> -\t\tgit branch split2 \"$split2\"\n> +\t\tspl2=$(git subtree split --prefix=subdir/ --annotate=\"*\" --rejoin) &&\n> +\t\tgit branch spl2 \"$spl2\"\n>  '\n>  \n>  test_expect_success 'add main-sub10' '\n> @@ -278,7 +306,7 @@ test_expect_success 'add main-sub10' '\n>  '\n>  \n>  test_expect_success 'split for sub10' '\n> -\t\tspl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n> +\t\tspl3=$(git subtree split --prefix=subdir --annotate=\"*\" --rejoin) &&\n>  \t\tgit branch spl3 \"$spl3\"\n>  '\n>  \n> @@ -299,13 +327,13 @@ chks=\"sub1 sub2 sub3 sub9\"\n>  chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)\n>  \n>  test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n> -\t\tsubfiles=''\"$(git ls-files | fixnl)\"'' &&\n> -\t\tcheck_equal \"$subfiles\" \"$chkms $chks\"\n> +\t\tsubfiles=$(git ls-files | fixnl) &&\n> +\t\ttest_equal \"$subfiles\" \"$chkms $chks\"\n>  '\n>  \n> -test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '\n> -\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n> -\t\tcheck_equal \"$allchanges\" \"$chkms $chks\"\n> +test_expect_success 'make sure the subproj *only* contains commits that affect the subdir' '\n> +\t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n> +\t\ttest_equal \"$allchanges\" \"$chkms $chks\"\n>  '\n>  \n>  # Back to mainline\n> @@ -318,25 +346,25 @@ test_expect_success 'pull from subproj' '\n>  '\n>  \n>  test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n> -\t\tmainfiles=''\"$(git ls-files | fixnl)\"'' &&\n> -\t\tcheck_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n> +\t\tmainfiles=$(git ls-files | fixnl) &&\n> +\t\ttest_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n>  '\n>  \n>  test_expect_success 'make sure each filename changed exactly once in the entire history' '\n>  \t\t# main-sub?? and /subdir/main-sub?? both change, because those are the\n>  \t\t# changes that were split into their own history.  And subdir/sub?? never\n>  \t\t# change, since they were *only* changed in the subtree branch.\n> -\t\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n> -\t\tcheck_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n> +\t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n> +\t\ttest_equal \"$allchanges\" \"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"\n>  '\n>  \n>  test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n> -\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n> +\t\ttest_equal \"$(git log --pretty=format:\"%s\" HEAD^2 | grep -i split)\" \"\"\n>  '\n>  \n>  test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n>  \t\t# They are meaningless to subproj since one side of the merge refers to the mainline\n> -\t\tcheck_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n> +\t\ttest_equal \"$(git log --pretty=format:\"%s%n%b\" HEAD^2 | grep \"git-subtree.*:\")\" \"\"\n>  '\n>  \n>  # prepare second pair of repositories\n> @@ -374,7 +402,7 @@ cd ../main\n>  test_expect_success 'add sub as subdir in main' '\n>  \t\tgit fetch ../sub master &&\n>  \t\tgit branch sub2 FETCH_HEAD &&\n> -\t\tgit subtree add --prefix subdir sub2\n> +\t\tgit subtree add --prefix=subdir sub2\n>  '\n>  \n>  cd ../sub\n> @@ -389,7 +417,7 @@ cd ../main\n>  test_expect_success 'merge from sub' '\n>  \t\tgit fetch ../sub master &&\n>  \t\tgit branch sub3 FETCH_HEAD &&\n> -\t\tgit subtree merge --prefix subdir sub3\n> +\t\tgit subtree merge --prefix=subdir sub3\n>  '\n>  \n>  test_expect_success 'add main-sub4' '\n> @@ -398,7 +426,7 @@ test_expect_success 'add main-sub4' '\n>  '\n>  \n>  test_expect_success 'split for main-sub4 without --onto' '\n> -\t\tgit subtree split --prefix subdir --branch mainsub4\n> +\t\tgit subtree split --prefix=subdir --branch mainsub4\n>  '\n>  \n>  # at this point, the new commit parent should be sub3 if it is not,\n> @@ -407,7 +435,7 @@ test_expect_success 'split for main-sub4 without --onto' '\n>  # itself)\n>  \n>  test_expect_success 'check that the commit parent is sub3' '\n> -\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n> +\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub4)\" \"$(git rev-parse sub3)\"\n>  '\n>  \n>  test_expect_success 'add main-sub5' '\n> @@ -420,49 +448,23 @@ test_expect_success 'split for main-sub5 without --onto' '\n>  \t\t# also test that we still can split out an entirely new subtree\n>  \t\t# if the parent of the first commit in the tree is not empty,\n>  \t\t# then the new subtree has accidently been attached to something\n> -\t\tgit subtree split --prefix subdir2 --branch mainsub5 &&\n> -\t\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub5)\"'' \"\"\n> +\t\tgit subtree split --prefix=subdir2 --branch mainsub5 &&\n> +\t\ttest_equal \"$(git log --pretty=format:%P -1 mainsub5)\" \"\"\n>  '\n>  \n> -# make sure no patch changes more than one file.  The original set of commits\n> -# changed only one file each.  A multi-file change would imply that we pruned\n> -# commits too aggressively.\n> -joincommits()\n> -{\n> -\tcommit=\n> -\tall=\n> -\twhile read x y; do\n> -\t\t#echo \"{$x}\" >&2\n> -\t\tif [ -z \"$x\" ]; then\n> -\t\t\tcontinue\n> -\t\telif [ \"$x\" = \"commit:\" ]; then\n> -\t\t\tif [ -n \"$commit\" ]; then\n> -\t\t\t\techo \"$commit $all\"\n> -\t\t\t\tall=\n> -\t\t\tfi\n> -\t\t\tcommit=\"$y\"\n> -\t\telse\n> -\t\t\tall=\"$all $y\"\n> -\t\tfi\n> -\tdone\n> -\techo \"$commit $all\"\n> -}\n> -\n>  test_expect_success 'verify one file change per commit' '\n>  \t\tx= &&\n> -\t\tlist=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n> -#\t\t test_debug \"echo HERE\" &&\n> -#\t\t test_debug \"echo ''\"$list\"''\" &&\n> -\t\t(git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n> -\t\t(\t\twhile read commit a b; do\n> -\t\t\t\ttest_debug \"echo Verifying commit \"''\"$commit\"''\n> -\t\t\t\ttest_debug \"echo a: \"''\"$a\"''\n> -\t\t\t\ttest_debug \"echo b: \"''\"$b\"''\n> -\t\t\t\tcheck_equal \"$b\" \"\"\n> +\t\tgit log --pretty=format:\"commit: %H\" | join_commits |\n> +\t\t(\n> +\t\t\twhile read commit a b; do\n> +\t\t\t\ttest_debug \"echo Verifying commit $commit\"\n> +\t\t\t\ttest_debug \"echo a: $a\"\n> +\t\t\t\ttest_debug \"echo b: $b\"\n> +\t\t\t\ttest_equal \"$b\" \"\"\n>  \t\t\t\tx=1\n>  \t\t\tdone\n> -\t\t\tcheck_equal \"$x\" 1\n> -\t\t))\n> +\t\t\ttest_equal \"$x\" 1\n> +\t\t)\n>  '\n>  \n>  test_done\n"},{"id":"208685","messageId":"7vwqunwdfk.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-12-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 11/13] contrib/subtree: Make each test self-contained","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T05:13:35Z","receivedAt":"2013-02-05T05:13:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> +test_create_commit() (\n> +\trepo=$1\n> +\tcommit=$2\n> +\tcd \"$repo\"\n> +\tmkdir -p \"$(dirname \"$commit\")\"\n> +\techo \"$commit\" > \"$commit\"\n\nStyle.\n\n> +\tgit add \"$commit\"\n> +\tgit commit -m \"$commit\"\n> +)\n\nVery nice, but don't we want to check for possible errors in any of\nthe above commands?\n\n>  last_commit_message()\n>  {\n>  \tgit log --pretty=format:%s -1\n>  }\n>  \n> +#\n> +# Tests for 'git subtree add'\n> +#\n>  \n> -test_expect_success 'fetch subproj history' '\n> -\t\tgit fetch ./subproj sub1 &&\n> -\t\tgit branch sub1 FETCH_HEAD\n> -'\n>  \n>  test_expect_success 'no pull from non-existant subtree' '\n> -\t\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n> +\ttest_create_repo \"$test_count\" &&\n> +\ttest_create_repo \"$test_count/subproj\" &&\n> +\ttest_create_commit \"$test_count\" main1 &&\n> +\ttest_create_commit \"$test_count/subproj\" sub1 &&\n> +\t(\n> +\t\tcd \"$test_count\" &&\n> +\t\tgit fetch ./subproj master &&\n> +\t\ttest_must_fail git subtree pull --prefix=subdir ./subproj master\n> +\t)\n>  '\n\nThe goal of making each tests indenendent is a very good one, but\nwe'd really prefer not to see $test_count which is an implementation\ndetail of the test framework to be used like this.  It will make it\nunnecessarily harder to improve the test framework (e.g. it may want\nto stop using the $test_count variable).\n\nThis is not limited to this variable, but all other $test_anything\nvariable.  Earlier I wanted to update the definition of test_tick\nwhich happens to be decimal number of seconds since epoch, but some\ntests were comparing it with the raw values read from cat-file output\nfor a commit object, and it was really painful.\n"},{"id":"208686","messageId":"7vsj5bwdam.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-13-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 12/13] contrib/subtree: Handle '--prefix' argument with a slash appended","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T05:16:33Z","receivedAt":"2013-02-05T05:16:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n> 'git subtree merge' will fail if the argument of '--prefix' has a slash\n> appended.\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/git-subtree.sh     |    2 +-\n>  contrib/subtree/t/t7900-subtree.sh |   19 +++++++++++++++++++\n>  2 files changed, 20 insertions(+), 1 deletion(-)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index c72af95..0493e47 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -82,7 +82,7 @@ while [ $# -gt 0 ]; do\n>  \t\t--annotate) annotate=\"$1\"; shift ;;\n>  \t\t--no-annotate) annotate= ;;\n>  \t\t-b) branch=\"$1\"; shift ;;\n> -\t\t-P) prefix=\"$1\"; shift ;;\n> +\t\t-P) prefix=\"${1%/}\"; shift ;;\n\nWhile it may not be a bad change per-se, I have to wonder if it is\nworth special casing \"--prefix=foo/\", that should have been spelled\nas \"--prefix=foo\", while still failing misspelling like \"--prefix=foo//\"\nand possibly other forms, perhaps \"--prefix=foo//bar/baz\"?\n"},{"id":"208687","messageId":"7vobfzwd8g.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"1360037173-23291-14-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 13/13] contrib/subtree: Remove --annotate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T05:17:51Z","receivedAt":"2013-02-05T05:17:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David A. Greene\" <greened@obbligato.org> writes:\n\n> From: \"David A. Greene\" <greened@obbligato.org>\n>\n> Remove --annotate.  This obviates the need for an --unannotate\n> command.  We really want a more generalized commit message rewrite\n> mechanism.\n\nThat may be a good goal as the end result, but wouldn't it be a bit\nunhelpful to remove these before adding such a \"more generalized\"\nmechanism to replace them?\n"},{"id":"208697","messageId":"CAAgkN4dx7jyjh=4BTWT6L4H1ymjwWNxSZk7WqyV1_CCYocy6Pg@mail.gmail.com","threadId":"32829","inReplyTo":"1360037173-23291-1-git-send-email-greened@obbligato.org","subject":"Re: Assorted contrib/subtree Patches","fromName":"Jakub Suder","fromEmail":"jakub.suder@gmail.com","sentAt":"2013-02-05T09:14:26Z","receivedAt":"2013-02-05T09:14:26Z","isPatch":false,"sender":{"key":"jakub.suder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/28465?v=4"},"body":"Can I please unsubscribe from this thing?...\n\nThanks.\n\nJakub Suder\n\nOn 5 February 2013 05:06, David A. Greene <greened@obbligato.org> wrote:\n> All of the patches I have received from others as well as a few of my\n> own follow.  Probably the most controversial is a patch to remove\n> --annotate.  After some discussion on the list it became clear that we\n> really want a more general commit rewrite feature.  Removing\n> --annotate means we don't have to also support --unannotate and carry\n> both forward as backward-compatibility baggage.\n>\n> Before --annotate was added, git-subtree would force an annotation of\n> \"*\" on every split commit message.  It now does no such thing so\n> there's no need to unannotate anything.\n>\n> Please review and integrate.  Thanks!\n>\n>                         -David\n>\n"},{"id":"208725","messageId":"CABVa4NiyVksEn4+NqBPXpaWGYnP6FeUqeacLOnAOHtw9FgMJdA@mail.gmail.com","threadId":"32829","inReplyTo":"87pq0frnmb.fsf@waller.obbligato.org","subject":"Re: [PATCH 13/13] contrib/subtree: Remove --annotate","fromName":"James Nylen","fromEmail":"jnylen@gmail.com","sentAt":"2013-02-05T13:27:34Z","receivedAt":"2013-02-05T13:27:34Z","isPatch":true,"sender":{"key":"jnylen@gmail.com","avatar":"https://gravatar.com/avatar/96804ac655933f5b6380e992610d6ff9029c6d04db1042d4bec381312ff7ff1b?d=mp&s=160"},"body":"On Tue, Feb 5, 2013 at 6:44 AM,  <greened@obbligato.org> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>>> Remove --annotate.  This obviates the need for an --unannotate\n>>> command.  We really want a more generalized commit message rewrite\n>>> mechanism.\n>>\n>> That may be a good goal as the end result, but wouldn't it be a bit\n>> unhelpful to remove these before adding such a \"more generalized\"\n>> mechanism to replace them?\n>\n> I did think about that.  I sent out an e-mail some time ago asking for\n> opinions on this.  No one responded.  Since this is in contrib/ I feel\n> comfortable getting rid of this option early so that people don't get\n> too attached to it.  :)\n\nI don't agree that removing `--annotate` obviates the need for `--unannotate`.\n\nI responded on 1/17 with what I think is a typical and normal use case\nfor that option:\n\n - add \"fancylib\" as a subtree of \"myprog\"\n - commit to \"myprog\" repo: \"fancylib: don't crash as much\"\n - split these commits back out to \"fancylib\" main repo, and remove\nthe \"fancylib: \" prefix\n\nIn my opinion this is a pretty normal workflow.  Commits to \"fancylib\"\nin the \"myprog\" repo are prefixed with \"fancylib: \", and that prefix\nbecomes redundant and should be removed if those commits are split\nback out into the \"fancylib\" main repo.\n\nI also tried to come up with another situation that would justify a\nmore general commit message rewriting facility, and I couldn't think\nof any other good use cases that don't involve removing a prefix.  But\nthat doesn't mean there aren't any.\n\n`--unannotate` is a clunky name, but I think this functionality is\nworth taking another look at.  Maybe it could be called\n`--remove-prefix` ?\n"},{"id":"208729","messageId":"7v4nhqwzzi.fsf@alter.siamese.dyndns.org","threadId":"32829","inReplyTo":"87d2wfrnbe.fsf@waller.obbligato.org","subject":"Re: [PATCH 11/13] contrib/subtree: Make each test self-contained","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-05T15:18:41Z","receivedAt":"2013-02-05T15:18:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"greened@obbligato.org writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> \"David A. Greene\" <greened@obbligato.org> writes:\n>>\n>>> +test_create_commit() (\n>>> +\trepo=$1\n>>> +\tcommit=$2\n>>> +\tcd \"$repo\"\n>>> +\tmkdir -p \"$(dirname \"$commit\")\"\n>>> +\techo \"$commit\" > \"$commit\"\n>>\n>> Style.\n>\n> I need a little more explanation.  :)  Is there a style guide somewhere?\n\nDocumentation/CodingGuidelines?\n\n>\n>>> +\tgit add \"$commit\"\n>>> +\tgit commit -m \"$commit\"\n>>> +)\n>>\n>> Very nice, but don't we want to check for possible errors in any of\n>> the above commands?\n>\n> I'll fix that.  :)\n> ...\n> Ok.  I'll rework this.\n\nThanks.\n\nI also think it would be a good idea for you to learn to push back\nto the original authors; fixing problems in patches by others, while\nis a good way to learn how their thinking process went, is not\nnecessarily fun.\n"},{"id":"209695","messageId":"87wqu54gjq.fsf@waller.obbligato.org","threadId":"32829","inReplyTo":"7v4nhqwzzi.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 11/13] contrib/subtree: Make each test self-contained","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T18:34:33Z","receivedAt":"2013-02-18T18:34:33Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I also think it would be a good idea for you to learn to push back\n> to the original authors; fixing problems in patches by others, while\n> is a good way to learn how their thinking process went, is not\n> necessarily fun.\n\nSure, but in this case I said I'd handle it so I will.\n\n                          -David\n"},{"id":"209697","messageId":"87sj4t4gar.fsf@waller.obbligato.org","threadId":"32829","inReplyTo":"CABVa4NiyVksEn4+NqBPXpaWGYnP6FeUqeacLOnAOHtw9FgMJdA@mail.gmail.com","subject":"Re: [PATCH 13/13] contrib/subtree: Remove --annotate","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T18:39:56Z","receivedAt":"2013-02-18T18:39:56Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"James Nylen <jnylen@gmail.com> writes:\n\n> I don't agree that removing `--annotate` obviates the need for `--unannotate`.\n>\n> I responded on 1/17 with what I think is a typical and normal use case\n> for that option:\n\nSorry, I must have missed that reply.\n\n>  - add \"fancylib\" as a subtree of \"myprog\"\n>  - commit to \"myprog\" repo: \"fancylib: don't crash as much\"\n>  - split these commits back out to \"fancylib\" main repo, and remove\n> the \"fancylib: \" prefix\n\nI can see how that would be useful.\n\n> `--unannotate` is a clunky name, but I think this functionality is\n> worth taking another look at.  Maybe it could be called\n> `--remove-prefix` ?\n\nShould this really be a function of git-subtree?  It seems like it would\nfit better in a history-rewriting command.  Wouldn't rebase -i or even\nfilter-branch be a better way to do this?\n\nIf there's no --annotate I don't see why git-subtree should have the\n--unannotate functionality.\n\nAgain, I agree that your example is relevant, maybe even common, but I\ndon't necessarily think git-subtree should be in the business of\nrewriting commit messages at all.\n\nI'd appreciate more thoughts from you on this.  I want to make sure we\ncan support your use case.\n\n                         -David\n"},{"id":"209708","messageId":"CABVa4NhyJ0FtYoFf9ZMnVt1eR9ezoCnd0oM5xGg1fgk0RwBUKg@mail.gmail.com","threadId":"32829","inReplyTo":"87sj4t4gar.fsf@waller.obbligato.org","subject":"Re: [PATCH 13/13] contrib/subtree: Remove --annotate","fromName":"James Nylen","fromEmail":"jnylen@gmail.com","sentAt":"2013-02-18T19:46:56Z","receivedAt":"2013-02-18T19:46:56Z","isPatch":true,"sender":{"key":"jnylen@gmail.com","avatar":"https://gravatar.com/avatar/96804ac655933f5b6380e992610d6ff9029c6d04db1042d4bec381312ff7ff1b?d=mp&s=160"},"body":"On Mon, Feb 18, 2013 at 1:39 PM,  <greened@obbligato.org> wrote:\n> James Nylen <jnylen@gmail.com> writes:\n>>  - add \"fancylib\" as a subtree of \"myprog\"\n>>  - commit to \"myprog\" repo: \"fancylib: don't crash as much\"\n>>  - split these commits back out to \"fancylib\" main repo, and remove\n>> the \"fancylib: \" prefix\n\n> Should this really be a function of git-subtree?  It seems like it would\n> fit better in a history-rewriting command.  Wouldn't rebase -i or even\n> filter-branch be a better way to do this?\n\nI'm not a git guru by any stretch, so I'm sure there are other ways to\naccommodate the example use case above.  I really just want to be able\nto split and merge repositories while keeping meaningful commit\nmessages with an appropriate level of detail.  Can you suggest an\nalternative workflow?\n\n> If there's no --annotate I don't see why git-subtree should have the\n> --unannotate functionality.\n\nBecause they are not inverse operations - they both apply to `git\nsubtree split`.  I think that `--annotate` would only be useful as an\noption to `git subtree merge`.  In that case it would be the inverse\noperation of `git subtree split --unannotate`, and then I would agree\nthat if you remove one, you can/should remove the other.\n\n> Again, I agree that your example is relevant, maybe even common, but I\n> don't necessarily think git-subtree should be in the business of\n> rewriting commit messages at all.\n\nI'm willing to accept that.  Junio seemed to be leaning that way too\nin earlier emails.\n\n> I'd appreciate more thoughts from you on this.  I want to make sure we\n> can support your use case.\n\nI currently need to enable `git subtree` manually anyway, since it's\nnot part of the main distribution.  So it's not a burden for me to\nsupport this feature with a customized script, or learn a new way to\ndo it.\n\nThanks for your consideration of this small and nit-picky issue.\n"}]}