{"thread":{"id":"32930","subject":"Subtree Fixes Updates","startedAt":"2013-02-18T20:56:45Z","lastAt":"2013-02-18T22:55:24Z","messageCount":12,"participants":["David A. Greene","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"209725","messageId":"1361221013-12756-1-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":null,"subject":"Subtree Fixes Updates","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:45Z","receivedAt":"2013-02-18T20:56:45Z","isPatch":false,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"Here are the subtree fixes I've got with changes in response to\nfeedback.\n"},{"id":"209726","messageId":"1361221013-12756-2-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 1/8] contrib/subtree: Use %B for split subject/body","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:46Z","receivedAt":"2013-02-18T20:56:46Z","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/t/t7900-subtree.sh |   11 +++++++++++\n 1 file changed, 11 insertions(+)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 80d3399..8dd6a82 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -226,6 +226,17 @@ test_expect_success 'check hash of split' '\n \tcheck_equal ''\"$new_hash\"'' \"$subdir_hash\"\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":"209728","messageId":"1361221013-12756-3-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 2/8] contrib/subtree: Fix whitespaces","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:47Z","receivedAt":"2013-02-18T20:56:47Z","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 |  326 +++++++++++++++++-------------------\n 3 files changed, 206 insertions(+), 230 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 8dd6a82..c7f9e1a 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+\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+\tcreate sub1 &&\n+\tgit commit -m \"sub1\" &&\n+\tgit branch sub1 &&\n+\tgit branch -m master subproj\n '\n \n # Save this hash for testing later.\n@@ -79,133 +79,133 @@ 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+\tcreate sub2 &&\n+\tgit commit -m \"sub2\" &&\n+\tgit branch sub2\n '\n \n test_expect_success 'add sub3' '\n-        create sub3 &&\n-        git commit -m \"sub3\" &&\n-        git branch sub3\n+\tcreate sub3 &&\n+\tgit commit -m \"sub3\" &&\n+\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+\tcreate main4 &&\n+\tgit commit -m \"main4\" &&\n+\tgit branch -m master mainline &&\n+\tgit branch subdir\n '\n \n test_expect_success 'fetch subproj history' '\n-        git fetch ./subproj sub1 &&\n-        git branch sub1 FETCH_HEAD\n+\tgit fetch ./subproj sub1 &&\n+\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+\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+\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+\tgit subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n+\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+\tgit subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject using git subtree\" &&\n+\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+\tgit subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject with squash\" &&\n+\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+\tgit subtree add --prefix=subdir/ FETCH_HEAD &&\n+\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+\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+\tcreate subdir/main-sub5 &&\n+\tgit commit -m \"subproj: main-sub5\"\n '\n \n test_expect_success 'add main6' '\n-        create main6 &&\n-        git commit -m \"main6 boring\"\n+\tcreate main6 &&\n+\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+\tcreate subdir/main-sub7 &&\n+\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+\tgit fetch ./subproj sub2 &&\n+\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+\tgit subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n+\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+\tgit subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n+\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+\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\tgit branch pre-split &&\n+\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+\techo \"You must provide the --prefix option.\" > expected &&\n+\ttest_must_fail git subtree split > actual 2>&1 &&\n+\ttest_debug \"echo -n expected: \" &&\n+\ttest_debug \"cat expected\" &&\n+\ttest_debug \"echo -n actual: \" &&\n+\ttest_debug \"cat actual\" &&\n+\ttest_cmp expected actual &&\n+\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+\techo \"'\"'\"'non-existent-directory'\"'\"'\" does not exist\\; use \"'\"'\"'git subtree add'\"'\"'\" > expected &&\n+\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n+\ttest_debug \"echo -n expected: \" &&\n+\ttest_debug \"cat expected\" &&\n+\ttest_debug \"echo -n actual: \" &&\n+\ttest_debug \"cat actual\" &&\n+\ttest_cmp expected actual\n+\trm -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+\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\tgit branch spl1 \"$spl1\" &&\n+\tcheck_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n+\tundo\n '\n \n test_expect_success 'check split with --branch' '\n@@ -215,92 +215,70 @@ test_expect_success 'check split with --branch' '\n \tcheck_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n '\n \n-test_expect_success 'check hash of split' '\n-\tspl1=$(git subtree split --prefix subdir) &&\n-\tundo &&\n-\tgit subtree split --prefix subdir --branch splitbr1test &&\n-\tcheck_equal ''\"$(git rev-parse splitbr1test)\"'' \"$spl1\"\n-\tgit checkout splitbr1test &&\n-\tnew_hash=$(git rev-parse HEAD~2) &&\n-\tgit checkout mainline &&\n-\tcheck_equal ''\"$new_hash\"'' \"$subdir_hash\"\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-        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+\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\tundo &&\n+\tgit branch splitbr2 sub1 &&\n+\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n+\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+\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+\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+\tundo &&\n+\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n+\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+\tcreate subdir/main-sub8 &&\n+\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+\tgit fetch .. spl1 &&\n+\tgit branch spl1 FETCH_HEAD &&\n+\tgit merge FETCH_HEAD\n '\n \n test_expect_success 'add sub9' '\n-        create sub9 &&\n-        git commit -m \"sub9\"\n+\tcreate sub9 &&\n+\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+\tsplit2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n+\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+\tcreate subdir/main-sub10 &&\n+\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+\tspl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n+\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+\tgit fetch .. spl3 &&\n+\tgit branch spl3 FETCH_HEAD &&\n+\tgit merge FETCH_HEAD &&\n+\tgit branch subproj-merge-spl3\n '\n \n chkm=\"main4 main6\"\n@@ -310,44 +288,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+\tsubfiles=''\"$(git ls-files | fixnl)\"'' &&\n+\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+\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n+\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+\tgit fetch ./subproj subproj-merge-spl3 &&\n+\tgit branch subproj-merge-spl3 FETCH_HEAD &&\n+\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+\tmainfiles=''\"$(git ls-files | fixnl)\"'' &&\n+\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# main-sub?? and /subdir/main-sub?? both change, because those are the\n+\t# changes that were split into their own history.  And subdir/sub?? never\n+\t# change, since they were *only* changed in the subtree branch.\n+\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n+\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+\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# They are meaningless to subproj since one side of the merge refers to the mainline\n+\tcheck_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n '\n \n # prepare second pair of repositories\n@@ -355,27 +333,27 @@ mkdir test2\n cd test2\n \n test_expect_success 'init main' '\n-        test_create_repo main\n+\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+\tcreate main1 &&\n+\tgit commit -m \"main1\"\n '\n \n cd ..\n \n test_expect_success 'init sub' '\n-        test_create_repo sub\n+\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+\tcreate sub2 &&\n+\tgit commit -m \"sub2\"\n '\n \n cd ../main\n@@ -383,33 +361,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+\tgit fetch ../sub master &&\n+\tgit branch sub2 FETCH_HEAD &&\n+\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+\tcreate sub3 &&\n+\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+\tgit fetch ../sub master &&\n+\tgit branch sub3 FETCH_HEAD &&\n+\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+\tcreate subdir/main-sub4 &&\n+\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+\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@@ -418,21 +396,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+\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+\tmkdir subdir2 &&\n+\tcreate subdir2/main-sub5 &&\n+\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# also test that we still can split out an entirely new subtree\n+\t# if the parent of the first commit in the tree is not empty,\n+\t# then the new subtree has accidently been attached to something\n+\tgit subtree split --prefix subdir2 --branch mainsub5 &&\n+\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@@ -460,20 +438,18 @@ 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+\tx= &&\n+\tlist=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n+\t(git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n+\t(while read commit a b; do\n+      \t\ttest_debug \"echo Verifying commit \"''\"$commit\"''\n+\t\t\ttest_debug \"echo a: \"''\"$a\"''\n+\t\t\ttest_debug \"echo b: \"''\"$b\"''\n+\t\t\tcheck_equal \"$b\" \"\"\n+\t\t\tx=1\n+\t\tdone\n+\t\tcheck_equal \"$x\" 1\n+\t))\n '\n \n test_done\n-- \n1.7.10.4\n"},{"id":"209727","messageId":"1361221013-12756-4-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 3/8] contrib/subtree: Ignore testing directory","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:48Z","receivedAt":"2013-02-18T20:56:48Z","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":"209729","messageId":"1361221013-12756-5-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 4/8] contrib/subtree: Code cleaning and refactoring","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:49Z","receivedAt":"2013-02-18T20:56:49Z","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 |  256 +++++++++++++++++++-----------------\n 1 file changed, 136 insertions(+), 120 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex c7f9e1a..3787408 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,43 @@ undo()\n \tgit reset --hard HEAD~\n }\n \n+test_equal()\n+{\n+\tif test \"$1\" = \"$2\"\n+\tthen\n+\t\treturn 0\n+\telse\n+\t\ttest_debug 'echo'\n+\t\ttest_debug \"echo \\\"check a:\\\" \\\"{$1}\\\"\"\n+\t\ttest_debug \"echo \\\"\t\t b:\\\" \\\"{$2}\\\"\"\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 +121,7 @@ test_expect_success 'add main4' '\n \tcreate main4 &&\n \tgit commit -m \"main4\" &&\n \tgit branch -m master mainline &&\n-\tgit branch subdir\n+\tgit branch init\n '\n \n test_expect_success 'fetch subproj history' '\n@@ -105,40 +129,43 @@ test_expect_success 'fetch subproj history' '\n \tgit branch sub1 FETCH_HEAD\n '\n \n-test_expect_success 'no subtree exists in main tree' '\n-\ttest_must_fail git subtree merge --prefix=subdir sub1\n+test_expect_success 'no pull from non-existent subtree' '\n+\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n '\n \n-test_expect_success 'no pull from non-existant subtree' '\n-\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n+test_expect_success 'no merge from non-existent subtree' '\n+\ttest_must_fail git subtree merge --prefix=subdir FETCH_HEAD\n '\n \n-test_expect_success 'check if --message works for add' '\n-\tgit subtree add --prefix=subdir --message=\"Added subproject\" sub1 &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Added subproject\" &&\n+test_expect_success 'add subproj as subtree into subdir/ with --prefix' '\n+\tgit subtree add --prefix=subdir FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\" &&\n \tundo\n '\n \n-test_expect_success 'check if --message works as -m and --prefix as -P' '\n-\tgit subtree add -P subdir -m \"Added subproject using git subtree\" sub1 &&\n-\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+\tgit subtree add --prefix=subdir --message=\"Added subproject\" FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n \tundo\n '\n \n-test_expect_success 'check if --message works with squash too' '\n-\tgit subtree add -P subdir -m \"Added subproject with squash\" --squash sub1 &&\n-\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+\tgit subtree add -P subdir -m \"Added subproject\" FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n \tundo\n '\n \n-test_expect_success 'add subproj to mainline' '\n-\tgit subtree add --prefix=subdir/ FETCH_HEAD &&\n-\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+\tgit subtree add --prefix=subdir --message=\"Added subproject with squash\" --squash FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\" &&\n+\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-\tgit merge -m \"merge -s -ours\" -s ours FETCH_HEAD\n+test_expect_success 'merge the added subproj again, should do nothing' '\n+\tgit subtree add --prefix=subdir FETCH_HEAD &&\n+\t# this shouldn not actually do anything, since FETCH_HEAD\n+\t# is already a parent\n+\tgit merge -s ours -m \"merge -s -ours\" FETCH_HEAD\n '\n \n test_expect_success 'add main-sub5' '\n@@ -161,25 +188,30 @@ test_expect_success 'fetch new subproj history' '\n \tgit branch sub2 FETCH_HEAD\n '\n \n-test_expect_success 'check if --message works for merge' '\n-\tgit subtree merge --prefix=subdir -m \"Merged changes from subproject\" sub2 &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject\" &&\n+test_expect_success 'merge new subproj history into subdir/ with --prefix' '\n+\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\'' into mainline\" &&\n+\tundo\n+'\n+\n+test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '\n+\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject\" FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\" &&\n \tundo\n '\n \n-test_expect_success 'check if --message for merge works with squash too' '\n-\tgit subtree merge --prefix subdir -m \"Merged changes from subproject using squash\" --squash sub2 &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Merged changes from subproject using squash\" &&\n+test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '\n+\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject using squash\" --squash FETCH_HEAD &&\n+\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\" &&\n \tundo\n '\n \n-test_expect_success 'merge new subproj history into subdir' '\n+test_expect_success 'merge new subproj history into subdir/' '\n \tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\tgit branch pre-split &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Merge commit '\"'\"'\"$(git rev-parse sub2)\"'\"'\"' into mainline\"\n+\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 \techo \"You must provide the --prefix option.\" > expected &&\n \ttest_must_fail git subtree split > actual 2>&1 &&\n \ttest_debug \"echo -n expected: \" &&\n@@ -190,48 +222,56 @@ test_expect_success 'Check that prefix argument is required for split' '\n \trm -f expected actual\n '\n \n-test_expect_success 'Check that the <prefix> exists for a split' '\n-\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+\techo \"'\\''non-existent-directory'\\'' does not exist; use '\\''git subtree add'\\''\" > expected &&\n \ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n \ttest_debug \"echo -n expected: \" &&\n \ttest_debug \"cat expected\" &&\n \ttest_debug \"echo -n actual: \" &&\n \ttest_debug \"cat actual\" &&\n-\ttest_cmp expected actual\n+\ttest_cmp expected actual &&\n \trm -f expected actual\n '\n \n-test_expect_success 'check if --message works for split+rejoin' '\n-\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n-\tgit branch spl1 \"$spl1\" &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Split & rejoin\" &&\n+test_expect_success 'split subdir/ with --rejoin' '\n+\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n+ \tgit branch spl1 \"$spl1\" &&\n+\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n+\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$spl1'\\''\" &&\n+ \tundo\n+ '\n+\n+test_expect_success 'split subdir/ with --rejoin and --message' '\n+\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n+\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\" &&\n \tundo\n '\n \n-test_expect_success 'check split with --branch' '\n-\tspl1=$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n-\tundo &&\n-\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr1 &&\n-\tcheck_equal ''\"$(git rev-parse splitbr1)\"'' \"$spl1\"\n-'\n+test_expect_success 'split subdir/ with --branch' '\n+\tspl1=$(git subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin) &&\n+ \tundo &&\n+\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr1 &&\n+\ttest_equal \"$(git rev-parse splitbr1)\" \"$spl1\"\n+ '\n \n-test_expect_success 'check split with --branch for an existing branch' '\n-\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+\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\" --message=\"Split & rejoin\" --rejoin) &&\n \tundo &&\n \tgit branch splitbr2 sub1 &&\n-\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&\n-\tcheck_equal ''\"$(git rev-parse splitbr2)\"'' \"$spl1\"\n+\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr2 &&\n+\ttest_equal \"$(git rev-parse splitbr2)\" \"$spl1\"\n '\n \n-test_expect_success 'check split with --branch for an incompatible branch' '\n-\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+\ttest_must_fail git subtree split --prefix=subdir --branch init\n '\n \n-test_expect_success 'check split+rejoin' '\n-\tspl1=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin)\"'' &&\n+test_expect_success 'check --unannotate' '\n+\tspl1=$(git subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n \tundo &&\n-\tgit subtree split --annotate='\"'*'\"' --prefix subdir --onto FETCH_HEAD --rejoin &&\n-\tcheck_equal ''\"$(last_commit_message)\"'' \"Split '\"'\"'subdir/'\"'\"' into commit '\"'\"'\"$spl1\"'\"'\"'\"\n+ \tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n+\ttest_equal \"$(git rev-parse splitunann)\" \"$spl1\" &&\n+\ttest_equal \"$(git log splitunann | grep subproj)\" \"\"\n '\n \n test_expect_success 'add main-sub8' '\n@@ -257,8 +297,8 @@ test_expect_success 'add sub9' '\n cd ..\n \n test_expect_success 'split for sub8' '\n-\tsplit2=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir/ --rejoin)\"''\n-\tgit branch split2 \"$split2\"\n+\tspl2=$(git subtree split --prefix=subdir/ --annotate=\"*\" --rejoin) &&\n+\tgit branch spl2 \"$spl2\"\n '\n \n test_expect_success 'add main-sub10' '\n@@ -267,7 +307,7 @@ test_expect_success 'add main-sub10' '\n '\n \n test_expect_success 'split for sub10' '\n-\tspl3=''\"$(git subtree split --annotate='\"'*'\"' --prefix subdir --rejoin)\"'' &&\n+\tspl3=$(git subtree split --prefix=subdir --annotate=\"*\" --rejoin) &&\n \tgit branch spl3 \"$spl3\"\n '\n \n@@ -288,13 +328,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-\tsubfiles=''\"$(git ls-files | fixnl)\"'' &&\n-\tcheck_equal \"$subfiles\" \"$chkms $chks\"\n+\tsubfiles=$(git ls-files | fixnl) &&\n+\ttest_equal \"$subfiles\" \"$chkms $chks\"\n '\n \n-test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '\n-\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-\tcheck_equal \"$allchanges\" \"$chkms $chks\"\n+test_expect_success 'make sure the subproj *only* contains commits that affect the subdir' '\n+\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n+\ttest_equal \"$allchanges\" \"$chkms $chks\"\n '\n \n # Back to mainline\n@@ -307,25 +347,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-\tmainfiles=''\"$(git ls-files | fixnl)\"'' &&\n-\tcheck_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n+\tmainfiles=$(git ls-files | fixnl) &&\n+\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# main-sub?? and /subdir/main-sub?? both change, because those are the\n \t# changes that were split into their own history.  And subdir/sub?? never\n \t# change, since they were *only* changed in the subtree branch.\n-\tallchanges=''\"$(git log --name-only --pretty=format:'\"''\"' | sort | fixnl)\"'' &&\n-\tcheck_equal \"$allchanges\" ''\"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"''\n+\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n+\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-\tcheck_equal ''\"$(git log --pretty=format:'\"'%s'\"' HEAD^2 | grep -i split)\"'' \"\"\n+\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# They are meaningless to subproj since one side of the merge refers to the mainline\n-\tcheck_equal ''\"$(git log --pretty=format:'\"'%s%n%b'\"' HEAD^2 | grep \"git-subtree.*:\")\"'' \"\"\n+\ttest_equal \"$(git log --pretty=format:\"%s%n%b\" HEAD^2 | grep \"git-subtree.*:\")\" \"\"\n '\n \n # prepare second pair of repositories\n@@ -363,7 +403,7 @@ cd ../main\n test_expect_success 'add sub as subdir in main' '\n \tgit fetch ../sub master &&\n \tgit branch sub2 FETCH_HEAD &&\n-\tgit subtree add --prefix subdir sub2\n+\tgit subtree add --prefix=subdir sub2\n '\n \n cd ../sub\n@@ -378,7 +418,7 @@ cd ../main\n test_expect_success 'merge from sub' '\n \tgit fetch ../sub master &&\n \tgit branch sub3 FETCH_HEAD &&\n-\tgit subtree merge --prefix subdir sub3\n+\tgit subtree merge --prefix=subdir sub3\n '\n \n test_expect_success 'add main-sub4' '\n@@ -387,7 +427,7 @@ test_expect_success 'add main-sub4' '\n '\n \n test_expect_success 'split for main-sub4 without --onto' '\n-\tgit subtree split --prefix subdir --branch mainsub4\n+\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@@ -396,7 +436,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-\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub4)\"'' ''\"$(git rev-parse sub3)\"''\n+\ttest_equal \"$(git log --pretty=format:%P -1 mainsub4)\" \"$(git rev-parse sub3)\"\n '\n \n test_expect_success 'add main-sub5' '\n@@ -409,47 +449,23 @@ test_expect_success 'split for main-sub5 without --onto' '\n \t# also test that we still can split out an entirely new subtree\n \t# if the parent of the first commit in the tree is not empty,\n \t# then the new subtree has accidently been attached to something\n-\tgit subtree split --prefix subdir2 --branch mainsub5 &&\n-\tcheck_equal ''\"$(git log --pretty=format:%P -1 mainsub5)\"'' \"\"\n+\tgit subtree split --prefix=subdir2 --branch mainsub5 &&\n+\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 \tx= &&\n-\tlist=''\"$(git log --pretty=format:'\"'commit: %H'\"' | joincommits)\"'' &&\n-\t(git log --pretty=format:'\"'commit: %H'\"' | joincommits |\n-\t(while read commit a b; do\n-      \t\ttest_debug \"echo Verifying commit \"''\"$commit\"''\n-\t\t\ttest_debug \"echo a: \"''\"$a\"''\n-\t\t\ttest_debug \"echo b: \"''\"$b\"''\n-\t\t\tcheck_equal \"$b\" \"\"\n+\tgit log --pretty=format:\"commit: %H\" | join_commits |\n+\t(\n+\t\twhile read commit a b; do\n+\t\t\ttest_debug \"echo Verifying commit $commit\"\n+\t\t\ttest_debug \"echo a: $a\"\n+\t\t\ttest_debug \"echo b: $b\"\n+\t\t\ttest_equal \"$b\" \"\"\n \t\t\tx=1\n \t\tdone\n-\t\tcheck_equal \"$x\" 1\n-\t))\n+\t\ttest_equal \"$x\" 1\n+\t)\n '\n \n test_done\n-- \n1.7.10.4\n"},{"id":"209731","messageId":"1361221013-12756-6-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 5/8] contrib/subtree: Make each test self-contained","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:50Z","receivedAt":"2013-02-18T20:56:50Z","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 | 1000 +++++++++++++++++++++++++-----------\n 1 file changed, 693 insertions(+), 307 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 3787408..eee032d 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 \tif test \"$1\" = \"$2\"\n@@ -79,392 +68,789 @@ 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+\t|| error \"Could not create directory for commit\"\n+\techo \"$commit\" >\"$commit\"\n+\tgit add \"$commit\" || error \"Could not add commit\"\n+\tgit commit -m \"$commit\" || error \"Could not commit\"\n+)\n+\n last_commit_message()\n {\n \tgit log --pretty=format:%s -1\n }\n \n-test_expect_success 'init subproj' '\n-\ttest_create_repo subproj\n-'\n-\n-# To the subproject!\n-cd subproj\n-\n-test_expect_success 'add sub1' '\n-\tcreate sub1 &&\n-\tgit commit -m \"sub1\" &&\n-\tgit branch sub1 &&\n-\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-\tcreate sub2 &&\n-\tgit commit -m \"sub2\" &&\n-\tgit branch sub2\n-'\n-\n-test_expect_success 'add sub3' '\n-\tcreate sub3 &&\n-\tgit commit -m \"sub3\" &&\n-\tgit branch sub3\n-'\n-\n-# Back to mainline\n-cd ..\n-\n-test_expect_success 'add main4' '\n-\tcreate main4 &&\n-\tgit commit -m \"main4\" &&\n-\tgit branch -m master mainline &&\n-\tgit branch init\n-'\n+subtree_test_count=0\n+next_test() {\n+\tsubtree_test_count=$(($subtree_test_count+1))\n+}\n \n-test_expect_success 'fetch subproj history' '\n-\tgit fetch ./subproj sub1 &&\n-\tgit branch sub1 FETCH_HEAD\n-'\n+#\n+# Tests for 'git subtree add'\n+#\n \n+next_test\n test_expect_success 'no pull from non-existent subtree' '\n-\ttest_must_fail git subtree pull --prefix=subdir ./subproj sub1\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'no merge from non-existent subtree' '\n-\ttest_must_fail git subtree merge --prefix=subdir FETCH_HEAD\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'add subproj as subtree into subdir/ with --prefix' '\n-\tgit subtree add --prefix=subdir FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Add '\\''subdir/'\\'' from commit '\\''$(git rev-parse FETCH_HEAD)'\\''\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'add subproj as subtree into subdir/ with --prefix and --message' '\n-\tgit subtree add --prefix=subdir --message=\"Added subproject\" FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'add subproj as subtree into subdir/ with --prefix as -P and --message as -m' '\n-\tgit subtree add -P subdir -m \"Added subproject\" FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Added subproject\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'add subproj as subtree into subdir/ with --squash and --prefix and --message' '\n-\tgit subtree add --prefix=subdir --message=\"Added subproject with squash\" --squash FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Added subproject with squash\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'merge the added subproj again, should do nothing' '\n-\tgit subtree add --prefix=subdir FETCH_HEAD &&\n-\t# this shouldn not actually do anything, since FETCH_HEAD\n-\t# is already a parent\n-\tgit merge -s ours -m \"merge -s -ours\" FETCH_HEAD\n-'\n-\n-test_expect_success 'add main-sub5' '\n-\tcreate subdir/main-sub5 &&\n-\tgit commit -m \"subproj: main-sub5\"\n-'\n-\n-test_expect_success 'add main6' '\n-\tcreate main6 &&\n-\tgit commit -m \"main6 boring\"\n-'\n-\n-test_expect_success 'add main-sub7' '\n-\tcreate subdir/main-sub7 &&\n-\tgit commit -m \"subproj: main-sub7\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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 'fetch new subproj history' '\n-\tgit fetch ./subproj sub2 &&\n-\tgit branch sub2 FETCH_HEAD\n-'\n+#\n+# Tests for 'git subtree merge'\n+#\n \n+next_test\n test_expect_success 'merge new subproj history into subdir/ with --prefix' '\n-\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Merge commit '\\''$(git rev-parse FETCH_HEAD)'\\'' into mainline\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '\n-\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject\" FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '\n-\tgit subtree merge --prefix=subdir --message=\"Merged changes from subproject using squash\" --squash FETCH_HEAD &&\n-\ttest_equal \"$(last_commit_message)\" \"Merged changes from subproject using squash\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n-test_expect_success 'merge new subproj history into subdir/' '\n-\tgit subtree merge --prefix=subdir FETCH_HEAD &&\n-\tgit branch pre-split\n-'\n+#\n+# Tests for 'git subtree split'\n+#\n \n+next_test\n test_expect_success 'split requires option --prefix' '\n-\techo \"You must provide the --prefix option.\" > expected &&\n-\ttest_must_fail git subtree split > actual 2>&1 &&\n-\ttest_debug \"echo -n expected: \" &&\n-\ttest_debug \"cat expected\" &&\n-\ttest_debug \"echo -n actual: \" &&\n-\ttest_debug \"cat actual\" &&\n-\ttest_cmp expected actual &&\n-\trm -f expected actual\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'split requires path given by option --prefix must exist' '\n-\techo \"'\\''non-existent-directory'\\'' does not exist; use '\\''git subtree add'\\''\" > expected &&\n-\ttest_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&\n-\ttest_debug \"echo -n expected: \" &&\n-\ttest_debug \"cat expected\" &&\n-\ttest_debug \"echo -n actual: \" &&\n-\ttest_debug \"cat actual\" &&\n-\ttest_cmp expected actual &&\n-\trm -f expected actual\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'split subdir/ with --rejoin' '\n-\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\") &&\n- \tgit branch spl1 \"$spl1\" &&\n-\tgit subtree split --prefix=subdir --annotate=\"*\" --rejoin &&\n-\ttest_equal \"$(last_commit_message)\" \"Split '\\''subdir/'\\'' into commit '\\''$spl1'\\''\" &&\n- \tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 '\\''$split_hash'\\''\"\n+\t)\n  '\n \n+next_test\n test_expect_success 'split subdir/ with --rejoin and --message' '\n-\tgit subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin &&\n-\ttest_equal \"$(last_commit_message)\" \"Split & rejoin\" &&\n-\tundo\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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)\n '\n \n+next_test\n test_expect_success 'split subdir/ with --branch' '\n-\tspl1=$(git subtree split --prefix=subdir --message=\"Split & rejoin\" --annotate=\"*\" --rejoin) &&\n- \tundo &&\n-\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr1 &&\n-\ttest_equal \"$(git rev-parse splitbr1)\" \"$spl1\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'split subdir/ with --branch for an existing branch' '\n-\tspl1=$(git subtree split --prefix=subdir --annotate=\"*\" --message=\"Split & rejoin\" --rejoin) &&\n-\tundo &&\n-\tgit branch splitbr2 sub1 &&\n-\tgit subtree split --prefix=subdir --annotate=\"*\" --branch splitbr2 &&\n-\ttest_equal \"$(git rev-parse splitbr2)\" \"$spl1\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'split subdir/ with --branch for an incompatible branch' '\n-\ttest_must_fail git subtree split --prefix=subdir --branch init\n-'\n-\n-test_expect_success 'check --unannotate' '\n-\tspl1=$(git subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --message \"Split & rejoin\" --rejoin) &&\n-\tundo &&\n- \tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n-\ttest_equal \"$(git rev-parse splitunann)\" \"$spl1\" &&\n-\ttest_equal \"$(git log splitunann | grep subproj)\" \"\"\n-'\n-\n-test_expect_success 'add main-sub8' '\n-\tcreate subdir/main-sub8 &&\n-\tgit commit -m \"main-sub8\"\n-'\n-\n-# To the subproject!\n-cd ./subproj\n-\n-test_expect_success 'merge split into subproj' '\n-\tgit fetch .. spl1 &&\n-\tgit branch spl1 FETCH_HEAD &&\n-\tgit merge FETCH_HEAD\n-'\n-\n-test_expect_success 'add sub9' '\n-\tcreate sub9 &&\n-\tgit commit -m \"sub9\"\n-'\n-\n-# Back to mainline\n-cd ..\n-\n-test_expect_success 'split for sub8' '\n-\tspl2=$(git subtree split --prefix=subdir/ --annotate=\"*\" --rejoin) &&\n-\tgit branch spl2 \"$spl2\"\n-'\n-\n-test_expect_success 'add main-sub10' '\n-\tcreate subdir/main-sub10 &&\n-\tgit commit -m \"main-sub10\"\n-'\n-\n-test_expect_success 'split for sub10' '\n-\tspl3=$(git subtree split --prefix=subdir --annotate=\"*\" --rejoin) &&\n-\tgit branch spl3 \"$spl3\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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-# To the subproject!\n-cd ./subproj\n+#\n+# Validity checking\n+#\n \n-test_expect_success 'merge split into subproj' '\n-\tgit fetch .. spl3 &&\n-\tgit branch spl3 FETCH_HEAD &&\n-\tgit merge FETCH_HEAD &&\n-\tgit branch subproj-merge-spl3\n-'\n+next_test\n+test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD &&\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+\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-test_expect_success 'make sure exactly the right set of files ends up in the subproj' '\n-\tsubfiles=$(git ls-files | fixnl) &&\n-\ttest_equal \"$subfiles\" \"$chkms $chks\"\n+\t\tsubfiles=$(git ls-files | fixnl) &&\n+\t\ttest_equal \"$subfiles\" \"$chkms $chks\"\n+\t)\n '\n \n+next_test\n test_expect_success 'make sure the subproj *only* contains commits that affect the subdir' '\n-\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n-\ttest_equal \"$allchanges\" \"$chkms $chks\"\n-'\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD &&\n \n-# Back to mainline\n-cd ..\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-test_expect_success 'pull from subproj' '\n-\tgit fetch ./subproj subproj-merge-spl3 &&\n-\tgit branch subproj-merge-spl3 FETCH_HEAD &&\n-\tgit subtree pull --prefix=subdir ./subproj subproj-merge-spl3\n+\t\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n+\t\ttest_equal \"$allchanges\" \"$chkms $chks\"\n+\t)\n '\n \n+next_test\n test_expect_success 'make sure exactly the right set of files ends up in the mainline' '\n-\tmainfiles=$(git ls-files | fixnl) &&\n-\ttest_equal \"$mainfiles\" \"$chkm $chkms_sub $chks_sub\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'make sure each filename changed exactly once in the entire history' '\n-\t# main-sub?? and /subdir/main-sub?? both change, because those are the\n-\t# changes that were split into their own history.  And subdir/sub?? never\n-\t# change, since they were *only* changed in the subtree branch.\n-\tallchanges=$(git log --name-only --pretty=format:\"\" | sort | fixnl) &&\n-\ttest_equal \"$allchanges\" \"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)\"\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_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+next_test\n test_expect_success 'make sure the --rejoin commits never make it into subproj' '\n-\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# They are meaningless to subproj since one side of the merge refers to the mainline\n-\ttest_equal \"$(git log --pretty=format:\"%s%n%b\" HEAD^2 | grep \"git-subtree.*:\")\" \"\"\n-'\n-\n-# prepare second pair of repositories\n-mkdir test2\n-cd test2\n-\n-test_expect_success 'init main' '\n-\ttest_create_repo main\n-'\n-\n-cd main\n-\n-test_expect_success 'add main1' '\n-\tcreate main1 &&\n-\tgit commit -m \"main1\"\n-'\n-\n-cd ..\n-\n-test_expect_success 'init sub' '\n-\ttest_create_repo sub\n-'\n-\n-cd sub\n-\n-test_expect_success 'add sub2' '\n-\tcreate sub2 &&\n-\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-\tgit fetch ../sub master &&\n-\tgit branch sub2 FETCH_HEAD &&\n-\tgit subtree add --prefix=subdir sub2\n-'\n-\n-cd ../sub\n-\n-test_expect_success 'add sub3' '\n-\tcreate sub3 &&\n-\tgit commit -m \"sub3\"\n-'\n-\n-cd ../main\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n \n-test_expect_success 'merge from sub' '\n-\tgit fetch ../sub master &&\n-\tgit branch sub3 FETCH_HEAD &&\n-\tgit subtree merge --prefix=subdir sub3\n+\t\ttest_equal \"$(git log --pretty=format:\"%s\" HEAD^2 | grep -i split)\" \"\"\n+\t)\n '\n \n-test_expect_success 'add main-sub4' '\n-\tcreate subdir/main-sub4 &&\n-\tgit commit -m \"main-sub4\"\n-'\n+next_test\n+test_expect_success 'make sure no \"git subtree\" tagged commits make it into subproj' '\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\ttest_create_commit \"$subtree_test_count\" main2 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub4 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --annotate=\"*\" --branch subproj-br --rejoin\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count/subproj\" &&\n+\t\tgit fetch .. subproj-br && git merge FETCH_HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree pull --prefix=subdir ./subproj master &&\n \n-test_expect_success 'split for main-sub4 without --onto' '\n-\tgit subtree split --prefix=subdir --branch mainsub4\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-# 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+# A new set of tests\n+#\n \n-test_expect_success 'check that the commit parent is sub3' '\n-\ttest_equal \"$(git log --pretty=format:%P -1 mainsub4)\" \"$(git rev-parse sub3)\"\n+next_test\n+test_expect_success 'make sure \"git subtree split\" find the correct parent' '\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$subtree_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 'add main-sub5' '\n-\tmkdir subdir2 &&\n-\tcreate subdir2/main-sub5 &&\n-\tgit commit -m \"main-sub5\"\n-'\n+next_test\n+test_expect_success 'split a new subtree without --onto option' '\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree add --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir2/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n \n-test_expect_success 'split for main-sub5 without --onto' '\n-\t# also test that we still can split out an entirely new subtree\n-\t# if the parent of the first commit in the tree is not empty,\n-\t# then the new subtree has accidently been attached to something\n-\tgit subtree split --prefix=subdir2 --branch mainsub5 &&\n-\ttest_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 subproj2-br &&\n+\t\ttest_equal \"$(git log --pretty=format:%P -1 subproj2-br)\" \"\"\n+\t)\n '\n \n+next_test\n test_expect_success 'verify one file change per commit' '\n-\tx= &&\n-\tgit log --pretty=format:\"commit: %H\" | join_commits |\n-\t(\n-\t\twhile read commit a b; do\n-\t\t\ttest_debug \"echo Verifying commit $commit\"\n-\t\t\ttest_debug \"echo a: $a\"\n-\t\t\ttest_debug \"echo b: $b\"\n-\t\t\ttest_equal \"$b\" \"\"\n-\t\t\tx=1\n-\t\tdone\n-\t\ttest_equal \"$x\" 1\n+\ttest_create_repo \"$subtree_test_count\" &&\n+\ttest_create_repo \"$subtree_test_count/subproj\" &&\n+\ttest_create_commit \"$subtree_test_count\" main1 &&\n+\ttest_create_commit \"$subtree_test_count/subproj\" sub1 &&\n+\t(\n+\t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub2 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit fetch ./subproj master &&\n+\t\tgit subtree merge --prefix=subdir FETCH_HEAD\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir/main-sub1 &&\n+\t(\n+\t\tcd \"$subtree_test_count\" &&\n+\t\tgit subtree split --prefix=subdir --branch subproj-br\n+\t) &&\n+\ttest_create_commit \"$subtree_test_count\" subdir2/main-sub2 &&\n+\t(\n+\t\tcd \"$subtree_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+\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\ttest_equal \"$x\" 1\n+\t\t)\n \t)\n '\n \n-- \n1.7.10.4\n"},{"id":"209730","messageId":"1361221013-12756-7-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 6/8] contrib/subtree: Handle '--prefix' argument with a slash appended","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:51Z","receivedAt":"2013-02-18T20:56:51Z","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 |   20 ++++++++++++++++++++\n 2 files changed, 21 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 6c3929b..1b3df99 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 eee032d..5c6c73d 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -255,6 +255,26 @@ test_expect_success 'merge new subproj history into subdir/ with --squash and --\n \t)\n '\n \n+next_test\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":"209732","messageId":"1361221013-12756-8-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 7/8] contrib/subtree: Remove --annotate","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:52Z","receivedAt":"2013-02-18T20:56:52Z","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 1b3df99..2aceadc 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 5c6c73d..fa2a6c3 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -338,8 +338,8 @@ test_expect_success 'split subdir/ with --rejoin' '\n \t\tcd \"$subtree_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@@ -363,7 +363,7 @@ test_expect_success 'split subdir/ with --rejoin and --message' '\n \t\tcd \"$subtree_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@@ -387,8 +387,8 @@ test_expect_success 'split subdir/ with --branch' '\n \t\tcd \"$subtree_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@@ -413,8 +413,8 @@ test_expect_success 'split subdir/ with --branch for an existing branch' '\n \t\tcd \"$subtree_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@@ -466,7 +466,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -477,12 +477,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n@@ -517,7 +517,7 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -528,12 +528,12 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n@@ -568,7 +568,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -579,12 +579,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n@@ -623,7 +623,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -634,12 +634,12 @@ test_expect_success 'make sure each filename changed exactly once in the entire\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n@@ -682,7 +682,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -693,12 +693,12 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n@@ -731,7 +731,7 @@ test_expect_success 'make sure no \"git subtree\" tagged commits make it into subp\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" sub3 &&\n \ttest_create_commit \"$subtree_test_count\" subdir/main-sub3 &&\n@@ -742,12 +742,12 @@ test_expect_success 'make sure no \"git subtree\" tagged commits make it into subp\n \ttest_create_commit \"$subtree_test_count/subproj\" sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count\" subdir/main-sub4 &&\n \t(\n \t\tcd \"$subtree_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 \"$subtree_test_count/subproj\" &&\n-- \n1.7.10.4\n"},{"id":"209733","messageId":"1361221013-12756-9-git-send-email-greened@obbligato.org","threadId":"32930","inReplyTo":"1361221013-12756-1-git-send-email-greened@obbligato.org","subject":"[PATCH 8/8] Remove test artifaces from clean rule","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2013-02-18T20:56:53Z","receivedAt":"2013-02-18T20:56:53Z","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\nThere should be no need to remove 'mainline' nd 'subproj'\nin the Makefile as these should always be created under the\ntest directory.\n\nSigned-off-by: David A. Greene <greened@obbligato.org>\n---\n contrib/subtree/Makefile |    1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile\nindex b507505..09f4c9d 100644\n--- a/contrib/subtree/Makefile\n+++ b/contrib/subtree/Makefile\n@@ -50,4 +50,3 @@ test:\n \n clean:\n \trm -f *~ *.xml *.html *.1\n-\trm -rf subproj mainline\n-- \n1.7.10.4\n"},{"id":"209746","messageId":"7va9r19raq.fsf@alter.siamese.dyndns.org","threadId":"32930","inReplyTo":"1361221013-12756-2-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 1/8] contrib/subtree: Use %B for split subject/body","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-18T22:43:25Z","receivedAt":"2013-02-18T22:43:25Z","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> Signed-off-by: David A. Greene <greened@obbligato.org>\n> ---\n>  contrib/subtree/t/t7900-subtree.sh |   11 +++++++++++\n>  1 file changed, 11 insertions(+)\n\nHuh?\n\nThis seems to be a repeat of the test added in a5b8e28e4eb5\n(contrib/subtree: use %B for split subject/body, 2013-02-04) and\nnothing else, excluding the actual change to git-subtree itself.\n\nConfused....\n\n>\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 80d3399..8dd6a82 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -226,6 +226,17 @@ test_expect_success 'check hash of split' '\n>  \tcheck_equal ''\"$new_hash\"'' \"$subdir_hash\"\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"},{"id":"209747","messageId":"7v38wt9qy1.fsf@alter.siamese.dyndns.org","threadId":"32930","inReplyTo":"1361221013-12756-4-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 3/8] contrib/subtree: Ignore testing directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-18T22:51:02Z","receivedAt":"2013-02-18T22:51:02Z","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/.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\nThe title explains t/trash* but not mainline/subproj lines.  Why can\nthey go now?\n\nAlso git-subtree.xml seems to be moved without justification\n(perhaps making the list alphabetical)?\n"},{"id":"209748","messageId":"7vy5el8c6b.fsf@alter.siamese.dyndns.org","threadId":"32930","inReplyTo":"1361221013-12756-5-git-send-email-greened@obbligato.org","subject":"Re: [PATCH 4/8] contrib/subtree: Code cleaning and refactoring","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-18T22:55:24Z","receivedAt":"2013-02-18T22:55:24Z","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\nApplying: contrib/subtree: Code cleaning and refactoring\n/srv/project/git/git.git/.git/rebase-apply/patch:219: space before tab in indent.\n \tgit branch spl1 \"$spl1\" &&\n/srv/project/git/git.git/.git/rebase-apply/patch:222: space before tab in indent.\n \tundo\n/srv/project/git/git.git/.git/rebase-apply/patch:239: space before tab in indent.\n \tundo &&\n/srv/project/git/git.git/.git/rebase-apply/patch:269: space before tab in indent.\n \tgit subtree split --unannotate=\"subproj:\" --prefix subdir --onto FETCH_HEAD --branch splitunann &&\n\n>  contrib/subtree/t/t7900-subtree.sh |  256 +++++++++++++++++++-----------------\n>  1 file changed, 136 insertions(+), 120 deletions(-)\n>\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index c7f9e1a..3787408 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\nWhy this change?  The new list does not match the order of things\nthat are tested (\"add\" is not the first thing that gets tested), it\nis not alphabetical either (\"pull\" sorts earlier than \"merge\"), nor\nit is the natural progression of operation users would expect (it\nwould be more like \"add\" to start working with subtree, then \"merge\"\nlocally and finally \"pull\" to interact with others, no?)\n"}]}