{"thread":{"id":"17387","subject":"Heads up: rebase -i -p will be made sane again","startedAt":"2009-01-27T09:29:53Z","lastAt":"2009-01-28T05:21:36Z","messageCount":30,"participants":["Johannes Schindelin","Stephen Haberman","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102097","messageId":"alpine.DEB.1.00.0901271012550.14855@racer","threadId":"17387","inReplyTo":null,"subject":"Heads up: rebase -i -p will be made sane again","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T09:29:53Z","receivedAt":"2009-01-27T09:29:53Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Dear list,\n\nI am progressing to a point where I am almost comfortable to send the \npatch series; I want to use the thing myself first, and I want to fix a \ndesign bug.\n\nAs always, my code is public, but will be rebased frequently.  You have \nbeen warned.\n\nBTW I am really sorry for the state I left the --preserve-merges code for \na long time.  Originally, it was never meant to be used interactively, and \nthat shows sorely.\n\nAs for the design bug I want to fix: imagine this history:\n\n  ------A\n /     /\n/     /\n---- B\n\\     \\\n \\     \\\n  C-----D-----E = HEAD\n\nA, C and D touch the same file, and A and D agree on the contents.\n\nNow, rebase -p A does the following at the moment:\n\n  ------A-----E' = HEAD\n /     /\n/     /\n---- B\n\nIn other words, C is truly forgotten, and it is pretended that D never \nhappened, either.  That is exactly what test case 2 in t3410 tests for \n[*1*].\n\nThis is insane.\n\nSo after my rebase -i -p revamp, this will happen instead: in the \ninteractive version you will get the script\n\n\tpick C\n\tmerge parents B' original D\n\tpick E\n\nIn the non-interactive version -- or if you change nothing, in the \ninteractive version, too -- this will lead to a conflict while picking C.\n\nAs it should.\n\nCiao,\nDscho\n\n[*1*] The code in t3410 was not really easy to read, even if there was an \nexplanation what it tried to do, but the test code was inconsitent, \nsometimes tagging, sometimes not, sometimes committing with -a, sometimes \n\"git add\"ing first, yet almost repetitive.\n\nIn my endeavor not only to understand it, and either fix my code or the \ncode in t3410, I refactored it so that others should have a much easier \ntime to understand what it actually does.\n"},{"id":"102123","messageId":"20090127085418.e113ad5a.stephen@exigencecorp.com","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271012550.14855@racer","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Stephen Haberman","fromEmail":"stephen@exigencecorp.com","sentAt":"2009-01-27T14:54:18Z","receivedAt":"2009-01-27T14:54:18Z","isPatch":false,"sender":{"key":"stephen@exigencecorp.com","avatar":"https://gravatar.com/avatar/23b93ad70a06ce53505f17ddba65176edbcfb6588e7a4c1a2dca04aaf0a6aff1?d=mp&s=160"},"body":"\n> Dear list,\n\nThanks for keeping me on the cc list--several of the later stages of\ncruft are my fault, so I don't know that I'll be able to help any more\nthan commentary on the use cases I was trying to fulfill.\n\n> As for the design bug I want to fix: imagine this history:\n> \n>   ------A\n>  /     /\n> /     /\n> ---- B\n> \\     \\\n>  \\     \\\n>   C-----D-----E = HEAD\n> \n> A, C and D touch the same file, and A and D agree on the contents.\n> \n> Now, rebase -p A does the following at the moment:\n> \n>   ------A-----E' = HEAD\n>  /     /\n> /     /\n> ---- B\n> \n> In other words, C is truly forgotten, and it is pretended that D never \n> happened, either.  That is exactly what test case 2 in t3410 tests for \n> [*1*].\n> \n> This is insane.\n\nAgreed.\n\nDoes this mean you're just getting rid of the code that calls \"rev list\n--cherry-pick\"?\n\nIf so, I'd be all for that--I did not introduce it, nor fully understand\nits nuances, and t3410 was just a hack to get the behavior of a rebase\nwith a dropped/cherry picked commit from the previous behavior of being\na no-op to instead do \"something\".\n\nA few times I've pondered just removing the --cherry-pick/drop commit\npart of rebase-p, but assumed it was there for a reason.\n\nAlso, yeah, don't treat the test cases in t3410 as \"the result should be\nthis exact DAG\" but \"the result should be something that is not a\nnoop/sane\".\n\n> [*1*] The code in t3410 was not really easy to read, even if there was an \n> explanation what it tried to do, but the test code was inconsitent, \n> sometimes tagging, sometimes not, sometimes committing with -a, sometimes \n> \"git add\"ing first, yet almost repetitive.\n> \n> In my endeavor not only to understand it, and either fix my code or the \n> code in t3410, I refactored it so that others should have a much easier \n> time to understand what it actually does.\n\nThanks for cleaning it up.\n\nI recently saw a test of yours use a `test_commit` bash function that I\nreally like. My last patch submission debacle had a patch cleaning up\nt3411 by introducing `test_commit`--I can brave `git send-email` again\nif you have any interest in me resending it.\n\nThanks,\nStephen\n"},{"id":"102138","messageId":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"20090127085418.e113ad5a.stephen@exigencecorp.com","subject":"[PATCH 0/6] Simplifications of some 'rebase' tests","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:45:11Z","receivedAt":"2009-01-27T17:45:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhile working on the rebase revamp, I had to fix a few tests (the design\nbug I described earlier, and fallout from the new \"goto\" and \"merge\"\nfunctions).\n\nThese are just the cleanups, they should not change any functionality,\nbut make everything more readable by providing simple test_commit() and\ntest_merge() wrappers.\n\nNote: the test_commit() and test_merge() wrappers might be generic enough\nto put them into test-lib.sh for a wider audience.\n\nJohannes Schindelin (6):\n  t3404 & t3411: undo copy&paste\n  lib-rebase.sh: Document what set_fake_editor() does\n  lib-rebase.sh: introduce test_commit() and test_merge() helpers\n  Simplify t3410\n  Simplify t3411\n  Simplify t3412\n\n t/lib-rebase.sh                           |   74 +++++++++++++++++\n t/t3404-rebase-interactive.sh             |   37 +--------\n t/t3410-rebase-preserve-dropped-merges.sh |  126 +++++++++--------------------\n t/t3411-rebase-preserve-around-merges.sh  |  103 +++++-------------------\n t/t3412-rebase-root.sh                    |   30 ++-----\n 5 files changed, 145 insertions(+), 225 deletions(-)\n create mode 100644 t/lib-rebase.sh\n"},{"id":"102139","messageId":"alpine.DEB.1.00.0901271845380.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 1/6] t3404 & t3411: undo copy&paste","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:45:49Z","receivedAt":"2009-01-27T17:45:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nRather than copying and pasting, which is prone to lead to fixes\nmissing in one version, move the fake-editor generator to t/t3404/.\n\nWhile at it, fix a typo that causes head-scratching: use\n${SHELL_PATH-/bin/sh} instead of $SHELL_PATH.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/lib-rebase.sh                          |   36 ++++++++++++++++++++++++++++\n t/t3404-rebase-interactive.sh            |   37 +++--------------------------\n t/t3411-rebase-preserve-around-merges.sh |   38 +++--------------------------\n 3 files changed, 44 insertions(+), 67 deletions(-)\n create mode 100644 t/lib-rebase.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nnew file mode 100644\nindex 0000000..8c8caab\n--- /dev/null\n+++ b/t/lib-rebase.sh\n@@ -0,0 +1,36 @@\n+#!/bin/sh\n+\n+set_fake_editor () {\n+\techo \"#!${SHELL_PATH-/bin_sh}\" >fake-editor.sh\n+\tcat >> fake-editor.sh <<\\EOF\n+case \"$1\" in\n+*/COMMIT_EDITMSG)\n+\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n+\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n+\texit\n+\t;;\n+esac\n+test -z \"$EXPECT_COUNT\" ||\n+\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n+\texit\n+test -z \"$FAKE_LINES\" && exit\n+grep -v '^#' < \"$1\" > \"$1\".tmp\n+rm -f \"$1\"\n+cat \"$1\".tmp\n+action=pick\n+for line in $FAKE_LINES; do\n+\tcase $line in\n+\tsquash|edit)\n+\t\taction=\"$line\";;\n+\t*)\n+\t\techo sed -n \"${line}s/^pick/$action/p\"\n+\t\tsed -n \"${line}p\" < \"$1\".tmp\n+\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n+\t\taction=pick;;\n+\tesac\n+done\n+EOF\n+\n+\ttest_set_editor \"$(pwd)/fake-editor.sh\"\n+\tchmod a+x fake-editor.sh\n+}\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 2cc8e7a..3592403 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -10,6 +10,10 @@ that the result still makes sense.\n '\n . ./test-lib.sh\n \n+. ../lib-rebase.sh\n+\n+set_fake_editor\n+\n # set up two branches like this:\n #\n # A - B - C - D - E\n@@ -61,39 +65,6 @@ test_expect_success 'setup' '\n \tgit tag I\n '\n \n-echo \"#!$SHELL_PATH\" >fake-editor.sh\n-cat >> fake-editor.sh <<\\EOF\n-case \"$1\" in\n-*/COMMIT_EDITMSG)\n-\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n-\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-\texit\n-\t;;\n-esac\n-test -z \"$EXPECT_COUNT\" ||\n-\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n-\texit\n-test -z \"$FAKE_LINES\" && exit\n-grep -v '^#' < \"$1\" > \"$1\".tmp\n-rm -f \"$1\"\n-cat \"$1\".tmp\n-action=pick\n-for line in $FAKE_LINES; do\n-\tcase $line in\n-\tsquash|edit)\n-\t\taction=\"$line\";;\n-\t*)\n-\t\techo sed -n \"${line}s/^pick/$action/p\"\n-\t\tsed -n \"${line}p\" < \"$1\".tmp\n-\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n-\t\taction=pick;;\n-\tesac\n-done\n-EOF\n-\n-test_set_editor \"$(pwd)/fake-editor.sh\"\n-chmod a+x fake-editor.sh\n-\n test_expect_success 'no changes are a nop' '\n \tgit rebase -i F &&\n \ttest \"$(git symbolic-ref -q HEAD)\" = \"refs/heads/branch2\" &&\ndiff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh\nindex aacfaae..6a1586a 100755\n--- a/t/t3411-rebase-preserve-around-merges.sh\n+++ b/t/t3411-rebase-preserve-around-merges.sh\n@@ -5,44 +5,14 @@\n \n test_description='git rebase preserve merges\n \n-This test runs git rebase with and tries to squash a commit from after a merge\n-to before the merge.\n+This test runs git rebase with -p and tries to squash a commit from after\n+a merge to before the merge.\n '\n . ./test-lib.sh\n \n-# Copy/paste from t3404-rebase-interactive.sh\n-echo \"#!$SHELL_PATH\" >fake-editor.sh\n-cat >> fake-editor.sh <<\\EOF\n-case \"$1\" in\n-*/COMMIT_EDITMSG)\n-\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n-\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-\texit\n-\t;;\n-esac\n-test -z \"$EXPECT_COUNT\" ||\n-\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n-\texit\n-test -z \"$FAKE_LINES\" && exit\n-grep -v '^#' < \"$1\" > \"$1\".tmp\n-rm -f \"$1\"\n-cat \"$1\".tmp\n-action=pick\n-for line in $FAKE_LINES; do\n-\tcase $line in\n-\tsquash|edit)\n-\t\taction=\"$line\";;\n-\t*)\n-\t\techo sed -n \"${line}s/^pick/$action/p\"\n-\t\tsed -n \"${line}p\" < \"$1\".tmp\n-\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n-\t\taction=pick;;\n-\tesac\n-done\n-EOF\n+. ../lib-rebase.sh\n \n-test_set_editor \"$(pwd)/fake-editor.sh\"\n-chmod a+x fake-editor.sh\n+set_fake_editor\n \n # set up two branches like this:\n #\n-- \n1.6.1.482.g7d54be\n"},{"id":"102141","messageId":"alpine.DEB.1.00.0901271846340.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 2/6] lib-rebase.sh: Document what set_fake_editor() does","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:46:57Z","receivedAt":"2009-01-27T17:46:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"rnyn\nMake it easy for other authors to use rebase tests' fake-editor.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tSeparated from 1/6 to make the code move more obvious.\n\n t/lib-rebase.sh |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 8c8caab..cda7778 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -1,5 +1,17 @@\n #!/bin/sh\n \n+# After setting the fake editor with this function, you can\n+#\n+# - override the commit message with $FAKE_COMMIT_MESSAGE,\n+# - amend the commit message with $FAKE_COMMIT_AMEND\n+# - check that non-commit messages have a certain line count with $EXPECT_COUNT\n+# - rewrite a rebase -i script with $FAKE_LINES in the form\n+#\n+#\t\"[<lineno1>] [<lineno2>]...\"\n+#\n+#   If a line number is prefixed with \"squash\" or \"edit\", the respective line's\n+#   command will be replaced with the specified one.\n+\n set_fake_editor () {\n \techo \"#!${SHELL_PATH-/bin_sh}\" >fake-editor.sh\n \tcat >> fake-editor.sh <<\\EOF\n-- \n1.6.1.482.g7d54be\n"},{"id":"102140","messageId":"alpine.DEB.1.00.0901271847070.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 3/6] lib-rebase.sh: introduce test_commit() and test_merge() helpers","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:47:16Z","receivedAt":"2009-01-27T17:47:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nOften we just need to add a commit with a given (short) name, that will\nbe tagged with the same name.  Now, relatively complicated graphs can be\nconstructed easily and in a clear fashion:\n\n\ttest_commit A &&\n\ttest_commit B &&\n\tgit checkout A &&\n\ttest_commit C &&\n\ttest_merge D B\n\nwill construct this graph:\n\n\tA - B\n\t  \\   \\\n\t    C - D\n\nFor simplicity, files of the same name (but in lower case, to avoid\na warning about ambiguous names) will be committed, with the commit\nmessage as contents.\n\nIf you need to provide a different file/different contents, you can use\nthe more explicit form\n\n\ttest_commit $MESSAGE $FILENAME $CONTENTS\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tThis may want to live in test-lib.sh instead.\n\n t/lib-rebase.sh |   26 ++++++++++++++++++++++++++\n 1 files changed, 26 insertions(+), 0 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex cda7778..37430f3 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -46,3 +46,29 @@ EOF\n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n \tchmod a+x fake-editor.sh\n }\n+\n+# Call test_commit with the arguments \"<message> [<file> [<contents>]]\"\n+#\n+# This will commit a file with the given contents and the given commit\n+# message.  It will also add a tag with <message> as name.\n+#\n+# Both <file> and <contents> default to <message>.\n+\n+test_commit () {\n+\tfile=$2\n+\ttest -z \"$2\" && file=$(echo \"$1\" | tr 'A-Z' 'a-z')\n+\techo ${3-$1} > $file &&\n+\tgit add $file &&\n+\ttest_tick &&\n+\tgit commit -m $1 &&\n+\tgit tag $1\n+}\n+\n+# Call test_merge with the arguments \"<message> <commit>\", where <commit>\n+# can be a tag pointing to the commit-to-merge.\n+\n+test_merge () {\n+\ttest_tick &&\n+\tgit merge -m $1 $2 &&\n+\tgit tag $1\n+}\n-- \n1.6.1.482.g7d54be\n"},{"id":"102142","messageId":"alpine.DEB.1.00.0901271847230.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 4/6] Simplify t3410","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:48:00Z","receivedAt":"2009-01-27T17:48:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nUse test_commit() and test_merge(), reducing the code while making the\nintent clearer.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tStephen, this and the next one touches your code.\n\n t/t3410-rebase-preserve-dropped-merges.sh |  126 +++++++++--------------------\n 1 files changed, 37 insertions(+), 89 deletions(-)\n\ndiff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh\nindex 5816415..0669b48 100755\n--- a/t/t3410-rebase-preserve-dropped-merges.sh\n+++ b/t/t3410-rebase-preserve-dropped-merges.sh\n@@ -11,6 +11,8 @@ rewritten.\n '\n . ./test-lib.sh\n \n+. ../lib-rebase.sh\n+\n # set up two branches like this:\n #\n # A - B - C - D - E\n@@ -22,47 +24,17 @@ rewritten.\n # where B, D and G touch the same file.\n \n test_expect_success 'setup' '\n-\t: > file1 &&\n-\tgit add file1 &&\n-\ttest_tick &&\n-\tgit commit -m A &&\n-\tgit tag A &&\n-\techo 1 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m B file1 &&\n-\t: > file2 &&\n-\tgit add file2 &&\n-\ttest_tick &&\n-\tgit commit -m C &&\n-\techo 2 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m D file1 &&\n-\t: > file3 &&\n-\tgit add file3 &&\n-\ttest_tick &&\n-\tgit commit -m E &&\n-\tgit tag E &&\n-\tgit checkout -b branch1 A &&\n-\t: > file4 &&\n-\tgit add file4 &&\n-\ttest_tick &&\n-\tgit commit -m F &&\n-\tgit tag F &&\n-\techo 3 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m G file1 &&\n-\tgit tag G &&\n-\t: > file5 &&\n-\tgit add file5 &&\n-\ttest_tick &&\n-\tgit commit -m H &&\n-\tgit tag H &&\n-\tgit checkout -b branch2 F &&\n-\t: > file6 &&\n-\tgit add file6 &&\n-\ttest_tick &&\n-\tgit commit -m I &&\n-\tgit tag I\n+\ttest_commit A file1 &&\n+\ttest_commit B file1 1 &&\n+\ttest_commit C file2 &&\n+\ttest_commit D file1 2 &&\n+\ttest_commit E file3 &&\n+\tgit checkout A &&\n+\ttest_commit F file4 &&\n+\ttest_commit G file1 3 &&\n+\ttest_commit H file5 &&\n+\tgit checkout F &&\n+\ttest_commit I file6\n '\n \n # A - B - C - D - E\n@@ -72,68 +44,44 @@ test_expect_success 'setup' '\n #         I -- G2 -- J -- K           I -- K\n # G2 = same changes as G\n test_expect_success 'skip same-resolution merges with -p' '\n-\tgit checkout branch1 &&\n+\tgit checkout H &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m L &&\n-\tgit checkout branch2 &&\n-\techo 3 > file1 &&\n-\tgit commit -a -m G2 &&\n+\ttest_commit L file1 23 &&\n+\tgit checkout I &&\n+\ttest_commit G2 file1 3 &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m J &&\n-\techo file7 > file7 &&\n-\tgit add file7 &&\n-\tgit commit -m K &&\n-\tGIT_EDITOR=: git rebase -i -p branch1 &&\n-\ttest $(git rev-parse branch2^^) = $(git rev-parse branch1) &&\n+\ttest_commit J file1 23 &&\n+\ttest_commit K file7 file7 &&\n+\tgit rebase -i -p L &&\n+\ttest $(git rev-parse HEAD^^) = $(git rev-parse L) &&\n \ttest \"23\" = \"$(cat file1)\" &&\n-\ttest \"\" = \"$(cat file6)\" &&\n-\ttest \"file7\" = \"$(cat file7)\" &&\n-\n-\tgit checkout branch1 &&\n-\tgit reset --hard H &&\n-\tgit checkout branch2 &&\n-\tgit reset --hard I\n+\ttest \"I\" = \"$(cat file6)\" &&\n+\ttest \"file7\" = \"$(cat file7)\"\n '\n \n # A - B - C - D - E\n #   \\             \\ \\\n-#     F - G - H -- L \\        -->   L\n-#       \\            |               \\\n-#         I -- G2 -- J -- K           I -- G2 -- K\n+#     F - G - H -- L2 \\        -->   L2\n+#       \\             |                \\\n+#         I -- G3 --- J2 -- K2           I -- G3 -- K2\n # G2 = different changes as G\n test_expect_success 'keep different-resolution merges with -p' '\n-\tgit checkout branch1 &&\n+\tgit checkout H &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m L &&\n-\tgit checkout branch2 &&\n-\techo 4 > file1 &&\n-\tgit commit -a -m G2 &&\n+\ttest_commit L2 file1 23 &&\n+\tgit checkout I &&\n+\ttest_commit G3 file1 4 &&\n \t! git merge E &&\n-\techo 24 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m J &&\n-\techo file7 > file7 &&\n-\tgit add file7 &&\n-\tgit commit -m K &&\n-\t! GIT_EDITOR=: git rebase -i -p branch1 &&\n+\ttest_commit J2 file1 24 &&\n+\ttest_commit K2 file7 file7 &&\n+\ttest_must_fail git rebase -i -p L2 &&\n \techo 234 > file1 &&\n \tgit add file1 &&\n-\tGIT_EDITOR=: git rebase --continue &&\n-\ttest $(git rev-parse branch2^^^) = $(git rev-parse branch1) &&\n+\tgit rebase --continue &&\n+\ttest $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&\n \ttest \"234\" = \"$(cat file1)\" &&\n-\ttest \"\" = \"$(cat file6)\" &&\n-\ttest \"file7\" = \"$(cat file7)\" &&\n-\n-\tgit checkout branch1 &&\n-\tgit reset --hard H &&\n-\tgit checkout branch2 &&\n-\tgit reset --hard I\n+\ttest \"I\" = \"$(cat file6)\" &&\n+\ttest \"file7\" = \"$(cat file7)\"\n '\n \n test_done\n-- \n1.6.1.482.g7d54be\n"},{"id":"102143","messageId":"alpine.DEB.1.00.0901271848090.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 5/6] Simplify t3411","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:48:17Z","receivedAt":"2009-01-27T17:48:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nUse test_commit() and test_merge().  This way, it is harder to forget to\ntag, or to call test_tick before committing.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t3411-rebase-preserve-around-merges.sh |   65 ++++++++----------------------\n 1 files changed, 17 insertions(+), 48 deletions(-)\n\ndiff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh\nindex 6a1586a..6533505 100755\n--- a/t/t3411-rebase-preserve-around-merges.sh\n+++ b/t/t3411-rebase-preserve-around-merges.sh\n@@ -21,27 +21,13 @@ set_fake_editor\n #        -- C1 --\n \n test_expect_success 'setup' '\n-\ttouch a &&\n-\ttouch b &&\n-\tgit add a &&\n-\tgit commit -m A1 &&\n-\tgit tag A1\n-\tgit add b &&\n-\tgit commit -m B1 &&\n-\tgit tag B1 &&\n-\tgit checkout -b branch &&\n-\ttouch c &&\n-\tgit add c &&\n-\tgit commit -m C1 &&\n-\tgit checkout master &&\n-\ttouch d &&\n-\tgit add d &&\n-\tgit commit -m D1 &&\n-\tgit merge branch &&\n-\ttouch f &&\n-\tgit add f &&\n-\tgit commit -m F1 &&\n-\tgit tag F1\n+\ttest_commit A1 &&\n+\ttest_commit B1 &&\n+\ttest_commit C1 &&\n+\tgit reset --hard B1 &&\n+\ttest_commit D1 &&\n+\ttest_merge E1 C1 &&\n+\ttest_commit F1\n '\n \n # Should result in:\n@@ -52,7 +38,7 @@ test_expect_success 'setup' '\n #\n test_expect_success 'squash F1 into D1' '\n \tFAKE_LINES=\"1 squash 3 2\" git rebase -i -p B1 &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse branch)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse C1)\" &&\n \ttest \"$(git rev-parse HEAD~2)\" = \"$(git rev-parse B1)\" &&\n \tgit tag E2\n '\n@@ -70,32 +56,15 @@ test_expect_success 'squash F1 into D1' '\n # And rebase G1..M1 onto E2\n \n test_expect_success 'rebase two levels of merge' '\n-\tgit checkout -b branch2 A1 &&\n-\ttouch g &&\n-\tgit add g &&\n-\tgit commit -m G1 &&\n-\tgit checkout -b branch3 &&\n-\ttouch h\n-\tgit add h &&\n-\tgit commit -m H1 &&\n-\tgit checkout -b branch4 &&\n-\ttouch i &&\n-\tgit add i &&\n-\tgit commit -m I1 &&\n-\tgit tag I1 &&\n-\tgit checkout branch3 &&\n-\ttouch j &&\n-\tgit add j &&\n-\tgit commit -m J1 &&\n-\tgit merge I1 --no-commit &&\n-\tgit commit -m K1 &&\n-\tgit tag K1 &&\n-\tgit checkout branch2 &&\n-\ttouch l &&\n-\tgit add l &&\n-\tgit commit -m L1 &&\n-\tgit merge K1 --no-commit &&\n-\tgit commit -m M1 &&\n+\ttest_commit G1 &&\n+\ttest_commit H1 &&\n+\ttest_commit I1 &&\n+\tgit checkout -b branch3 H1 &&\n+\ttest_commit J1 &&\n+\ttest_merge K1 I1 &&\n+\tgit checkout -b branch2 G1 &&\n+\ttest_commit L1 &&\n+\ttest_merge M1 K1 &&\n \tGIT_EDITOR=: git rebase -i -p E2 &&\n \ttest \"$(git rev-parse HEAD~3)\" = \"$(git rev-parse E2)\" &&\n \ttest \"$(git rev-parse HEAD~2)\" = \"$(git rev-parse HEAD^2^2~2)\" &&\n-- \n1.6.1.482.g7d54be\n"},{"id":"102144","messageId":"alpine.DEB.1.00.0901271848440.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271844340.3586@pacific.mpi-cbg.de","subject":"[PATCH 6/6] Simplify t3412","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:49:00Z","receivedAt":"2009-01-27T17:49:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nUse the newly introduced test_commit() and test_merge() helpers.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tThomas, this touches your code.\n\n t/t3412-rebase-root.sh |   30 +++++++++---------------------\n 1 files changed, 9 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh\nindex 6359580..39f7768 100755\n--- a/t/t3412-rebase-root.sh\n+++ b/t/t3412-rebase-root.sh\n@@ -6,24 +6,16 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.\n '\n . ./test-lib.sh\n \n+. ../lib-rebase.sh\n+\n test_expect_success 'prepare repository' '\n-\techo 1 > A &&\n-\tgit add A &&\n-\tgit commit -m 1 &&\n-\techo 2 > A &&\n-\tgit add A &&\n-\tgit commit -m 2 &&\n+\ttest_commit 1 A &&\n+\ttest_commit 2 A &&\n \tgit symbolic-ref HEAD refs/heads/other &&\n \trm .git/index &&\n-\techo 3 > B &&\n-\tgit add B &&\n-\tgit commit -m 3 &&\n-\techo 1 > A &&\n-\tgit add A &&\n-\tgit commit -m 1b &&\n-\techo 4 > B &&\n-\tgit add B &&\n-\tgit commit -m 4\n+\ttest_commit 3 B &&\n+\ttest_commit 1b A 1 &&\n+\ttest_commit 4 B\n '\n \n test_expect_success 'rebase --root expects --onto' '\n@@ -103,9 +95,7 @@ test_expect_success 'pre-rebase got correct input (5)' '\n test_expect_success 'set up merge history' '\n \tgit checkout other^ &&\n \tgit checkout -b side &&\n-\techo 5 > C &&\n-\tgit add C &&\n-\tgit commit -m 5 &&\n+\ttest_commit 5 C &&\n \tgit checkout other &&\n \tgit merge side\n '\n@@ -132,9 +122,7 @@ test_expect_success 'set up second root and merge' '\n \tgit symbolic-ref HEAD refs/heads/third &&\n \trm .git/index &&\n \trm A B C &&\n-\techo 6 > D &&\n-\tgit add D &&\n-\tgit commit -m 6 &&\n+\ttest_commit 6 D &&\n \tgit checkout other &&\n \tgit merge third\n '\n-- \n1.6.1.482.g7d54be\n"},{"id":"102146","messageId":"alpine.DEB.1.00.0901271855240.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"20090127085418.e113ad5a.stephen@exigencecorp.com","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T17:59:57Z","receivedAt":"2009-01-27T17:59:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Stephen Haberman wrote:\n\n> > As for the design bug I want to fix: imagine this history:\n> > \n> >   ------A\n> >  /     /\n> > /     /\n> > ---- B\n> > \\     \\\n> >  \\     \\\n> >   C-----D-----E = HEAD\n> > \n> > A, C and D touch the same file, and A and D agree on the contents.\n> > \n> > Now, rebase -p A does the following at the moment:\n> > \n> >   ------A-----E' = HEAD\n> >  /     /\n> > /     /\n> > ---- B\n> > \n> > In other words, C is truly forgotten, and it is pretended that D never \n> > happened, either.  That is exactly what test case 2 in t3410 tests for \n> > [*1*].\n> > \n> > This is insane.\n> \n> Agreed.\n\nGood!  I already feared that you would be disagreeing with me.\n\n> Does this mean you're just getting rid of the code that calls \"rev list \n> --cherry-pick\"?\n\nNot exactly.  The idea of rebasing is to stay on top of an upstream.  If \nthat upstream has your changes already, you do not want to reapply them -- \neven with --preserve-merges.\n\nNow, a merge cannot be sent as a patch mail, for good reasons.  So \nwhatever merge might look like yours, it is not.  So it is your \nresponsibility to say that yours is obsolete, and delete it from the \nrebase script.\n\nIf your merge is in upstream (because a pull-request was heeded, for \nexample), then you will not see the commits anyway.\n\n> A few times I've pondered just removing the --cherry-pick/drop commit \n> part of rebase-p, but assumed it was there for a reason.\n\nI will find the \"dropped\" commits using git log -p | git patch-id.\n\nIt is still nice to tell the user if she wants to merge a parent that is \nalready in upstream, so I would not like to miss out on that information.\n\n> > [*1*] The code in t3410 was not really easy to read, even if there was \n> > an explanation what it tried to do, but the test code was inconsitent, \n> > sometimes tagging, sometimes not, sometimes committing with -a, \n> > sometimes \"git add\"ing first, yet almost repetitive.\n> > \n> > In my endeavor not only to understand it, and either fix my code or \n> > the code in t3410, I refactored it so that others should have a much \n> > easier time to understand what it actually does.\n> \n> Thanks for cleaning it up.\n> \n> I recently saw a test of yours use a `test_commit` bash function that I \n> really like. My last patch submission debacle had a patch cleaning up \n> t3411 by introducing `test_commit`--I can brave `git send-email` again \n> if you have any interest in me resending it.\n\nHeh... so I sent that part of the patches.  Hopefully they will get in \nsoon, as they should be rather obvious, and I have a lot more to come...\n\nCiao,\nDscho\n"},{"id":"102161","messageId":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271845380.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH 1/6] t3404 & t3411: undo copy&paste","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T21:01:28Z","receivedAt":"2009-01-27T21:01:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Rather than copying and pasting, which is prone to lead to fixes\n> missing in one version, move the fake-editor generator to t/t3404/.\n>\n> While at it, fix a typo that causes head-scratching: use\n> ${SHELL_PATH-/bin/sh} instead of $SHELL_PATH.\n\nI've learned to be cautious whenever I see \"while at it\".\n\n> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\n> new file mode 100644\n> index 0000000..8c8caab\n> --- /dev/null\n> +++ b/t/lib-rebase.sh\n> @@ -0,0 +1,36 @@\n> +#!/bin/sh\n> +\n> +set_fake_editor () {\n> +\techo \"#!${SHELL_PATH-/bin_sh}\" >fake-editor.sh\n\nIt is unclear why you would want to do this.  It was unclear what \"typo\"\nyou were referring to in your commit log message, either.\n\nThe tests are supposed to run under the shell the user specified, so if\nthere is a case you found that $SHELL_PATH is unset, that is a bug we\nwould want to fix, and ${SHELL_PATH-/bin/sh} is sweeping the problem under\nthe rug to make it harder to fix, isn't it?\n\nI would understand if it were\n\n\t${SHELL_PATH?\"SHELL_PATH Not Set --- bug in tests?\"}\n\nthough.\n\nBesides, it's /bin/sh, not /bin_sh ;-)\n\n> +\tcat >> fake-editor.sh <<\\EOF\n> +case \"$1\" in\n> +*/COMMIT_EDITMSG)\n> +\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n> +\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n> +\texit\n> +\t;;\n> +esac\n> +test -z \"$EXPECT_COUNT\" ||\n> +\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n> +\texit\n> +test -z \"$FAKE_LINES\" && exit\n> +grep -v '^#' < \"$1\" > \"$1\".tmp\n> +rm -f \"$1\"\n> +cat \"$1\".tmp\n> +action=pick\n> +for line in $FAKE_LINES; do\n> +\tcase $line in\n> +\tsquash|edit)\n> +\t\taction=\"$line\";;\n> +\t*)\n> +\t\techo sed -n \"${line}s/^pick/$action/p\"\n> +\t\tsed -n \"${line}p\" < \"$1\".tmp\n> +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n\nI looked at the output from this and wondered what these \"sed -n\" shown in\nthe \"-v\" output were about last night.  I do think it is a good idea to\nshow what edit was done to the insn stream, but I suspect it may be easier\nto read the output if you did this instead:\n\n> +\t\tsed -n \"${line}p\" < \"$1\".tmp\n> +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n> +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp\n"},{"id":"102162","messageId":"7v3af431iz.fsf@gitster.siamese.dyndns.org","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271846340.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH 2/6] lib-rebase.sh: Document what set_fake_editor() does","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T21:03:00Z","receivedAt":"2009-01-27T21:03:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> rnyn\n> Make it easy for other authors to use rebase tests' fake-editor.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n\nPerhaps a very welcome addition, except that I did not find rnyn in my\ndictionary, and the patch textually depends on /bin_sh bug ;-)\n"},{"id":"102163","messageId":"7vvds01mnr.fsf@gitster.siamese.dyndns.org","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901271847070.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH 3/6] lib-rebase.sh: introduce test_commit() and test_merge() helpers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T21:09:28Z","receivedAt":"2009-01-27T21:09:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> \tThis may want to live in test-lib.sh instead.\n\nYeah, I tend to agree.\n\n> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\n> index cda7778..37430f3 100644\n> --- a/t/lib-rebase.sh\n> +++ b/t/lib-rebase.sh\n> @@ -46,3 +46,29 @@ EOF\n>  \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n>  \tchmod a+x fake-editor.sh\n>  }\n> +\n> +# Call test_commit with the arguments \"<message> [<file> [<contents>]]\"\n> +#\n> +# This will commit a file with the given contents and the given commit\n> +# message.  It will also add a tag with <message> as name.\n> +#\n> +# Both <file> and <contents> default to <message>.\n> +\n> +test_commit () {\n> +\tfile=$2\n> +\ttest -z \"$2\" && file=$(echo \"$1\" | tr 'A-Z' 'a-z')\n\n\tfile=${2:-$(echo \"$1\" | tr 'A-Z' 'a-z')}\n\nmight be more consistent with this:\n\n> +\techo ${3-$1} > $file &&\n\nand may be easier to read.\n\nI'd suggest dquoting argument to echo above, i.e. \"${3-$1}\", and all the\nreferences to positional arguments in the remainder of the patch, though.\n\n> +\tgit add $file &&\n\nas well as \"$file\" here.\n\n> +\ttest_tick &&\n> +\tgit commit -m $1 &&\n> +\tgit tag $1\n> +}\n> +\n> +# Call test_merge with the arguments \"<message> <commit>\", where <commit>\n> +# can be a tag pointing to the commit-to-merge.\n> +\n> +test_merge () {\n> +\ttest_tick &&\n> +\tgit merge -m $1 $2 &&\n> +\tgit tag $1\n> +}\n> -- \n> 1.6.1.482.g7d54be\n"},{"id":"102165","messageId":"alpine.DEB.1.00.0901272254450.14855@racer","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/6] t3404 & t3411: undo copy&paste","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T21:57:33Z","receivedAt":"2009-01-27T21:57:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Rather than copying and pasting, which is prone to lead to fixes\n> > missing in one version, move the fake-editor generator to t/t3404/.\n> >\n> > While at it, fix a typo that causes head-scratching: use\n> > ${SHELL_PATH-/bin/sh} instead of $SHELL_PATH.\n> \n> I've learned to be cautious whenever I see \"while at it\".\n\nHeh.\n\n> > diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\n> > new file mode 100644\n> > index 0000000..8c8caab\n> > --- /dev/null\n> > +++ b/t/lib-rebase.sh\n> > @@ -0,0 +1,36 @@\n> > +#!/bin/sh\n> > +\n> > +set_fake_editor () {\n> > +\techo \"#!${SHELL_PATH-/bin_sh}\" >fake-editor.sh\n> \n> It is unclear why you would want to do this.  It was unclear what \"typo\"\n> you were referring to in your commit log message, either.\n> \n> The tests are supposed to run under the shell the user specified, so if\n> there is a case you found that $SHELL_PATH is unset, that is a bug we\n> would want to fix, and ${SHELL_PATH-/bin/sh} is sweeping the problem under\n> the rug to make it harder to fix, isn't it?\n\nI call the scripts directly, and I do not think it would be a good idea to \nforce the user to use GIT_TEST_OPTS and make when calling the script \ndirectly is so much easier.  Plus, this way I can pass \"sh -x $SCRIPT\" \neasily.\n\nI am really puzzled that it works, BTW.  With an empty SHELL_PATH, \napparently.\n\n> Besides, it's /bin/sh, not /bin_sh ;-)\n\nRight.  The commit message was right, at least!\n\n> > +\tcat >> fake-editor.sh <<\\EOF\n> > +case \"$1\" in\n> > +*/COMMIT_EDITMSG)\n> > +\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n> > +\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n> > +\texit\n> > +\t;;\n> > +esac\n> > +test -z \"$EXPECT_COUNT\" ||\n> > +\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n> > +\texit\n> > +test -z \"$FAKE_LINES\" && exit\n> > +grep -v '^#' < \"$1\" > \"$1\".tmp\n> > +rm -f \"$1\"\n> > +cat \"$1\".tmp\n> > +action=pick\n> > +for line in $FAKE_LINES; do\n> > +\tcase $line in\n> > +\tsquash|edit)\n> > +\t\taction=\"$line\";;\n> > +\t*)\n> > +\t\techo sed -n \"${line}s/^pick/$action/p\"\n> > +\t\tsed -n \"${line}p\" < \"$1\".tmp\n> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n> \n> I looked at the output from this and wondered what these \"sed -n\" shown \n> in the \"-v\" output were about last night.  I do think it is a good idea \n> to show what edit was done to the insn stream, but I suspect it may be \n> easier to read the output if you did this instead:\n> \n> > +\t\tsed -n \"${line}p\" < \"$1\".tmp\n> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp\n\n\nProbably.  It is for debugging, anyway.  As everything you only see with \n-v.\n\nCiao,\nDscho\n"},{"id":"102166","messageId":"alpine.DEB.1.00.0901272258000.14855@racer","threadId":"17387","inReplyTo":"7v3af431iz.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 2/6] lib-rebase.sh: Document what set_fake_editor() does","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T21:58:59Z","receivedAt":"2009-01-27T21:58:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > rnyn\n> > Make it easy for other authors to use rebase tests' fake-editor.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> \n> Perhaps a very welcome addition, except that I did not find rnyn in my\n> dictionary, and the patch textually depends on /bin_sh bug ;-)\n\nOh, that? It is perfectly *snarf* normal.  Just my *pucker* Tourette \nsyndrome kicking in.\n\nCiao,\nDscho\n"},{"id":"102172","messageId":"alpine.DEB.1.00.0901272323530.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 0/6] rebase simplifications","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:34:15Z","receivedAt":"2009-01-27T22:34:15Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Changes vs  v1:\n\nremoved the \"rnyn\" blurt (which probably marsk me as Alpine user...)\n\nremoved the SHELL_PATH handling; it is a miracle to me why it works, but \nI'd rather not meddle with the magic now that you pointed it out\n\nMoved test_commit and test_merge into test-lib.sh\n\nFixed the quoting in test_commit and test_merge\n\nAFAIR that's all...\n\nJohannes Schindelin (6):\n  t3404 & t3411: undo copy&paste\n  lib-rebase.sh: Document what set_fake_editor() does\n  test-lib.sh: introduce test_commit() and test_merge() helpers\n  Simplify t3410\n  Simplify t3411\n  Simplify t3412\n\n t/README                                  |   18 ++++\n t/lib-rebase.sh                           |   48 +++++++++++\n t/t3404-rebase-interactive.sh             |   37 +--------\n t/t3410-rebase-preserve-dropped-merges.sh |  124 ++++++++---------------------\n t/t3411-rebase-preserve-around-merges.sh  |  103 +++++-------------------\n t/t3412-rebase-root.sh                    |   28 ++-----\n t/test-lib.sh                             |   26 ++++++\n 7 files changed, 159 insertions(+), 225 deletions(-)\n create mode 100644 t/lib-rebase.sh\n"},{"id":"102173","messageId":"alpine.DEB.1.00.0901272334210.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 1/6] t3404 & t3411: undo copy&paste","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:34:29Z","receivedAt":"2009-01-27T22:34:29Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Rather than copying and pasting, which is prone to lead to fixes\nmissing in one version, move the fake-editor generator to t/t3404/.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/lib-rebase.sh                          |   36 ++++++++++++++++++++++++++++\n t/t3404-rebase-interactive.sh            |   37 +++--------------------------\n t/t3411-rebase-preserve-around-merges.sh |   38 +++--------------------------\n 3 files changed, 44 insertions(+), 67 deletions(-)\n create mode 100644 t/lib-rebase.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nnew file mode 100644\nindex 0000000..762ffcf\n--- /dev/null\n+++ b/t/lib-rebase.sh\n@@ -0,0 +1,36 @@\n+#!/bin/sh\n+\n+set_fake_editor () {\n+\techo \"#!$SHELL_PATH\" >fake-editor.sh\n+\tcat >> fake-editor.sh <<\\EOF\n+case \"$1\" in\n+*/COMMIT_EDITMSG)\n+\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n+\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n+\texit\n+\t;;\n+esac\n+test -z \"$EXPECT_COUNT\" ||\n+\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n+\texit\n+test -z \"$FAKE_LINES\" && exit\n+grep -v '^#' < \"$1\" > \"$1\".tmp\n+rm -f \"$1\"\n+cat \"$1\".tmp\n+action=pick\n+for line in $FAKE_LINES; do\n+\tcase $line in\n+\tsquash|edit)\n+\t\taction=\"$line\";;\n+\t*)\n+\t\techo sed -n \"${line}s/^pick/$action/p\"\n+\t\tsed -n \"${line}p\" < \"$1\".tmp\n+\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n+\t\taction=pick;;\n+\tesac\n+done\n+EOF\n+\n+\ttest_set_editor \"$(pwd)/fake-editor.sh\"\n+\tchmod a+x fake-editor.sh\n+}\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 2cc8e7a..3592403 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -10,6 +10,10 @@ that the result still makes sense.\n '\n . ./test-lib.sh\n \n+. ../lib-rebase.sh\n+\n+set_fake_editor\n+\n # set up two branches like this:\n #\n # A - B - C - D - E\n@@ -61,39 +65,6 @@ test_expect_success 'setup' '\n \tgit tag I\n '\n \n-echo \"#!$SHELL_PATH\" >fake-editor.sh\n-cat >> fake-editor.sh <<\\EOF\n-case \"$1\" in\n-*/COMMIT_EDITMSG)\n-\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n-\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-\texit\n-\t;;\n-esac\n-test -z \"$EXPECT_COUNT\" ||\n-\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n-\texit\n-test -z \"$FAKE_LINES\" && exit\n-grep -v '^#' < \"$1\" > \"$1\".tmp\n-rm -f \"$1\"\n-cat \"$1\".tmp\n-action=pick\n-for line in $FAKE_LINES; do\n-\tcase $line in\n-\tsquash|edit)\n-\t\taction=\"$line\";;\n-\t*)\n-\t\techo sed -n \"${line}s/^pick/$action/p\"\n-\t\tsed -n \"${line}p\" < \"$1\".tmp\n-\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n-\t\taction=pick;;\n-\tesac\n-done\n-EOF\n-\n-test_set_editor \"$(pwd)/fake-editor.sh\"\n-chmod a+x fake-editor.sh\n-\n test_expect_success 'no changes are a nop' '\n \tgit rebase -i F &&\n \ttest \"$(git symbolic-ref -q HEAD)\" = \"refs/heads/branch2\" &&\ndiff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh\nindex aacfaae..6a1586a 100755\n--- a/t/t3411-rebase-preserve-around-merges.sh\n+++ b/t/t3411-rebase-preserve-around-merges.sh\n@@ -5,44 +5,14 @@\n \n test_description='git rebase preserve merges\n \n-This test runs git rebase with and tries to squash a commit from after a merge\n-to before the merge.\n+This test runs git rebase with -p and tries to squash a commit from after\n+a merge to before the merge.\n '\n . ./test-lib.sh\n \n-# Copy/paste from t3404-rebase-interactive.sh\n-echo \"#!$SHELL_PATH\" >fake-editor.sh\n-cat >> fake-editor.sh <<\\EOF\n-case \"$1\" in\n-*/COMMIT_EDITMSG)\n-\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n-\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-\texit\n-\t;;\n-esac\n-test -z \"$EXPECT_COUNT\" ||\n-\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n-\texit\n-test -z \"$FAKE_LINES\" && exit\n-grep -v '^#' < \"$1\" > \"$1\".tmp\n-rm -f \"$1\"\n-cat \"$1\".tmp\n-action=pick\n-for line in $FAKE_LINES; do\n-\tcase $line in\n-\tsquash|edit)\n-\t\taction=\"$line\";;\n-\t*)\n-\t\techo sed -n \"${line}s/^pick/$action/p\"\n-\t\tsed -n \"${line}p\" < \"$1\".tmp\n-\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n-\t\taction=pick;;\n-\tesac\n-done\n-EOF\n+. ../lib-rebase.sh\n \n-test_set_editor \"$(pwd)/fake-editor.sh\"\n-chmod a+x fake-editor.sh\n+set_fake_editor\n \n # set up two branches like this:\n #\n-- \n1.6.1.482.g7d54be\n"},{"id":"102174","messageId":"alpine.DEB.1.00.0901272334320.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 2/6] lib-rebase.sh: Document what set_fake_editor() does","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:34:35Z","receivedAt":"2009-01-27T22:34:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Make it easy for other authors to use rebase tests' fake-editor.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/lib-rebase.sh |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 762ffcf..260a231 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -1,5 +1,17 @@\n #!/bin/sh\n \n+# After setting the fake editor with this function, you can\n+#\n+# - override the commit message with $FAKE_COMMIT_MESSAGE,\n+# - amend the commit message with $FAKE_COMMIT_AMEND\n+# - check that non-commit messages have a certain line count with $EXPECT_COUNT\n+# - rewrite a rebase -i script with $FAKE_LINES in the form\n+#\n+#\t\"[<lineno1>] [<lineno2>]...\"\n+#\n+#   If a line number is prefixed with \"squash\" or \"edit\", the respective line's\n+#   command will be replaced with the specified one.\n+\n set_fake_editor () {\n \techo \"#!$SHELL_PATH\" >fake-editor.sh\n \tcat >> fake-editor.sh <<\\EOF\n-- \n1.6.1.482.g7d54be\n"},{"id":"102178","messageId":"alpine.DEB.1.00.0901272334380.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 3/6] test-lib.sh: introduce test_commit() and test_merge() helpers","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:34:48Z","receivedAt":"2009-01-27T22:34:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Often we just need to add a commit with a given (short) name, that will\nbe tagged with the same name.  Now, relatively complicated graphs can be\nconstructed easily and in a clear fashion:\n\n\ttest_commit A &&\n\ttest_commit B &&\n\tgit checkout A &&\n\ttest_commit C &&\n\ttest_merge D B\n\nwill construct this graph:\n\n\tA - B\n\t  \\   \\\n\t    C - D\n\nFor simplicity, files whose name is the lower case version of the commit\nmessage (to avoid a warning about ambiguous names) will be committed, with\nthe corresponding commit messages as contents.\n\nIf you need to provide a different file/different contents, you can use\nthe more explicit form\n\n\ttest_commit $MESSAGE $FILENAME $CONTENTS\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/README      |   18 ++++++++++++++++++\n t/test-lib.sh |   25 +++++++++++++++++++++++++\n 2 files changed, 43 insertions(+), 0 deletions(-)\n\ndiff --git a/t/README b/t/README\nindex 8f12d48..f208cf1 100644\n--- a/t/README\n+++ b/t/README\n@@ -212,6 +212,24 @@ library for your script to use.\n    is to summarize successes and failures in the test script and\n    exit with an appropriate error code.\n \n+ - test_tick\n+\n+   Make commit and tag names consistent by setting the author and\n+   committer times to defined stated.  Subsequent calls will\n+   advance the times by a fixed amount.\n+\n+ - test_commit <message> [<filename> [<contents>]]\n+\n+   Creates a commit with the given message, committing the given\n+   file with the given contents (default for both is to reuse the\n+   message string), and adds a tag (again reusing the message\n+   string as name).  Calls test_tick to make the SHA-1s\n+   reproducible.\n+\n+ - test_merge <message> <commit-or-tag>\n+\n+   Merges the given rev using the given message.  Like test_commit,\n+   creates a tag and calls test_tick before committing.\n \n Tips for Writing Tests\n ----------------------\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 41d5a59..c1839f7 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -193,6 +193,31 @@ test_tick () {\n \texport GIT_COMMITTER_DATE GIT_AUTHOR_DATE\n }\n \n+# Call test_commit with the arguments \"<message> [<file> [<contents>]]\"\n+#\n+# This will commit a file with the given contents and the given commit\n+# message.  It will also add a tag with <message> as name.\n+#\n+# Both <file> and <contents> default to <message>.\n+\n+test_commit () {\n+\tfile=${2:-$(echo \"$1\" | tr 'A-Z' 'a-z')}\n+\techo \"${3-$1}\" > \"$file\" &&\n+\tgit add \"$file\" &&\n+\ttest_tick &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+# Call test_merge with the arguments \"<message> <commit>\", where <commit>\n+# can be a tag pointing to the commit-to-merge.\n+\n+test_merge () {\n+\ttest_tick &&\n+\tgit merge -m \"$1\" \"$2\" &&\n+\tgit tag \"$1\"\n+}\n+\n # You are not expected to call test_ok_ and test_failure_ directly, use\n # the text_expect_* functions instead.\n \n-- \n1.6.1.482.g7d54be\n"},{"id":"102177","messageId":"alpine.DEB.1.00.0901272334530.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 4/6] Simplify t3410","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:34:54Z","receivedAt":"2009-01-27T22:34:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Use test_commit() and test_merge(), reducing the code while making the\nintent clearer.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t3410-rebase-preserve-dropped-merges.sh |  124 ++++++++---------------------\n 1 files changed, 35 insertions(+), 89 deletions(-)\n\ndiff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh\nindex 5816415..c49143a 100755\n--- a/t/t3410-rebase-preserve-dropped-merges.sh\n+++ b/t/t3410-rebase-preserve-dropped-merges.sh\n@@ -22,47 +22,17 @@ rewritten.\n # where B, D and G touch the same file.\n \n test_expect_success 'setup' '\n-\t: > file1 &&\n-\tgit add file1 &&\n-\ttest_tick &&\n-\tgit commit -m A &&\n-\tgit tag A &&\n-\techo 1 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m B file1 &&\n-\t: > file2 &&\n-\tgit add file2 &&\n-\ttest_tick &&\n-\tgit commit -m C &&\n-\techo 2 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m D file1 &&\n-\t: > file3 &&\n-\tgit add file3 &&\n-\ttest_tick &&\n-\tgit commit -m E &&\n-\tgit tag E &&\n-\tgit checkout -b branch1 A &&\n-\t: > file4 &&\n-\tgit add file4 &&\n-\ttest_tick &&\n-\tgit commit -m F &&\n-\tgit tag F &&\n-\techo 3 > file1 &&\n-\ttest_tick &&\n-\tgit commit -m G file1 &&\n-\tgit tag G &&\n-\t: > file5 &&\n-\tgit add file5 &&\n-\ttest_tick &&\n-\tgit commit -m H &&\n-\tgit tag H &&\n-\tgit checkout -b branch2 F &&\n-\t: > file6 &&\n-\tgit add file6 &&\n-\ttest_tick &&\n-\tgit commit -m I &&\n-\tgit tag I\n+\ttest_commit A file1 &&\n+\ttest_commit B file1 1 &&\n+\ttest_commit C file2 &&\n+\ttest_commit D file1 2 &&\n+\ttest_commit E file3 &&\n+\tgit checkout A &&\n+\ttest_commit F file4 &&\n+\ttest_commit G file1 3 &&\n+\ttest_commit H file5 &&\n+\tgit checkout F &&\n+\ttest_commit I file6\n '\n \n # A - B - C - D - E\n@@ -72,68 +42,44 @@ test_expect_success 'setup' '\n #         I -- G2 -- J -- K           I -- K\n # G2 = same changes as G\n test_expect_success 'skip same-resolution merges with -p' '\n-\tgit checkout branch1 &&\n+\tgit checkout H &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m L &&\n-\tgit checkout branch2 &&\n-\techo 3 > file1 &&\n-\tgit commit -a -m G2 &&\n+\ttest_commit L file1 23 &&\n+\tgit checkout I &&\n+\ttest_commit G2 file1 3 &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m J &&\n-\techo file7 > file7 &&\n-\tgit add file7 &&\n-\tgit commit -m K &&\n-\tGIT_EDITOR=: git rebase -i -p branch1 &&\n-\ttest $(git rev-parse branch2^^) = $(git rev-parse branch1) &&\n+\ttest_commit J file1 23 &&\n+\ttest_commit K file7 file7 &&\n+\tgit rebase -i -p L &&\n+\ttest $(git rev-parse HEAD^^) = $(git rev-parse L) &&\n \ttest \"23\" = \"$(cat file1)\" &&\n-\ttest \"\" = \"$(cat file6)\" &&\n-\ttest \"file7\" = \"$(cat file7)\" &&\n-\n-\tgit checkout branch1 &&\n-\tgit reset --hard H &&\n-\tgit checkout branch2 &&\n-\tgit reset --hard I\n+\ttest \"I\" = \"$(cat file6)\" &&\n+\ttest \"file7\" = \"$(cat file7)\"\n '\n \n # A - B - C - D - E\n #   \\             \\ \\\n-#     F - G - H -- L \\        -->   L\n-#       \\            |               \\\n-#         I -- G2 -- J -- K           I -- G2 -- K\n+#     F - G - H -- L2 \\        -->   L2\n+#       \\             |                \\\n+#         I -- G3 --- J2 -- K2           I -- G3 -- K2\n # G2 = different changes as G\n test_expect_success 'keep different-resolution merges with -p' '\n-\tgit checkout branch1 &&\n+\tgit checkout H &&\n \t! git merge E &&\n-\techo 23 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m L &&\n-\tgit checkout branch2 &&\n-\techo 4 > file1 &&\n-\tgit commit -a -m G2 &&\n+\ttest_commit L2 file1 23 &&\n+\tgit checkout I &&\n+\ttest_commit G3 file1 4 &&\n \t! git merge E &&\n-\techo 24 > file1 &&\n-\tgit add file1 &&\n-\tgit commit -m J &&\n-\techo file7 > file7 &&\n-\tgit add file7 &&\n-\tgit commit -m K &&\n-\t! GIT_EDITOR=: git rebase -i -p branch1 &&\n+\ttest_commit J2 file1 24 &&\n+\ttest_commit K2 file7 file7 &&\n+\ttest_must_fail git rebase -i -p L2 &&\n \techo 234 > file1 &&\n \tgit add file1 &&\n-\tGIT_EDITOR=: git rebase --continue &&\n-\ttest $(git rev-parse branch2^^^) = $(git rev-parse branch1) &&\n+\tgit rebase --continue &&\n+\ttest $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&\n \ttest \"234\" = \"$(cat file1)\" &&\n-\ttest \"\" = \"$(cat file6)\" &&\n-\ttest \"file7\" = \"$(cat file7)\" &&\n-\n-\tgit checkout branch1 &&\n-\tgit reset --hard H &&\n-\tgit checkout branch2 &&\n-\tgit reset --hard I\n+\ttest \"I\" = \"$(cat file6)\" &&\n+\ttest \"file7\" = \"$(cat file7)\"\n '\n \n test_done\n-- \n1.6.1.482.g7d54be\n"},{"id":"102176","messageId":"alpine.DEB.1.00.0901272335040.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 5/6] Simplify t3411","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:35:05Z","receivedAt":"2009-01-27T22:35:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Use test_commit() and test_merge().  This way, it is harder to forget to\ntag, or to call test_tick before committing.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t3411-rebase-preserve-around-merges.sh |   65 ++++++++----------------------\n 1 files changed, 17 insertions(+), 48 deletions(-)\n\ndiff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh\nindex 6a1586a..6533505 100755\n--- a/t/t3411-rebase-preserve-around-merges.sh\n+++ b/t/t3411-rebase-preserve-around-merges.sh\n@@ -21,27 +21,13 @@ set_fake_editor\n #        -- C1 --\n \n test_expect_success 'setup' '\n-\ttouch a &&\n-\ttouch b &&\n-\tgit add a &&\n-\tgit commit -m A1 &&\n-\tgit tag A1\n-\tgit add b &&\n-\tgit commit -m B1 &&\n-\tgit tag B1 &&\n-\tgit checkout -b branch &&\n-\ttouch c &&\n-\tgit add c &&\n-\tgit commit -m C1 &&\n-\tgit checkout master &&\n-\ttouch d &&\n-\tgit add d &&\n-\tgit commit -m D1 &&\n-\tgit merge branch &&\n-\ttouch f &&\n-\tgit add f &&\n-\tgit commit -m F1 &&\n-\tgit tag F1\n+\ttest_commit A1 &&\n+\ttest_commit B1 &&\n+\ttest_commit C1 &&\n+\tgit reset --hard B1 &&\n+\ttest_commit D1 &&\n+\ttest_merge E1 C1 &&\n+\ttest_commit F1\n '\n \n # Should result in:\n@@ -52,7 +38,7 @@ test_expect_success 'setup' '\n #\n test_expect_success 'squash F1 into D1' '\n \tFAKE_LINES=\"1 squash 3 2\" git rebase -i -p B1 &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse branch)\" &&\n+\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse C1)\" &&\n \ttest \"$(git rev-parse HEAD~2)\" = \"$(git rev-parse B1)\" &&\n \tgit tag E2\n '\n@@ -70,32 +56,15 @@ test_expect_success 'squash F1 into D1' '\n # And rebase G1..M1 onto E2\n \n test_expect_success 'rebase two levels of merge' '\n-\tgit checkout -b branch2 A1 &&\n-\ttouch g &&\n-\tgit add g &&\n-\tgit commit -m G1 &&\n-\tgit checkout -b branch3 &&\n-\ttouch h\n-\tgit add h &&\n-\tgit commit -m H1 &&\n-\tgit checkout -b branch4 &&\n-\ttouch i &&\n-\tgit add i &&\n-\tgit commit -m I1 &&\n-\tgit tag I1 &&\n-\tgit checkout branch3 &&\n-\ttouch j &&\n-\tgit add j &&\n-\tgit commit -m J1 &&\n-\tgit merge I1 --no-commit &&\n-\tgit commit -m K1 &&\n-\tgit tag K1 &&\n-\tgit checkout branch2 &&\n-\ttouch l &&\n-\tgit add l &&\n-\tgit commit -m L1 &&\n-\tgit merge K1 --no-commit &&\n-\tgit commit -m M1 &&\n+\ttest_commit G1 &&\n+\ttest_commit H1 &&\n+\ttest_commit I1 &&\n+\tgit checkout -b branch3 H1 &&\n+\ttest_commit J1 &&\n+\ttest_merge K1 I1 &&\n+\tgit checkout -b branch2 G1 &&\n+\ttest_commit L1 &&\n+\ttest_merge M1 K1 &&\n \tGIT_EDITOR=: git rebase -i -p E2 &&\n \ttest \"$(git rev-parse HEAD~3)\" = \"$(git rev-parse E2)\" &&\n \ttest \"$(git rev-parse HEAD~2)\" = \"$(git rev-parse HEAD^2^2~2)\" &&\n-- \n1.6.1.482.g7d54be\n"},{"id":"102175","messageId":"alpine.DEB.1.00.0901272334570.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7v7i4g31lj.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2 6/6] Simplify t3412","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:35:09Z","receivedAt":"2009-01-27T22:35:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Use the newly introduced test_commit() and test_merge() helpers.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t3412-rebase-root.sh |   28 +++++++---------------------\n 1 files changed, 7 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh\nindex 3d8ff67..9fc528f 100755\n--- a/t/t3412-rebase-root.sh\n+++ b/t/t3412-rebase-root.sh\n@@ -7,23 +7,13 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.\n . ./test-lib.sh\n \n test_expect_success 'prepare repository' '\n-\techo 1 > A &&\n-\tgit add A &&\n-\tgit commit -m 1 &&\n-\techo 2 > A &&\n-\tgit add A &&\n-\tgit commit -m 2 &&\n+\ttest_commit 1 A &&\n+\ttest_commit 2 A &&\n \tgit symbolic-ref HEAD refs/heads/other &&\n \trm .git/index &&\n-\techo 3 > B &&\n-\tgit add B &&\n-\tgit commit -m 3 &&\n-\techo 1 > A &&\n-\tgit add A &&\n-\tgit commit -m 1b &&\n-\techo 4 > B &&\n-\tgit add B &&\n-\tgit commit -m 4\n+\ttest_commit 3 B &&\n+\ttest_commit 1b A 1 &&\n+\ttest_commit 4 B\n '\n \n test_expect_success 'rebase --root expects --onto' '\n@@ -103,9 +93,7 @@ test_expect_success 'pre-rebase got correct input (5)' '\n test_expect_success 'set up merge history' '\n \tgit checkout other^ &&\n \tgit checkout -b side &&\n-\techo 5 > C &&\n-\tgit add C &&\n-\tgit commit -m 5 &&\n+\ttest_commit 5 C &&\n \tgit checkout other &&\n \tgit merge side\n '\n@@ -132,9 +120,7 @@ test_expect_success 'set up second root and merge' '\n \tgit symbolic-ref HEAD refs/heads/third &&\n \trm .git/index &&\n \trm A B C &&\n-\techo 6 > D &&\n-\tgit add D &&\n-\tgit commit -m 6 &&\n+\ttest_commit 6 D &&\n \tgit checkout other &&\n \tgit merge third\n '\n-- \n1.6.1.482.g7d54be\n"},{"id":"102183","messageId":"7veiyo1i5y.fsf@gitster.siamese.dyndns.org","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901272254450.14855@racer","subject":"Re: [PATCH 1/6] t3404 & t3411: undo copy&paste","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T22:46:33Z","receivedAt":"2009-01-27T22:46:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> > +\t\tsed -n \"${line}p\" < \"$1\".tmp\n>> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n>> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp\n>\n>\n> Probably.  It is for debugging, anyway.  As everything you only see with \n> -v.\n\nExactly.  That is why I'd rather want to see what exact insn sequence is\nbeing fed to the \"rebase -i\".  Because I'd be debugging my new test or\nchanges to \"rebase -i\", not debugging fake-editor's use of sed.\n"},{"id":"102186","messageId":"7vab9c1hyp.fsf@gitster.siamese.dyndns.org","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901272323530.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH v2 0/6] rebase simplifications","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T22:50:54Z","receivedAt":"2009-01-27T22:50:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> Changes vs  v1:\n>\n> removed the \"rnyn\" blurt (which probably marsk me as Alpine user...)\n>\n> removed the SHELL_PATH handling; it is a miracle to me why it works, but \n> I'd rather not meddle with the magic now that you pointed it out\n>\n> Moved test_commit and test_merge into test-lib.sh\n>\n> Fixed the quoting in test_commit and test_merge\n>\n> AFAIR that's all...\n\nThanks; looks much nicer (not just relative to v1 but compared to the\noriginal).\n"},{"id":"102188","messageId":"alpine.DEB.1.00.0901272352110.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7veiyo1i5y.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/6] t3404 & t3411: undo copy&paste","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T22:53:30Z","receivedAt":"2009-01-27T22:53:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> > +\t\tsed -n \"${line}p\" < \"$1\".tmp\n> >> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n> >> > +\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp\n> >\n> > Probably.  It is for debugging, anyway.  As everything you only see with \n> > -v.\n> \n> Exactly.  That is why I'd rather want to see what exact insn sequence is \n> being fed to the \"rebase -i\".  Because I'd be debugging my new test or \n> changes to \"rebase -i\", not debugging fake-editor's use of sed.\n\nIf you are really after seeing the constructed rebase script, then\n\n\t\t\ttail -n 1 \"$1\"\n\nwould make tons more sense, no?\n\nCiao,\nDscho\n"},{"id":"102195","messageId":"alpine.DEB.1.00.0901280010140.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"7vab9c1hyp.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 0/6] rebase simplifications","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T23:10:37Z","receivedAt":"2009-01-27T23:10:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Junio C Hamano wrote:\n\n> Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n> \n> > Changes vs  v1:\n> >\n> > removed the \"rnyn\" blurt (which probably marsk me as Alpine user...)\n> >\n> > removed the SHELL_PATH handling; it is a miracle to me why it works, but \n> > I'd rather not meddle with the magic now that you pointed it out\n> >\n> > Moved test_commit and test_merge into test-lib.sh\n> >\n> > Fixed the quoting in test_commit and test_merge\n> >\n> > AFAIR that's all...\n\nOh, I forgot the ${2:-...} thing...\n\n> Thanks; looks much nicer (not just relative to v1 but compared to the \n> original).\n\nThanks!\n\nCiao,\nDscho\n"},{"id":"102222","messageId":"alpine.DEB.1.00.0901280225240.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"20090127085418.e113ad5a.stephen@exigencecorp.com","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-28T01:53:55Z","receivedAt":"2009-01-28T01:53:55Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Stephen Haberman wrote:\n> \n> Dscho wroteÖ\n> \n> > As for the design bug I want to fix: imagine this history:\n> > \n> >   ------A\n> >  /     /\n> > /     /\n> > ---- B\n> > \\     \\\n> >  \\     \\\n> >   C-----D-----E = HEAD\n> > \n> > A, C and D touch the same file, and A and D agree on the contents.\n> > \n> > Now, rebase -p A does the following at the moment:\n> > \n> >   ------A-----E' = HEAD\n> >  /     /\n> > /     /\n> > ---- B\n> > \n> > In other words, C is truly forgotten, and it is pretended that D never \n> > happened, either.  That is exactly what test case 2 in t3410 tests for \n> > [*1*].\n> > \n> > This is insane.\n> \n> Agreed.\n\nActually, I misread t3410 a great deal.  The situation is as follows:\n\n    ... UPSTREAM\n           \\\n... A - B - C -D\n\nA is a patch the upstream does not have, B is a patch UPSTREAM has,\nand \"git diff C^!\" (i.e. the diff of C to its first parent) is _also_ \nidentical to a diff of a merge that is in UPSTREAM.\n\nBasically, t3410 tests that after \"git rebase -i -p UPSTREAM\" and leaving \nthe rebase script as-is, essentially, A and D are cherry-picked on top of \nUPSTREAM.\n\n> Does this mean you're just getting rid of the code that calls \"rev list \n> --cherry-pick\"?\n\nOnly now do I understand.\n\nI misread the code for --cherry-pick.  For merges, it adds the diff to the \nfirst parent!\n\nI do not know if it really is desirable to have --cherry-pick handle \nmerges at all; I tend to think it is not.\n\nUnfortunately, a short blame session just points to 9c6efa36 done by a \nsloppy programmer: yours truly.\n\nSo I adapted my code to find the \"dropped\" merges in \ngit-rebase--interactive, too, for now, but I guess the proper fix is \nsomething like this:\n\n-- snipsnap --\n[PATCH] --cherry-pick: do not skip merges, ever\n\nCurrently, --cherry-pick has no problem getting a patch id for merge \ncommits: it calculated as the patch id of the patch between the first \nparent and the merge commit.\n\nOf course, this is bogus, as it completely misses the fact that the\nmerge commit has other parents, too, and therefore a single patch id\nwould be wrong.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n patch-ids.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/patch-ids.c b/patch-ids.c\nindex 3be5d31..808a7f0 100644\n--- a/patch-ids.c\n+++ b/patch-ids.c\n@@ -6,9 +6,12 @@\n static int commit_patch_id(struct commit *commit, struct diff_options *options,\n \t\t    unsigned char *sha1)\n {\n-\tif (commit->parents)\n+\tif (commit->parents) {\n+\t\tif (commit->parents->next)\n+\t\t\treturn 0; /* merges do not have a patch id */\n \t\tdiff_tree_sha1(commit->parents->item->object.sha1,\n \t\t               commit->object.sha1, \"\", options);\n+\t}\n \telse\n \t\tdiff_root_tree_sha1(commit->object.sha1, \"\", options);\n \tdiffcore_std(options);"},{"id":"102237","messageId":"20090127213950.3596ecf9.stephen@exigencecorp.com","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901280225240.3586@pacific.mpi-cbg.de","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Stephen Haberman","fromEmail":"stephen@exigencecorp.com","sentAt":"2009-01-28T03:39:50Z","receivedAt":"2009-01-28T03:39:50Z","isPatch":false,"sender":{"key":"stephen@exigencecorp.com","avatar":"https://gravatar.com/avatar/23b93ad70a06ce53505f17ddba65176edbcfb6588e7a4c1a2dca04aaf0a6aff1?d=mp&s=160"},"body":"\n> Actually, I misread t3410 a great deal.  The situation is as follows:\n> \n>     ... UPSTREAM\n>            \\\n> ... A - B - C -D\n> \n> A is a patch the upstream does not have, B is a patch UPSTREAM has,\n> and \"git diff C^!\" (i.e. the diff of C to its first parent) is _also_ \n> identical to a diff of a merge that is in UPSTREAM.\n> \n> Basically, t3410 tests that after \"git rebase -i -p UPSTREAM\" and leaving \n> the rebase script as-is, essentially, A and D are cherry-picked on top of \n> UPSTREAM.\n\nCool--I \"knew\" that, but could not have articulated the case as\nsuccinctly.\n\n> > Does this mean you're just getting rid of the code that calls \"rev list \n> > --cherry-pick\"?\n> \n> Only now do I understand.\n> \n> I misread the code for --cherry-pick.  For merges, it adds the diff to the \n> first parent!\n\nAh, so that is how --cherry-pick works--I'd never looked into the\npatch-id stuff before. Makes sense, both of how it is leveraged by\nrev-list --cherry-pick and also that it doesn't make sense to only be\nagainst the first parent of merges.\n\n> So I adapted my code to find the \"dropped\" merges in\n> git-rebase--interactive, too, for now, but I guess the proper fix is\n> something like this:\n\nSo, if C, as a merge commit, doesn't get a patch id anymore (right?),\ndoes that mean that C is included with A and D in the cherry-picking\non top of UPSTREAM (because with no patch id it cannot be recognized\nas a duplicate)? So then C' is an empty-commit? This would be fine, I\nthink, or can you detect that C is a noop somehow without patch ids?\n\nThanks,\nStephen\n"},{"id":"102241","messageId":"alpine.DEB.1.00.0901280458590.3586@pacific.mpi-cbg.de","threadId":"17387","inReplyTo":"20090127213950.3596ecf9.stephen@exigencecorp.com","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-28T04:01:56Z","receivedAt":"2009-01-28T04:01:56Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 Jan 2009, Stephen Haberman wrote:\n\n> > So I adapted my code to find the \"dropped\" merges in \n> > git-rebase--interactive, too, for now, but I guess the proper fix is \n> > something like this:\n> \n> So, if C, as a merge commit, doesn't get a patch id anymore (right?),\n> does that mean that C is included with A and D in the cherry-picking\n> on top of UPSTREAM (because with no patch id it cannot be recognized\n> as a duplicate)?\n\nYep, it gets into the list.  But not with a \"pick\" command, as a merge it \nwill get a \"merge\" command.\n\n> So then C' is an empty-commit? This would be fine, I think, or can you \n> detect that C is a noop somehow without patch ids?\n\nActually, there are three possible outcomes:\n\n- it tries to merge an ancestor of HEAD or HEAD itself -> noop\n\n- it tries to merge which results in a fast-forward -> fine\n\n- it tries to merge and a proper merge is necessary -> may conflict\n\nCiao,\nDscho\n"},{"id":"102252","messageId":"20090127232136.c54369d6.stephen@exigencecorp.com","threadId":"17387","inReplyTo":"alpine.DEB.1.00.0901280458590.3586@pacific.mpi-cbg.de","subject":"Re: Heads up: rebase -i -p will be made sane again","fromName":"Stephen Haberman","fromEmail":"stephen@exigencecorp.com","sentAt":"2009-01-28T05:21:36Z","receivedAt":"2009-01-28T05:21:36Z","isPatch":false,"sender":{"key":"stephen@exigencecorp.com","avatar":"https://gravatar.com/avatar/23b93ad70a06ce53505f17ddba65176edbcfb6588e7a4c1a2dca04aaf0a6aff1?d=mp&s=160"},"body":"\n> > > So I adapted my code to find the \"dropped\" merges in \n> > > git-rebase--interactive, too, for now, but I guess the proper fix is \n> > > something like this:\n> > \n> > So, if C, as a merge commit, doesn't get a patch id anymore (right?),\n> > does that mean that C is included with A and D in the cherry-picking\n> > on top of UPSTREAM (because with no patch id it cannot be recognized\n> > as a duplicate)?\n> \n> Yep, it gets into the list.  But not with a \"pick\" command, as a merge it \n> will get a \"merge\" command.\n> \n> > So then C' is an empty-commit? This would be fine, I think, or can you \n> > detect that C is a noop somehow without patch ids?\n> \n> Actually, there are three possible outcomes:\n> \n> - it tries to merge an ancestor of HEAD or HEAD itself -> noop\n> \n> - it tries to merge which results in a fast-forward -> fine\n> \n> - it tries to merge and a proper merge is necessary -> may conflict\n\nAh, cool, that makes sense.\n\nThanks,\nStephen\n"}]}