{"thread":{"id":"12812","subject":"[PATCH 1/3] Add test for rebase interactive with preserve merges","startedAt":"2008-03-22T21:44:24Z","lastAt":"2008-03-22T21:57:02Z","messageCount":4,"participants":["Jörg Sommer"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"72706","messageId":"1206222266-29179-1-git-send-email-joerg@alea.gnuu.de","threadId":"12812","inReplyTo":null,"subject":"[PATCH 1/3] Add test for rebase interactive with preserve merges","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-22T21:44:24Z","receivedAt":"2008-03-22T21:44:24Z","isPatch":true,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"The intention of “edit … --continue” is to ensure the state is persistent\nand not saved in internal variables.\n\nSigned-off-by: Jörg Sommer <joerg@alea.gnuu.de>\n---\n t/t3404-rebase-interactive.sh |   11 +++++++++++\n 1 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 9cf873f..014b036 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -212,6 +212,17 @@ test_expect_success 'preserve merges with -p' '\n \ttest $(git show HEAD~2:file1) = B\n '\n \n+test_expect_failure 'preserve merges with -p (case 2)' '\n+\told_head=$(git rev-parse HEAD) &&\n+\ttest_tick &&\n+\tEXPECT_COUNT=4 FAKE_LINES=\"1 4 3 edit 2\" git rebase -i -p branch1 &&\n+\tgit rebase --continue &&\n+\ttest $(git rev-parse HEAD) != $old_head\n+'\n+\n+# clean-up from the above test\n+git reset -q --hard\n+\n test_expect_success '--continue tries to commit' '\n \ttest_tick &&\n \t! git rebase -i --onto new-branch1 HEAD^ &&\n-- \n1.5.4.4\n"},{"id":"72709","messageId":"1206222266-29179-2-git-send-email-joerg@alea.gnuu.de","threadId":"12812","inReplyTo":"1206222266-29179-1-git-send-email-joerg@alea.gnuu.de","subject":"[PATCH 2/3] Change rebase with preserver merges to pick up the right new HEAD","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-22T21:44:25Z","receivedAt":"2008-03-22T21:44:25Z","isPatch":true,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"The assumtion that the new HEAD is the rewritten old head is wrong. The\nnew HEAD is the (maybe rewritten) last commit in the list.\n\nSigned-off-by: Jörg Sommer <joerg@alea.gnuu.de>\n---\n git-rebase--interactive.sh |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 8aa7371..dec18a3 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -20,6 +20,7 @@ require_work_tree\n DOTEST=\"$GIT_DIR/.dotest-merge\"\n TODO=\"$DOTEST\"/git-rebase-todo\n DONE=\"$DOTEST\"/done\n+LAST_SHA1=\"$DOTEST\"/last_sha1\n MSG=\"$DOTEST\"/message\n SQUASH_MSG=\"$DOTEST\"/message-squash\n REWRITTEN=\"$DOTEST\"/rewritten\n@@ -251,6 +252,7 @@ do_next () {\n \tpick|p)\n \t\tcomment_for_reflog pick\n \n+\t\techo $sha1 > \"$LAST_SHA1\"\n \t\tmark_action_done\n \t\tpick_one $sha1 ||\n \t\t\tdie_with_patch $sha1 \"Could not apply $sha1... $rest\"\n@@ -258,6 +260,7 @@ do_next () {\n \tedit|e)\n \t\tcomment_for_reflog edit\n \n+\t\techo $sha1 > \"$LAST_SHA1\"\n \t\tmark_action_done\n \t\tpick_one $sha1 ||\n \t\t\tdie_with_patch $sha1 \"Could not apply $sha1... $rest\"\n@@ -280,6 +283,7 @@ do_next () {\n \t\thas_action \"$DONE\" ||\n \t\t\tdie \"Cannot 'squash' without a previous commit\"\n \n+\t\techo $sha1 > \"$LAST_SHA1\"\n \t\tmark_action_done\n \t\tmake_squash_message $sha1 > \"$MSG\"\n \t\tcase \"$(peek_next_command)\" in\n@@ -333,11 +337,12 @@ do_next () {\n \t\ttest -f \"$DOTEST\"/current-commit &&\n \t\t\tcurrent_commit=$(cat \"$DOTEST\"/current-commit) &&\n \t\t\tgit rev-parse HEAD > \"$REWRITTEN\"/$current_commit\n-\t\tif test -f \"$REWRITTEN\"/$OLDHEAD\n+\t\tlast_sha1=$(git rev-parse $(cat \"$LAST_SHA1\"))\n+\t\tif test -f \"$REWRITTEN\"/$last_sha1\n \t\tthen\n-\t\t\tNEWHEAD=$(cat \"$REWRITTEN\"/$OLDHEAD)\n+\t\t\tNEWHEAD=$(cat \"$REWRITTEN\"/$last_sha1)\n \t\telse\n-\t\t\tNEWHEAD=$OLDHEAD\n+\t\t\tNEWHEAD=$last_sha1\n \t\tfi\n \telse\n \t\tNEWHEAD=$(git rev-parse HEAD)\n-- \n1.5.4.4\n"},{"id":"72707","messageId":"1206222266-29179-3-git-send-email-joerg@alea.gnuu.de","threadId":"12812","inReplyTo":"1206222266-29179-2-git-send-email-joerg@alea.gnuu.de","subject":"[PATCH 3/3] Improve failure test for preserve merges","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-22T21:44:26Z","receivedAt":"2008-03-22T21:44:26Z","isPatch":true,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"\nSigned-off-by: Jörg Sommer <joerg@alea.gnuu.de>\n---\n t/t3404-rebase-interactive.sh |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 014b036..eaa2fc0 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -213,11 +213,13 @@ test_expect_success 'preserve merges with -p' '\n '\n \n test_expect_failure 'preserve merges with -p (case 2)' '\n-\told_head=$(git rev-parse HEAD) &&\n \ttest_tick &&\n-\tEXPECT_COUNT=4 FAKE_LINES=\"1 4 3 edit 2\" git rebase -i -p branch1 &&\n-\tgit rebase --continue &&\n-\ttest $(git rev-parse HEAD) != $old_head\n+\tEXPECT_COUNT=4 FAKE_LINES=\"1 4 3 edit 2\" git rebase -i -v -p branch1 &&\n+\tgit rebase --continue\n+\ttest $(git rev-parse HEAD^^2) = $(git rev-parse to-be-preserved) &&\n+\ttest $(git rev-parse HEAD~3) = $(git rev-parse branch1) &&\n+\ttest $(git show HEAD:file1) = B &&\n+\ttest $(git show HEAD~2:file1) = C\n '\n \n # clean-up from the above test\n-- \n1.5.4.4\n"},{"id":"72708","messageId":"20080322215702.GA29174@alea.gnuu.de","threadId":"12812","inReplyTo":"1206222266-29179-3-git-send-email-joerg@alea.gnuu.de","subject":"Re: [PATCH 3/3] Improve failure test for preserve merges","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-22T21:57:02Z","receivedAt":"2008-03-22T21:57:02Z","isPatch":true,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Jörg Sommer schrieb am Sat 22. Mar, 22:44 (+0100):\n> \n> Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>\n> ---\n>  t/t3404-rebase-interactive.sh |   10 ++++++----\n>  1 files changed, 6 insertions(+), 4 deletions(-)\n> \n> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\n> index 014b036..eaa2fc0 100755\n> --- a/t/t3404-rebase-interactive.sh\n> +++ b/t/t3404-rebase-interactive.sh\n> @@ -213,11 +213,13 @@ test_expect_success 'preserve merges with -p' '\n>  '\n>  \n>  test_expect_failure 'preserve merges with -p (case 2)' '\n\nThis test still fails, but I don't know how to fix it. The situation is\nthis:\n\no---P\n \\   \\\n  A---M---B\n\nA and B should get exchanged. So I would assume that telling rebase the\nfollowing should do it:\n\npick P\npick B\npick M\npick A\n\nBut what should be the new parent of B?\n\nIs it allowed to permute lines with preserve merges? I've got the\nimpression it's not.\n\nBye, Jörg.\n-- \n[dpkg] We are the apt. Resistance is futile. You will be packaged.\n"}]}