{"thread":{"id":"32556","subject":"Revised git-subtree Patches","startedAt":"2013-01-08T12:09:50Z","lastAt":"2013-01-22T08:39:02Z","messageCount":22,"participants":["David A. Greene","Junio C Hamano","郑文辉 (Techlive Zheng)","greened@obbligato.org"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"206283","messageId":"1357646997-28675-1-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":null,"subject":"Revised git-subtree Patches","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:50Z","receivedAt":"2013-01-08T12:09:50Z","isPatch":false,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"Here is the set of revised patches to git-subtree.  I think I've\ngot everything cleaned up now.\n"},{"id":"206284","messageId":"1357646997-28675-2-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 1/7] Remove Test Number Comments","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:51Z","receivedAt":"2013-01-08T12:09:51Z","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":"206286","messageId":"1357646997-28675-3-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:52Z","receivedAt":"2013-01-08T12:09:52Z","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>\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 |   15 +++++++++++++++\n 2 files changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 920c664..5341b36 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -296,7 +296,11 @@ 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+\t# Use %B rather than %s%n%n%b to handle the special case of a\n+\t# commit that only has a subject line.  We don't want to\n+\t# introduce a newline after the subject, causing generation of\n+\t# a new hash.\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":"206290","messageId":"1357646997-28675-4-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:53Z","receivedAt":"2013-01-08T12:09:53Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"From: James Nylen <jnylen@gmail.com>\n\nTeach git-subtree about --unannotate.  This option strips a prefix\nfrom a commit message when doing a subtree split.\n\nSigned-off-by: James Nylen <jnylen@gmail.com>\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/git-subtree.sh     |   11 +++++++++--\n contrib/subtree/git-subtree.txt    |   15 +++++++++++++++\n contrib/subtree/t/t7900-subtree.sh |   12 ++++++++++--\n 3 files changed, 34 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 5341b36..cac0680 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -21,6 +21,7 @@ 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+unannotate=   remove a prefix from new commit messages (supports bash globbing)\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,6 +44,7 @@ onto=\n rejoin=\n ignore_joins=\n annotate=\n+unannotate=\n squash=\n message=\n \n@@ -80,6 +82,8 @@ while [ $# -gt 0 ]; do\n \t\t-d) debug=1 ;;\n \t\t--annotate) annotate=\"$1\"; shift ;;\n \t\t--no-annotate) annotate= ;;\n+\t\t--unannotate) unannotate=\"$1\"; shift ;;\n+\t\t--no-unannotate) unannotate= ;;\n \t\t-b) branch=\"$1\"; shift ;;\n \t\t-P) prefix=\"$1\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n@@ -314,8 +318,11 @@ 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\tgit commit-tree \"$2\" $3  # reads the rest of stdin\n+\t\t(\n+\t\t\tread FIRST_LINE\n+\t\t\techo \"$annotate${FIRST_LINE#$unannotate}\"\n+\t\t\tcat  # reads the rest of stdin\n+\t\t) | git commit-tree \"$2\" $3\n \t) || die \"Can't copy commit $1\"\n }\n \ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex c5bce41..75aa690 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -198,6 +198,21 @@ OPTIONS FOR split\n \tgit subtree tries to make it work anyway, particularly\n \tif you use --rejoin, but it may not always be effective.\n \n+--unannotate=<annotation>::\n+\tThis option is only valid for the split command.\n+\n+\tWhen generating synthetic history, try to remove the prefix\n+\t<annotation> from each commit message (using bash's \"strip\n+\tshortest match from beginning\" command, which supports\n+\tglobbing).  This makes sense if you format library commits\n+\tlike \"library: Change something or other\" when you're working\n+\tin your project's repository, but you want to remove this\n+\tprefix when pushing back to the library's upstream repository.\n+\t(In this case --unannotate='*: ' would work well.)\n+\t\n+\tLike --annotate,  you need to use the same <annotation>\n+\twhenever you split, or you may run into problems.\n+\n -b <branch>::\n --branch=<branch>::\n \tThis option is only valid for the split command.\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 3f17f55..de45e34 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -143,7 +143,7 @@ test_expect_success 'merge fetched subproj' '\n \n test_expect_success 'add main-sub5' '\n         create subdir/main-sub5 &&\n-        git commit -m \"main-sub5\"\n+        git commit -m \"subproj: main-sub5\"\n '\n \n test_expect_success 'add main6' '\n@@ -153,7 +153,7 @@ test_expect_success 'add main6' '\n \n test_expect_success 'add main-sub7' '\n         create subdir/main-sub7 &&\n-        git commit -m \"main-sub7\"\n+        git commit -m \"subproj: main-sub7\"\n '\n \n test_expect_success 'fetch new subproj history' '\n@@ -226,6 +226,14 @@ test_expect_success 'check hash of split' '\n         check_equal ''\"$new_hash\"'' \"$subdir_hash\"\n '\n \n+test_expect_success 'check --unannotate' '\n+        spl1=$(git subtree split --unannotate='\"subproj:\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n+        undo &&\n+        git subtree split --unannotate='\"subproj:\"' --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n+        check_equal ''\"$(git rev-parse splitunann)\"'' \"$spl1\" &&\n+        check_equal ''\"$(git log splitunann | grep subproj)\"'' \"\"\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":"206285","messageId":"1357646997-28675-5-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 4/7] contrib/subtree: Better Error Handling for add","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:54Z","receivedAt":"2013-01-08T12:09:54Z","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 cac0680..d53eaee 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -508,12 +508,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+            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+            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":"206289","messageId":"1357646997-28675-6-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 5/7] contrib/subtree: Fix Synopsis","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:55Z","receivedAt":"2013-01-08T12:09:55Z","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 d53eaee..0e9ea0f 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@@ -513,6 +514,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             die \"'$2' does not refer to a commit\"\n \ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 75aa690..078d4ac 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":"206287","messageId":"1357646997-28675-7-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 6/7] contrib/subtree: Honor DESTDIR","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:56Z","receivedAt":"2013-01-08T12:09:56Z","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>\n\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":"206288","messageId":"1357646997-28675-8-git-send-email-greened@obbligato.org","threadId":"32556","inReplyTo":"1357646997-28675-1-git-send-email-greened@obbligato.org","subject":"[PATCH 7/7] contrib/subtree: Make the Manual Directory if Needed","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-01-08T12:09:57Z","receivedAt":"2013-01-08T12:09:57Z","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>\n\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":"206319","messageId":"7vmwwjedei.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"1357646997-28675-3-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-08T18:29:57Z","receivedAt":"2013-01-08T18:29:57Z","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> Use %B to format the commit message and body to avoid an extra newline\n> if a commit only has a subject line.\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n\nThis time (only), I'll try to fix them up at my end, but please\ncheck your toolchain, find out where the extra blank line between\nS-o-b: lines we see above come from, and fix that, so that I won't\nhave to do so again.\n\n>  contrib/subtree/git-subtree.sh     |    6 +++++-\n>  contrib/subtree/t/t7900-subtree.sh |   15 +++++++++++++++\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 920c664..5341b36 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -296,7 +296,11 @@ 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> +\t# Use %B rather than %s%n%n%b to handle the special case of a\n> +\t# commit that only has a subject line.  We don't want to\n> +\t# introduce a newline after the subject, causing generation of\n> +\t# a new hash.\n> +\tgit log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' \"$1\" |\n\nThe new format template is fine, but I do not think the comment\nshould be there.  It does not give any useful information to people\nwho are reading the end result of applying this patch and is useful\nonly in the context of comparing the old and new templates, iow, it\nbelongs to the commit log message.\n\n>  \t(\n>  \t\tread GIT_AUTHOR_NAME\n>  \t\tread GIT_AUTHOR_EMAIL\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 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\nWe'd need to clean up these no-op '' from this, but not doing so in\nthis patch is perfectly fine (and is even preferred).\n\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\nThanks.\n"},{"id":"206321","messageId":"7vehhvecoy.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"1357646997-28675-4-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-08T18:45:17Z","receivedAt":"2013-01-08T18:45:17Z","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> diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\n> index c5bce41..75aa690 100644\n> --- a/contrib/subtree/git-subtree.txt\n> +++ b/contrib/subtree/git-subtree.txt\n> @@ -198,6 +198,21 @@ OPTIONS FOR split\n>  \tgit subtree tries to make it work anyway, particularly\n>  \tif you use --rejoin, but it may not always be effective.\n>  \n> +--unannotate=<annotation>::\n> +\tThis option is only valid for the split command.\n> +\n> +\tWhen generating synthetic history, try to remove the prefix\n> +\t<annotation> from each commit message (using bash's \"strip\n> +\tshortest match from beginning\" command, which supports\n> +\tglobbing).  This makes sense if you format library commits\n> +\tlike \"library: Change something or other\" when you're working\n> +\tin your project's repository, but you want to remove this\n> +\tprefix when pushing back to the library's upstream repository.\n> +\t(In this case --unannotate='*: ' would work well.)\n> +\t\n> +\tLike --annotate,  you need to use the same <annotation>\n> +\twhenever you split, or you may run into problems.\n\nI think this paragraph inherits existing breakage from the beginning\nof time, but I do not think the above will format the second and\nsubsequent paragraphs correctly.\n\nI've applied all seven patches in the series with minor fix-ups, and\nwill merge it to 'pu'.\n\nThanks.\n"},{"id":"206322","messageId":"7v7gnneco2.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"1357646997-28675-5-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 4/7] contrib/subtree: Better Error Handling for add","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-08T18:45:49Z","receivedAt":"2013-01-08T18:45:49Z","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> Check refspecs for validity before passing them on to other commands.\n> This lets us generate more helpful error messages.\n>\n> Signed-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>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index cac0680..d53eaee 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -508,12 +508,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> +            die \"'$1' does not refer to a commit\"\n\nWhere do these uneven indentation come from?  Is it mimicking\nexisting breakage in the script?\n\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> +            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"},{"id":"206340","messageId":"CAPYzjrQ1ngfOwBuzq+Da1Ynd18Vwt8=LCyu2yhE6dX8vivwReg@mail.gmail.com","threadId":"32556","inReplyTo":"1357646997-28675-3-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"郑文辉 (Techlive Zheng)","fromEmail":"techlivezheng@gmail.com","sentAt":"2013-01-08T23:21:27Z","receivedAt":"2013-01-08T23:21:27Z","isPatch":true,"sender":{"key":"techlivezheng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/816673?v=4"},"body":"2013/1/8 David A. Greene <greened@obbligato.org>:\n> From: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Use %B to format the commit message and body to avoid an extra newline\n> if a commit only has a subject line.\n>\n> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n>\n> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/git-subtree.sh     |    6 +++++-\n>  contrib/subtree/t/t7900-subtree.sh |   15 +++++++++++++++\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 920c664..5341b36 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -296,7 +296,11 @@ copy_commit()\n>         # We're going to set some environment vars here, so\n>         # do it in a subshell to get rid of them safely later\n>         debug copy_commit \"{$1}\" \"{$2}\" \"{$3}\"\n> -       git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%s%n%n%b' \"$1\" |\n> +       # Use %B rather than %s%n%n%b to handle the special case of a\n> +       # commit that only has a subject line.  We don't want to\n> +       # introduce a newline after the subject, causing generation of\n> +       # a new hash.\n> +       git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' \"$1\" |\n>         (\n>                 read GIT_AUTHOR_NAME\n>                 read GIT_AUTHOR_EMAIL\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 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> +\nThis test is not test the correct thing, I am currently working on it.\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> --\n> 1.7.10.4\n>\n"},{"id":"206345","messageId":"7vzk0j9oig.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"CAPYzjrQ1ngfOwBuzq+Da1Ynd18Vwt8=LCyu2yhE6dX8vivwReg@mail.gmail.com","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-09T00:41:11Z","receivedAt":"2013-01-09T00:41:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"郑文辉(Techlive Zheng)\"  <techlivezheng@gmail.com> writes:\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> This test is not test the correct thing, I am currently working on it.\n\nWill keep the topic branch out of 'next' for now.\n\nDavid, how would you like to handle a reroll of this piece?\n"},{"id":"207020","messageId":"87622xrf8n.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7vmwwjedei.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-16T03:14:32Z","receivedAt":"2013-01-16T03:14:32Z","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> \"David A. Greene\" <greened@obbligato.org> writes:\n>\n>> From: Techlive Zheng <techlivezheng@gmail.com>\n>>\n>> Use %B to format the commit message and body to avoid an extra newline\n>> if a commit only has a subject line.\n>>\n>> Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>\n>>\n>> Signed-off-by: David A. Greene <greened@obbligato.org>\n>> ---\n>\n> This time (only), I'll try to fix them up at my end, but please\n> check your toolchain, find out where the extra blank line between\n> S-o-b: lines we see above come from, and fix that, so that I won't\n> have to do so again.\n\nWill do.\n\n>>  contrib/subtree/git-subtree.sh     |    6 +++++-\n>>  contrib/subtree/t/t7900-subtree.sh |   15 +++++++++++++++\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 920c664..5341b36 100755\n>> --- a/contrib/subtree/git-subtree.sh\n>> +++ b/contrib/subtree/git-subtree.sh\n>> @@ -296,7 +296,11 @@ 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>> +\t# Use %B rather than %s%n%n%b to handle the special case of a\n>> +\t# commit that only has a subject line.  We don't want to\n>> +\t# introduce a newline after the subject, causing generation of\n>> +\t# a new hash.\n>> +\tgit log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' \"$1\" |\n>\n> The new format template is fine, but I do not think the comment\n> should be there.  It does not give any useful information to people\n> who are reading the end result of applying this patch and is useful\n> only in the context of comparing the old and new templates, iow, it\n> belongs to the commit log message.\n\nI'll delete the comment.\n\n                           -David\n"},{"id":"207021","messageId":"87zk09q0i4.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7vzk0j9oig.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-16T03:18:11Z","receivedAt":"2013-01-16T03:18:11Z","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> David, how would you like to handle a reroll of this piece?\n\nI'll just get the test fix from Techlive Zheng, apply it to my\nbranch and re-send.\n\nAre you incorporating the other patches?  Should I drop them\nfrom my list?\n\n                        -David\n"},{"id":"207022","messageId":"87vcaxq0ez.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7vehhvecoy.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-16T03:20:04Z","receivedAt":"2013-01-16T03:20:04Z","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> \"David A. Greene\" <greened@obbligato.org> writes:\n>\n>> diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\n>> index c5bce41..75aa690 100644\n>> --- a/contrib/subtree/git-subtree.txt\n>> +++ b/contrib/subtree/git-subtree.txt\n>> @@ -198,6 +198,21 @@ OPTIONS FOR split\n>>  \tgit subtree tries to make it work anyway, particularly\n>>  \tif you use --rejoin, but it may not always be effective.\n>>  \n>> +--unannotate=<annotation>::\n>> +\tThis option is only valid for the split command.\n>> +\n>> +\tWhen generating synthetic history, try to remove the prefix\n>> +\t<annotation> from each commit message (using bash's \"strip\n>> +\tshortest match from beginning\" command, which supports\n>> +\tglobbing).  This makes sense if you format library commits\n>> +\tlike \"library: Change something or other\" when you're working\n>> +\tin your project's repository, but you want to remove this\n>> +\tprefix when pushing back to the library's upstream repository.\n>> +\t(In this case --unannotate='*: ' would work well.)\n>> +\t\n>> +\tLike --annotate,  you need to use the same <annotation>\n>> +\twhenever you split, or you may run into problems.\n>\n> I think this paragraph inherits existing breakage from the beginning\n> of time, but I do not think the above will format the second and\n> subsequent paragraphs correctly.\n\nOk, I'll take a look.\n\n> I've applied all seven patches in the series with minor fix-ups, and\n> will merge it to 'pu'.\n\nThanks!\n\n                          -David\n"},{"id":"207023","messageId":"87r4llq0d6.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7v7gnneco2.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 4/7] contrib/subtree: Better Error Handling for add","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-16T03:21:09Z","receivedAt":"2013-01-16T03:21:09Z","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> \"David A. Greene\" <greened@obbligato.org> writes:\n>\n>> From: \"David A. Greene\" <greened@obbligato.org>\n>>\n>> Check refspecs for validity before passing them on to other commands.\n>> This lets us generate more helpful error messages.\n>>\n>> Signed-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>>\n>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n>> index cac0680..d53eaee 100755\n>> --- a/contrib/subtree/git-subtree.sh\n>> +++ b/contrib/subtree/git-subtree.sh\n>> @@ -508,12 +508,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>> +            die \"'$1' does not refer to a commit\"\n>\n> Where do these uneven indentation come from?  Is it mimicking\n> existing breakage in the script?\n\nHuh.  I'm not sure how that happened.  I'll fix it if you haven't got to\nit already.\n\n                            -David\n"},{"id":"207025","messageId":"87y5ftojoj.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"87vcaxq0ez.fsf@waller.obbligato.org","subject":"Re: [PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-16T04:06:52Z","receivedAt":"2013-01-16T04:06:52Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"greened@obbligato.org writes:\n\n>> I think this paragraph inherits existing breakage from the beginning\n>> of time, but I do not think the above will format the second and\n>> subsequent paragraphs correctly.\n>\n> Ok, I'll take a look.\n\nI don't know what \"correctly\" is but it is at least formatted in a\nsimilar manner to the other options.\n\n                          -David\n"},{"id":"207026","messageId":"7vy5ftzr3s.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"87y5ftojoj.fsf@waller.obbligato.org","subject":"Re: [PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-16T04:31:03Z","receivedAt":"2013-01-16T04:31:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"greened@obbligato.org writes:\n\n> greened@obbligato.org writes:\n>\n>>> I think this paragraph inherits existing breakage from the beginning\n>>> of time, but I do not think the above will format the second and\n>>> subsequent paragraphs correctly.\n>>\n>> Ok, I'll take a look.\n>\n> I don't know what \"correctly\" is but it is at least formatted in a\n> similar manner to the other options.\n\nThat is what \"inherits existing breakage\" means ;-)\n\nThe first paragraph is typeset as body text, while the rest are\ntypeset in monospaced font, no?\n\nIt should be more like this, I think:\n\n        --option::\n                First paragraph\n        +\n        Second paragraph\n        +\n        And third paragraph\n"},{"id":"207058","messageId":"7va9s9yvzo.fsf@alter.siamese.dyndns.org","threadId":"32556","inReplyTo":"87zk09q0i4.fsf@waller.obbligato.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-16T15:43:07Z","receivedAt":"2013-01-16T15:43:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"greened@obbligato.org writes:\n\n> Are you incorporating the other patches?  Should I drop them\n> from my list?\n\nI actually was planning to accept patches to this subdirectory only\nthrough you, hopefully as messages that forward others' changes with\nyour Acked-by: tagline.  That frees me from having to keeping track\nof what goes on there ;-)\n"},{"id":"207495","messageId":"87liblfwa1.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7vy5ftzr3s.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/7] contrib/subtree: Add --unannotate","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-22T08:37:42Z","receivedAt":"2013-01-22T08:37:42Z","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> greened@obbligato.org writes:\n>\n>> greened@obbligato.org writes:\n>>\n>>>> I think this paragraph inherits existing breakage from the beginning\n>>>> of time, but I do not think the above will format the second and\n>>>> subsequent paragraphs correctly.\n>>>\n>>> Ok, I'll take a look.\n>>\n>> I don't know what \"correctly\" is but it is at least formatted in a\n>> similar manner to the other options.\n>\n> That is what \"inherits existing breakage\" means ;-)\n\nAh.\n\n> The first paragraph is typeset as body text, while the rest are\n> typeset in monospaced font, no?\n>\n> It should be more like this, I think:\n>\n>         --option::\n>                 First paragraph\n>         +\n>         Second paragraph\n>         +\n>         And third paragraph\n\nOk.\n\n                          -David\n"},{"id":"207497","messageId":"87ham9fw7t.fsf@waller.obbligato.org","threadId":"32556","inReplyTo":"7va9s9yvzo.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/7] contrib/subtree: Use %B for Split Subject/Body","fromName":"","fromEmail":"greened@obbligato.org","sentAt":"2013-01-22T08:39:02Z","receivedAt":"2013-01-22T08:39:02Z","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> greened@obbligato.org writes:\n>\n>> Are you incorporating the other patches?  Should I drop them\n>> from my list?\n>\n> I actually was planning to accept patches to this subdirectory only\n> through you, hopefully as messages that forward others' changes with\n> your Acked-by: tagline.  That frees me from having to keeping track\n> of what goes on there ;-)\n\nOk, just wanted to know the process.  Makes sense to me.\n\n                         -David\n"}]}