{"thread":{"id":"31582","subject":"[RFC PATCH] add t3420-rebase-topology","startedAt":"2012-09-18T06:31:18Z","lastAt":"2013-06-19T05:52:33Z","messageCount":75,"participants":["Martin von Zweigbergk","Junio C Hamano","Johannes Sixt","Chris Webb","Felipe Contreras","Ramkumar Ramachandra"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199335","messageId":"1347949878-12578-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":null,"subject":"[RFC PATCH] add t3420-rebase-topology","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-18T06:31:18Z","receivedAt":"2012-09-18T06:31:18Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Add more test cases to check that the topology after a rebase is as\nexpected. Conflicts are not considered, but patch-equivalence is.\n---\n\nTests pass and fail as indicated by the suffix\n(_success/_failure). Your input especially appreciated on whether you\nagree with the intent of the test cases. For example, do you agree\nthat 'rebase --onto does not re-apply patches in onto' is desirable?\nAnd if you do, then do you also agree that 'rebase --root --onto\nignores patch in onto' is desirable? How about 'rebase --root is not a\nno-op'? One might think that --force would be necessary, but on the\nother hand, if that was the case, the only point (AFAICT) of \"git\nrebase --root <branch>\" without --force would be to linearize history,\nso I instead made the test case confirm that --root without --onto\neffectively behaves as if --force was also passed.\n\nFeedback on the structure/setup and style is of course also\nappreciated.\n\n t/t3420-rebase-topology.sh | 348 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 348 insertions(+)\n create mode 100755 t/t3420-rebase-topology.sh\n\ndiff --git a/t/t3420-rebase-topology.sh b/t/t3420-rebase-topology.sh\nnew file mode 100755\nindex 0000000..024a2b4\n--- /dev/null\n+++ b/t/t3420-rebase-topology.sh\n@@ -0,0 +1,348 @@\n+#!/bin/sh\n+\n+test_description='effect of rebase on topology'\n+. ./test-lib.sh\n+\n+\n+#       q---C---r\n+#      /\n+# a---b---c---d!--e---p\n+#      \\\n+#       f---g!--h\n+#        \\\n+#         j-------E---k\n+#          \\       \\\n+#           n---H---w\n+#\n+# x---y---B\n+#\n+#\n+# ! = empty\n+# uppercase = cherry-picked\n+# p = reverted e\n+#\n+# TODO:\n+# prune graph to what's needed\n+\n+empty () {\n+\tgit commit --allow-empty -m $1 &&\n+\tgit tag $1\n+}\n+\n+cherry_pick () {\n+\tgit cherry-pick -n $1 &&\n+\tgit commit -m $2 &&\n+\tgit tag $2\n+}\n+\n+revert () {\n+\tgit revert -n $1 &&\n+\tgit commit -m $2 &&\n+\tgit tag $2\n+}\n+\n+\n+test_expect_success 'setup' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tempty d &&\n+\ttest_commit e &&\n+\trevert e p &&\n+\tgit checkout b &&\n+\ttest_commit f &&\n+\tempty g &&\n+\ttest_commit h &&\n+\tgit checkout f &&\n+\ttest_commit j &&\n+\tcherry_pick e E &&\n+\ttest_commit k &&\n+\tgit checkout j &&\n+\ttest_commit n &&\n+\tcherry_pick h H &&\n+\tgit merge -m w E &&\n+\tgit tag w &&\n+\tgit checkout b &&\n+\ttest_commit q &&\n+\tcherry_pick c C &&\n+\ttest_commit r &&\n+\tgit checkout --orphan disjoint &&\n+\tgit rm -rf . &&\n+\ttest_commit x &&\n+\ttest_commit y &&\n+\tcherry_pick b B\n+'\n+\n+reset () {\n+\tgit rebase --abort\n+\tgit reset --hard\n+}\n+\n+test_range () {\n+\ttest \"$(git log --reverse --topo-order --format=%s \"$1\" | xargs)\" = \"$2\"\n+}\n+\n+test_revisions () {\n+\texpected=\"$1\"\n+\tshift\n+\ttest \"$(git log --format=%s --no-walk=unsorted \"$@\" | xargs)\" = \"$expected\"\n+}\n+\n+same_revision () {\n+\ttest \"$(git rev-parse $1)\" = \"$(git rev-parse $2)\"\n+}\n+\n+# the following 5 (?) tests copy t3400 tests, but check the history rather than status code and/or stdout\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' c j &&\n+\tsame_revision HEAD~2 c &&\n+\ttest_range c.. \"f j\"\n+'\n+}\n+test_expect_success 'simple rebase' \"$(run)\"\n+test_expect_success 'simple rebase -m' \"$(run -m)\"\n+test_expect_success 'simple rebase -i' \"$(run -i)\"\n+test_expect_success 'simple rebase -p' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' b j &&\n+\tsame_revision HEAD j\n+'\n+}\n+test_expect_success 'rebase is no-op if upstream is an ancestor' \"$(run)\"\n+test_expect_success 'rebase -m is no-op if upstream is an ancestor' \"$(run -m)\"\n+test_expect_success 'rebase -i is no-op if upstream is an ancestor' \"$(run -i)\"\n+test_expect_success 'rebase -p is no-op if upstream is an ancestor' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --force b j &&\n+\t! same_revision HEAD j &&\n+\ttest_range b.. \"f j\"\n+'\n+}\n+test_expect_success 'rebase --force' \"$(run)\"\n+test_expect_success 'rebase -m --force' \"$(run -m)\"\n+test_expect_success 'rebase -i --force' \"$(run -i)\"\n+test_expect_failure 'rebase -p --force' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' j b &&\n+\tsame_revision HEAD j\n+'\n+}\n+test_expect_success 'rebase fast-forwards if an ancestor of upstream' \"$(run)\"\n+test_expect_success 'rebase -m fast-forwards if an ancestor of upstream' \"$(run -m)\"\n+test_expect_success 'rebase -i fast-forwards if an ancestor of upstream' \"$(run -i)\"\n+test_expect_success 'rebase -p fast-forwards if an ancestor of upstream' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' p k &&\n+\ttest_range p.. \"f j k\"\n+'\n+}\n+test_expect_success 'rebase ignores patch in upstream' \"$(run)\"\n+test_expect_failure 'rebase -m ignores patch in upstream' \"$(run -m)\"\n+test_expect_success 'rebase -i ignores patch in upstream' \"$(run -i)\"\n+test_expect_success 'rebase -p ignores patch in upstream' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' c h &&\n+\ttest_range c.. \"f h\"\n+'\n+}\n+test_expect_success 'rebase ignores empty commit' \"$(run)\"\n+test_expect_success 'rebase -m ignores empty commit' \"$(run -m)\"\n+test_expect_success 'rebase -i ignores empty commit' \"$(run -i)\"\n+test_expect_success 'rebase -p ignores empty commit' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --keep-empty c h &&\n+\ttest_range c.. \"f g h\"\n+'\n+}\n+test_expect_success 'rebase --keep-empty' \"$(run)\"\n+test_expect_failure 'rebase -m --keep-empty' \"$(run -m)\"\n+test_expect_success 'rebase -i --keep-empty' \"$(run -i)\"\n+test_expect_failure 'rebase -p --keep-empty' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --keep-empty p h &&\n+\ttest_range p.. \"f g h\"\n+'\n+}\n+test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' \"$(run)\"\n+test_expect_failure 'rebase -m --keep-empty keeps empty even if already in upstream' \"$(run -m)\"\n+test_expect_failure 'rebase -i --keep-empty keeps empty even if already in upstream' \"$(run -i)\"\n+test_expect_failure 'rebase -p --keep-empty keeps empty even if already in upstream' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' E w &&\n+\ttest_range E.. \"n H\"\n+'\n+}\n+test_expect_success 'rebase after merge' \"$(run)\"\n+test_expect_success 'rebase -m after merge' \"$(run -m)\"\n+test_expect_success 'rebase -i after merge' \"$(run -i)\"\n+\n+test_expect_success 'rebase -p is no-op in history with merges' '\n+\treset &&\n+\tgit rebase -p j w &&\n+\tsame_revision HEAD w\n+'\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' j w &&\n+\ttest_range j.. \"E n H\" || test_range j.. \"n H E\"\n+'\n+}\n+test_expect_success 'rebase of history with merges is linearized' \"$(run)\"\n+test_expect_success 'rebase -m of history with merges is linearized' \"$(run -m)\"\n+test_expect_success 'rebase -i of history with merges is linearized' \"$(run -i)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --onto p h k &&\n+\ttest_range p.. \"j k\"\n+'\n+}\n+test_expect_failure 'rebase --onto does not re-apply patches in onto' \"$(run)\"\n+test_expect_failure 'rebase -m --onto does not re-apply patches in onto' \"$(run -m)\"\n+test_expect_failure 'rebase -i --onto does not re-apply patches in onto' \"$(run -i)\"\n+test_expect_failure 'rebase -p --onto does not re-apply patches in onto' \"$(run -p)\"\n+\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --onto f d r &&\n+\ttest_range f.. \"q C r\"\n+'\n+}\n+test_expect_failure 'rebase --onto does not lose patches in upstream' \"$(run)\"\n+test_expect_success 'rebase -m --onto does not lose patches in upstream' \"$(run -m)\"\n+test_expect_failure 'rebase -i --onto does not lose patches in upstream' \"$(run -i)\"\n+test_expect_failure 'rebase -p --onto does not lose patches in upstream' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --root c &&\n+\t! same_revision HEAD c &&\n+\ttest_range c \"a b c\"\n+'\n+}\n+test_expect_success 'rebase --root is not a no-op' \"$(run)\"\n+test_expect_success 'rebase -m --root is not a no-op' \"$(run -m)\"\n+test_expect_success 'rebase -i --root is not a no-op' \"$(run -i)\"\n+test_expect_success 'rebase -p --root is not a no-op' \"$(run -p)\"\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --root --onto e y &&\n+\ttest_range e.. \"x y\"\n+'\n+}\n+test_expect_success 'rebase --root --onto' \"$(run)\"\n+test_expect_failure 'rebase -m --root --onto' \"$(run -m)\"\n+test_expect_success 'rebase -i --root --onto' \"$(run -i)\"\n+test_expect_success 'rebase -p --root --onto' \"$(run -p)\"\n+\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --root --onto e B &&\n+\ttest_range e.. \"x y\"\n+'\n+}\n+test_expect_success 'rebase --root --onto ignores patch in onto' \"$(run)\"\n+test_expect_failure 'rebase -m --root --onto ignores patch in onto' \"$(run -m)\"\n+test_expect_success 'rebase -i --root --onto ignores patch in onto' \"$(run -i)\"\n+test_expect_success 'rebase -p --root --onto ignores patch in onto' \"$(run -p)\"\n+\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' e y &&\n+\ttest_range e.. \"x y\"\n+'\n+}\n+test_expect_success 'rebase without --root works on disjoint history' \"$(run)\"\n+test_expect_failure 'rebase -m without --root works on disjoint history' \"$(run -m)\"\n+test_expect_success 'rebase -i without --root works on disjoint history' \"$(run -i)\"\n+test_expect_failure 'rebase -p without --root works on disjoint history' \"$(run -p)\"\n+\n+\n+run () {\n+echo '\n+\treset &&\n+\tgit rebase '\"$@\"' --root --onto p k &&\n+\ttest_range p.. \"f j k\"\n+'\n+}\n+test_expect_success 'rebase --root --onto with merge-base ignores --root' \"$(run)\"\n+test_expect_failure 'rebase -m --root --onto with merge-base ignores --root' \"$(run -m)\"\n+test_expect_success 'rebase -i --root --onto with merge-base ignores --root' \"$(run -i)\"\n+test_expect_success 'rebase -p --root --onto with merge-base ignores --root' \"$(run -p)\"\n+\n+test_expect_success 'rebase -p re-creates merge from upstream' '\n+\treset &&\n+\tgit rebase -p k w &&\n+\tsame_revision HEAD^ H &&\n+\tsame_revision HEAD^2 k\n+'\n+\n+test_expect_success 'rebase -p re-creates internal merge' '\n+\treset &&\n+\tgit rebase -p c w &&\n+\ttest_revisions \"f j n E H w\" HEAD~4 HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+'\n+\n+test_expect_success 'rebase -p rebuilds history around dropped commit matching upstream' '\n+\treset &&\n+\tgit rebase -p h w &&\n+\ttest_revisions \"j E n w\" HEAD~2 HEAD^2 HEAD^ HEAD\n+'\n+\n+test_expect_success 'rebase -p drops merge commit when one entire side is dropped' '\n+\treset &&\n+\tgit rebase -p p w &&\n+\ttest_range p.. \"f j n H\"\n+'\n+\n+test_expect_failure 'rebase -p --onto drops commit in <onto>' '\n+\treset &&\n+\tgit rebase -p --onto p f w &&\n+\ttest_range p.. \"j n H\"\n+'\n+\n+test_expect_success 'rebase -p with two paths to $from' '\n+\treset &&\n+\tgit rebase -p --onto c j w &&\n+\ttest_revisions \"c n E H w\" HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+'\n+\n+test_done\n-- \n1.7.11.1.104.ge7b44f1\n"},{"id":"199344","messageId":"7vzk4nojkd.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"1347949878-12578-1-git-send-email-martinvonz@gmail.com","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-18T07:51:14Z","receivedAt":"2012-09-18T07:51:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> do you agree\n> that 'rebase --onto does not re-apply patches in onto' is desirable?\n\nThis depends on how you look at --onto.  Recall the most typical and\nthe original use case of rebase:\n\n                               A'--C' your rebased work\n                              /\n  ---o---o---o---F---B'--o---T master\n     ^            \\\n     v1.7.12       A---B---C your work\n\nYou could view \"git rebase master\" as a short-hand for\n\n        $ git rebase --onto $(git merge-base master HEAD) master\n\ni.e.\n\n        $ git rebase --onto F master\n\nIf you view \"onto\" that way, you would certainly do not want to see\nB replayed on top of T, which already contains another replay of B\nin its history.\n\nThe intended use case for \"--onto\", however, is primarily to replay\na history to older base, i.e.\n\n\n       A'--B'--C' your rebased work\n      /\n  ---o---o---o---F---B'--o---T master\n     ^            \\\n     v1.7.12       A---B---C your work\n\n\n        $ git rebase --onto v1.7.12 master\n\nwhich is a moral equivalent of\n\n        $ git checkout v1.7.12\n        $ git cherry-pick A B C ;# or git cherry-pick master..HEAD\n\nYou could argue that you can compute the patch equivalence between\nthe commits in \"onto..master\" and commits in \"master..HEAD\" and\nfilter out the equivalent commits to reach the expected results in\neither cases, and at the logical level, it certainly will produce\nthe result I showed in the above illustrations.\n\nBut there are two flaws in such an argument.\n\nThe \"replay to an updated base\" case (i.e. without \"--onto\") expects\nto see duplicated commits in the updated history.  That is the only\nreason you would want to rebase---otherwise you can keep the old\nfork point and keep polishing your work and merge when it is truly\nready.  More importantly, the old master (the fork point F) and\nupdated master (the current tip T) are expected to have some\nancestry relationship between them.  For these reasons, running the\nequivalent of \"git cherry\" to filter commits with patch equivalence\nmakes perfect sense.\n\nOn the other hand, when the user replays to an older base, she has\nsome idea what constitutes \"a series\" that she is replaying (i.e.\n\"$(git merge-base master HEAD)..HEAD\").  It smells to go against the\nuser's world model if the command silently filtered commits by patch\nequivalence.  The user wanted to replay A, B and C in that case, and\nit is better to stop the process and make her inspect the history\nwhen the older base happened to have a patch-equivalent commit that\nwould cause a conflict. That would give her a chance to assess the\nsituation, instead of silently dropping some of these three commits\nthat she initially thought constitutes the series and ending up with\na series with only two commits.\n\nBesides, the whole point of a separate \"onto\" is to allow the user\nto specify a commit that does not have a straightforward ancestry\nrelationship with the bottom of the series (i.e. either \"master\" or\n\"F\"), and computation of patch equivalence is expected to be much\nhigher.  Given that it is unlikely to find any match, it feels\ndoubly wrong to always run \"git cherry\" equivalent in that case.\n\nSo I dunno, as I can argue both ways.\n\nMy gut feeling is that \"git rebase master\" and \"git rebase --onto F\nmaster\" should not be identical in this regard and an explicit\n\"onto\" should omit the patch equivalence filtering, but I can be\npersuaded otherwise with good arguments.\n\n> How about 'rebase --root is not a no-op'?\n\n  ---o---o---o---F---B'--o---T master\n     ^            \\\n     v1.7.12       A---B---C your work\n\nIf \"git rebase F\" when you are at C in the above illustration\n(reproduced only the relevant parts) is a no-op (and I think it\nshould be), \"git rebase --root\" in the illustration below ought to\nbe as well, no?\n\n                 F---B'--o---T master\n                  \\\n                   A---B---C your work\n"},{"id":"199345","messageId":"50582873.603@viscovery.net","threadId":"31582","inReplyTo":"1347949878-12578-1-git-send-email-martinvonz@gmail.com","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-09-18T07:53:23Z","receivedAt":"2012-09-18T07:53:23Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 9/18/2012 8:31, schrieb Martin von Zweigbergk:\n> Add more test cases to check that the topology after a rebase is as\n> expected. Conflicts are not considered, but patch-equivalence is.\n> ---\n> \n> Tests pass and fail as indicated by the suffix\n> (_success/_failure). Your input especially appreciated on whether you\n> agree with the intent of the test cases. For example, do you agree\n> that 'rebase --onto does not re-apply patches in onto' is desirable?\n> And if you do, then do you also agree that 'rebase --root --onto\n> ignores patch in onto' is desirable? How about 'rebase --root is not a\n> no-op'? One might think that --force would be necessary, but on the\n> other hand, if that was the case, the only point (AFAICT) of \"git\n> rebase --root <branch>\" without --force would be to linearize history,\n> so I instead made the test case confirm that --root without --onto\n> effectively behaves as if --force was also passed.\n> \n> Feedback on the structure/setup and style is of course also\n> appreciated.\n> \n>  t/t3420-rebase-topology.sh | 348 +++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 348 insertions(+)\n>  create mode 100755 t/t3420-rebase-topology.sh\n> \n> diff --git a/t/t3420-rebase-topology.sh b/t/t3420-rebase-topology.sh\n> new file mode 100755\n> index 0000000..024a2b4\n> --- /dev/null\n> +++ b/t/t3420-rebase-topology.sh\n> @@ -0,0 +1,348 @@\n> +#!/bin/sh\n> +\n> +test_description='effect of rebase on topology'\n> +. ./test-lib.sh\n> +\n> +\n> +#       q---C---r\n> +#      /\n> +# a---b---c---d!--e---p\n> +#      \\\n> +#       f---g!--h\n> +#        \\\n> +#         j-------E---k\n> +#          \\       \\\n> +#           n---H---w\n> +#\n> +# x---y---B\n> +#\n> +#\n> +# ! = empty\n> +# uppercase = cherry-picked\n> +# p = reverted e\n> +#\n> +# TODO:\n> +# prune graph to what's needed\n> +\n> +empty () {\n\nIs it \"is_empty\" or \"make_empty\"/\"empty_commit\"?\n\n> +\tgit commit --allow-empty -m $1 &&\n> +\tgit tag $1\n> +}\n\nObviously the latter.\n\n> +\n> +cherry_pick () {\n> +\tgit cherry-pick -n $1 &&\n> +\tgit commit -m $2 &&\n> +\tgit tag $2\n> +}\n> +\n> +revert () {\n> +\tgit revert -n $1 &&\n> +\tgit commit -m $2 &&\n> +\tgit tag $2\n> +}\n> +\n> +\n> +test_expect_success 'setup' '\n> +\ttest_commit a &&\n> +\ttest_commit b &&\n> +\ttest_commit c &&\n> +\tempty d &&\n> +\ttest_commit e &&\n> +\trevert e p &&\n> +\tgit checkout b &&\n> +\ttest_commit f &&\n> +\tempty g &&\n> +\ttest_commit h &&\n> +\tgit checkout f &&\n> +\ttest_commit j &&\n> +\tcherry_pick e E &&\n> +\ttest_commit k &&\n> +\tgit checkout j &&\n> +\ttest_commit n &&\n> +\tcherry_pick h H &&\n> +\tgit merge -m w E &&\n> +\tgit tag w &&\n> +\tgit checkout b &&\n> +\ttest_commit q &&\n> +\tcherry_pick c C &&\n> +\ttest_commit r &&\n> +\tgit checkout --orphan disjoint &&\n> +\tgit rm -rf . &&\n> +\ttest_commit x &&\n> +\ttest_commit y &&\n> +\tcherry_pick b B\n> +'\n> +\n> +reset () {\n> +\tgit rebase --abort\n> +\tgit reset --hard\n> +}\n\nThe 'rebase --abort' can fail, but there is no && chain. Good. Using this\nfunction instead of the individual commands in the tests does not break\nthe && chain there. Good.\n\nThese following three functions should be and can be consistent with the\norder of their arguments: expected actual.\n\n> +test_range () {\n> +\ttest \"$(git log --reverse --topo-order --format=%s \"$1\" | xargs)\" = \"$2\"\n\n\texpected=$1\n\tset -- $(git log --reverse --topo-order --format=%s \"$2\")\n\ttest \"expected\" = \"$*\"\n\n> +}\n> +\n> +test_revisions () {\n> +\texpected=\"$1\"\n> +\tshift\n> +\ttest \"$(git log --format=%s --no-walk=unsorted \"$@\" | xargs)\" = \"$expected\"\n\n\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n\ttest \"expected\" = \"$*\"\n\n> +}\n> +\n> +same_revision () {\n> +\ttest \"$(git rev-parse $1)\" = \"$(git rev-parse $2)\"\n> +}\n\n'test_same_revision'?\n\n> +\n> +# the following 5 (?) tests copy t3400 tests, but check the history rather than status code and/or stdout\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' c j &&\n> +\tsame_revision HEAD~2 c &&\n> +\ttest_range c.. \"f j\"\n> +'\n> +}\n> +test_expect_success 'simple rebase' \"$(run)\"\n> +test_expect_success 'simple rebase -m' \"$(run -m)\"\n> +test_expect_success 'simple rebase -i' \"$(run -i)\"\n> +test_expect_success 'simple rebase -p' \"$(run -p)\"\n\nSince here and in the following tests the test cases and test descriptions\nvary in the same way, wouldn't it make sense to factor the description out\nas well?\n\ntest_run_rebase () {\n\ttest_expect_success \"simple rebase $*\" \"\n\t\treset &&\n\t\tgit rebase $* c j &&\n\t\tsame_revision HEAD~2 c &&\n\t\ttest_range c.. 'f j'\n\t\"\n}\n\ntest_run_rebase ''\ntest_run_rebase -m\ntest_run_rebase -i\ntest_run_rebase -p\n\n(Watch your quoting, though.)\n\nOh, I see: some tests expect failure. How about:\n\ntest_run_rebase () {\n\tresult=$1\n\tshift\n\ttest_expect_$result \"simple rebase $*\" \"...\"\n}\ntest_run_rebase success ''\netc.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' b j &&\n> +\tsame_revision HEAD j\n> +'\n> +}\n> +test_expect_success 'rebase is no-op if upstream is an ancestor' \"$(run)\"\n> +test_expect_success 'rebase -m is no-op if upstream is an ancestor' \"$(run -m)\"\n> +test_expect_success 'rebase -i is no-op if upstream is an ancestor' \"$(run -i)\"\n> +test_expect_success 'rebase -p is no-op if upstream is an ancestor' \"$(run -p)\"\n\nOK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --force b j &&\n> +\t! same_revision HEAD j &&\n> +\ttest_range b.. \"f j\"\n> +'\n> +}\n> +test_expect_success 'rebase --force' \"$(run)\"\n> +test_expect_success 'rebase -m --force' \"$(run -m)\"\n> +test_expect_success 'rebase -i --force' \"$(run -i)\"\n> +test_expect_failure 'rebase -p --force' \"$(run -p)\"\n\nDo you mean \"rebase --force rewrites even if upstream is an ancestor\"?\nThat would make sense.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' j b &&\n> +\tsame_revision HEAD j\n> +'\n> +}\n> +test_expect_success 'rebase fast-forwards if an ancestor of upstream' \"$(run)\"\n> +test_expect_success 'rebase -m fast-forwards if an ancestor of upstream' \"$(run -m)\"\n> +test_expect_success 'rebase -i fast-forwards if an ancestor of upstream' \"$(run -i)\"\n> +test_expect_success 'rebase -p fast-forwards if an ancestor of upstream' \"$(run -p)\"\n\nOK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' p k &&\n> +\ttest_range p.. \"f j k\"\n> +'\n> +}\n> +test_expect_success 'rebase ignores patch in upstream' \"$(run)\"\n> +test_expect_failure 'rebase -m ignores patch in upstream' \"$(run -m)\"\n> +test_expect_success 'rebase -i ignores patch in upstream' \"$(run -i)\"\n> +test_expect_success 'rebase -p ignores patch in upstream' \"$(run -p)\"\n\n\"drops\" instead of \"ignores\"? OK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' c h &&\n> +\ttest_range c.. \"f h\"\n> +'\n> +}\n> +test_expect_success 'rebase ignores empty commit' \"$(run)\"\n> +test_expect_success 'rebase -m ignores empty commit' \"$(run -m)\"\n> +test_expect_success 'rebase -i ignores empty commit' \"$(run -i)\"\n> +test_expect_success 'rebase -p ignores empty commit' \"$(run -p)\"\n\n\"drops\" instead of \"ignores\"? OK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --keep-empty c h &&\n> +\ttest_range c.. \"f g h\"\n> +'\n> +}\n> +test_expect_success 'rebase --keep-empty' \"$(run)\"\n> +test_expect_failure 'rebase -m --keep-empty' \"$(run -m)\"\n> +test_expect_success 'rebase -i --keep-empty' \"$(run -i)\"\n> +test_expect_failure 'rebase -p --keep-empty' \"$(run -p)\"\n\nOK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --keep-empty p h &&\n> +\ttest_range p.. \"f g h\"\n> +'\n> +}\n> +test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' \"$(run)\"\n> +test_expect_failure 'rebase -m --keep-empty keeps empty even if already in upstream' \"$(run -m)\"\n> +test_expect_failure 'rebase -i --keep-empty keeps empty even if already in upstream' \"$(run -i)\"\n> +test_expect_failure 'rebase -p --keep-empty keeps empty even if already in upstream' \"$(run -p)\"\n\n\"is in upstream\" is decided by the patch text. If an empty commit is\nalready in upstream, this adds another one with the same or a different\ncommit message and authorship information. Dubious, but since it is\nopt-in, it should be OK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' E w &&\n> +\ttest_range E.. \"n H\"\n> +'\n> +}\n> +test_expect_success 'rebase after merge' \"$(run)\"\n> +test_expect_success 'rebase -m after merge' \"$(run -m)\"\n> +test_expect_success 'rebase -i after merge' \"$(run -i)\"\n\nOK.\n\n> +\n> +test_expect_success 'rebase -p is no-op in history with merges' '\n> +\treset &&\n> +\tgit rebase -p j w &&\n> +\tsame_revision HEAD w\n> +'\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' j w &&\n> +\ttest_range j.. \"E n H\" || test_range j.. \"n H E\"\n> +'\n\nChaining tests with || is dangerous: you do not know whether the first\nfailed because the condition is not satisfied or because of some other\nfailure.\n\nWhy is this needed in the first place? Shouldn't the history be\ndeterministic, provided that the commit timestamps are all distinct?\n\n> +}\n> +test_expect_success 'rebase of history with merges is linearized' \"$(run)\"\n> +test_expect_success 'rebase -m of history with merges is linearized' \"$(run -m)\"\n> +test_expect_success 'rebase -i of history with merges is linearized' \"$(run -i)\"\n\nOK.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --onto p h k &&\n> +\ttest_range p.. \"j k\"\n> +'\n> +}\n> +test_expect_failure 'rebase --onto does not re-apply patches in onto' \"$(run)\"\n> +test_expect_failure 'rebase -m --onto does not re-apply patches in onto' \"$(run -m)\"\n> +test_expect_failure 'rebase -i --onto does not re-apply patches in onto' \"$(run -i)\"\n> +test_expect_failure 'rebase -p --onto does not re-apply patches in onto' \"$(run -p)\"\n\nMakes sense.\n\n> +\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --onto f d r &&\n> +\ttest_range f.. \"q C r\"\n> +'\n> +}\n> +test_expect_failure 'rebase --onto does not lose patches in upstream' \"$(run)\"\n> +test_expect_success 'rebase -m --onto does not lose patches in upstream' \"$(run -m)\"\n> +test_expect_failure 'rebase -i --onto does not lose patches in upstream' \"$(run -i)\"\n> +test_expect_failure 'rebase -p --onto does not lose patches in upstream' \"$(run -p)\"\n\nMakes sense.\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --root c &&\n> +\t! same_revision HEAD c &&\n> +\ttest_range c \"a b c\"\n> +'\n> +}\n> +test_expect_success 'rebase --root is not a no-op' \"$(run)\"\n> +test_expect_success 'rebase -m --root is not a no-op' \"$(run -m)\"\n> +test_expect_success 'rebase -i --root is not a no-op' \"$(run -i)\"\n> +test_expect_success 'rebase -p --root is not a no-op' \"$(run -p)\"\n\nWhy? Is it more like \"--root implies --force\"?\n\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --root --onto e y &&\n> +\ttest_range e.. \"x y\"\n> +'\n> +}\n> +test_expect_success 'rebase --root --onto' \"$(run)\"\n> +test_expect_failure 'rebase -m --root --onto' \"$(run -m)\"\n> +test_expect_success 'rebase -i --root --onto' \"$(run -i)\"\n> +test_expect_success 'rebase -p --root --onto' \"$(run -p)\"\n\nWhere does this rebase start? Ah, --root stands in for the \"upstream\"\nargument, hence, y is the tip to rebase. Right? Then it makes sense.\n\n> +\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --root --onto e B &&\n> +\ttest_range e.. \"x y\"\n> +'\n> +}\n> +test_expect_success 'rebase --root --onto ignores patch in onto' \"$(run)\"\n> +test_expect_failure 'rebase -m --root --onto ignores patch in onto' \"$(run -m)\"\n> +test_expect_success 'rebase -i --root --onto ignores patch in onto' \"$(run -i)\"\n> +test_expect_success 'rebase -p --root --onto ignores patch in onto' \"$(run -p)\"\n\nMakes sense.\n\n> +\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' e y &&\n> +\ttest_range e.. \"x y\"\n> +'\n> +}\n> +test_expect_success 'rebase without --root works on disjoint history' \"$(run)\"\n> +test_expect_failure 'rebase -m without --root works on disjoint history' \"$(run -m)\"\n> +test_expect_success 'rebase -i without --root works on disjoint history' \"$(run -i)\"\n> +test_expect_failure 'rebase -p without --root works on disjoint history' \"$(run -p)\"\n\nOK.\n\n> +\n> +\n> +run () {\n> +echo '\n> +\treset &&\n> +\tgit rebase '\"$@\"' --root --onto p k &&\n> +\ttest_range p.. \"f j k\"\n> +'\n> +}\n> +test_expect_success 'rebase --root --onto with merge-base ignores --root' \"$(run)\"\n> +test_expect_failure 'rebase -m --root --onto with merge-base ignores --root' \"$(run -m)\"\n> +test_expect_success 'rebase -i --root --onto with merge-base ignores --root' \"$(run -i)\"\n> +test_expect_success 'rebase -p --root --onto with merge-base ignores --root' \"$(run -p)\"\n\nMakes sense.\n\n> +\n> +test_expect_success 'rebase -p re-creates merge from upstream' '\n> +\treset &&\n> +\tgit rebase -p k w &&\n> +\tsame_revision HEAD^ H &&\n> +\tsame_revision HEAD^2 k\n> +'\n\nIMO, this tests the wrong thing. You have this history:\n\n ---j-------E---k\n     \\       \\\n      n---H---w\n\nwhere E is the second parent of w. What does it mean to rebase w onto k?\nIMO, it is a meaningless operation, and the outcome is irrelevant.\n\nIt would make sense to test that this history results after the upstream\nat H moved forward:\n\n ---j-------E---k\n     \\       \\\n      n---H   \\\n           \\   \\\n            z---w'\n\nThat is, w began a topic by mergeing the sidebranch E; then upstream\nadvanced to z, and now you rebase the topic to the new upstream.\n\n> +\n> +test_expect_success 'rebase -p re-creates internal merge' '\n> +\treset &&\n> +\tgit rebase -p c w &&\n> +\ttest_revisions \"f j n E H w\" HEAD~4 HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n\nYou must also test for c; otherwise the test would succeed if rebase did\nnothing at all.\n\nThis comment applies to all other tests as well, even the \"regular\" rebase\ntests above. (But I noticed only when I read this test.)\n\n> +'\n> +\n> +test_expect_success 'rebase -p rebuilds history around dropped commit matching upstream' '\n> +\treset &&\n> +\tgit rebase -p h w &&\n> +\ttest_revisions \"j E n w\" HEAD~2 HEAD^2 HEAD^ HEAD\n> +'\n> +\n> +test_expect_success 'rebase -p drops merge commit when one entire side is dropped' '\n> +\treset &&\n> +\tgit rebase -p p w &&\n> +\ttest_range p.. \"f j n H\"\n> +'\n> +\n> +test_expect_failure 'rebase -p --onto drops commit in <onto>' '\n> +\treset &&\n> +\tgit rebase -p --onto p f w &&\n> +\ttest_range p.. \"j n H\"\n> +'\n> +\n> +test_expect_success 'rebase -p with two paths to $from' '\n> +\treset &&\n> +\tgit rebase -p --onto c j w &&\n> +\ttest_revisions \"c n E H w\" HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n> +'\n\nI didn't look at these remaining -p tests because I ran out of time.\n\n\nAfter this plethora of tests, can we get rid of some or many from other\ntest scripts? (t34* tests are the ones that take the longest on Windows to\nrun.)\n\nA nice summary of the rebase behavior. I like it.\n\n-- Hannes\n"},{"id":"199671","messageId":"CANiSa6iQsxWYHTRDGNg_h77rr3Y1cL_di-Z3zzR4gZvcRHtVqQ@mail.gmail.com","threadId":"31582","inReplyTo":"7vzk4nojkd.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-21T17:06:58Z","receivedAt":"2012-09-21T17:06:58Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Tue, Sep 18, 2012 at 12:51 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Martin von Zweigbergk <martinvonz@gmail.com> writes:\n>\n>> do you agree\n>> that 'rebase --onto does not re-apply patches in onto' is desirable?\n>\n> This depends on how you look at --onto.  Recall the most typical and\n> the original use case of rebase:\n>\n>                                A'--C' your rebased work\n>                               /\n>   ---o---o---o---F---B'--o---T master\n>      ^            \\\n>      v1.7.12       A---B---C your work\n>\n> You could view \"git rebase master\" as a short-hand for\n>\n>         $ git rebase --onto $(git merge-base master HEAD) master\n\nExactly. I frequently consider it a short-hand for that. It might\nbe worth pointing out that 'git pull --rebase', which might be\none of the most frequent uses of rebase, internally often does\n\n  git rebase --onto upstream upstream@{...} branch\n\nwhere upstream@{...} is the most recent upstream that is an\nancestor of \"branch\". For example, if your work is based on\norigin/pu and you send the bottom-most patch (\"B\" in the figure\nbelow) to the maintainer and and it gets applied to\npu. Running \"git pull --rebase\" would then lead to\n\"git rebase --onto T A\". You would want this to drop B.\n\n                               C' your rebased work\n                              /\n  ---o---o---o---F---B'--o---T origin/pu\n                  \\\n                   A origin/pu@{1}\n                    \\\n                     B---C your work\n\n\n> The intended use case for \"--onto\", however, is primarily to replay\n> a history to older base, i.e. [...] a moral equivalent of\n>\n>         $ git checkout v1.7.12\n>         $ git cherry-pick A B C ;# or git cherry-pick master..HEAD\n\nYes, this is the alternative way of looking it at and exactly why\nI, too, was not sure how it should behave.\n\n> You could argue that you can compute the patch equivalence between\n> the commits in \"onto..master\" and commits in \"master..HEAD\" and\n> filter out the equivalent commits\n\nI'm not sure if you meant \"master..onto\" rather\nthan \"onto..master\". Rebase (well, all flavors of rebase\nbut \"-m\") currently drops patches from \"master..HEAD\" that are\nalso in \"HEAD..master\". This is what the \"rebase --onto does not\nlose patches in upstream\" test is about. It is also one of the\nmain problems that I try to fix in my long-stalled rebase-range\nseries. I think we should drop patches in \"master..HEAD\" that are\nalso in \"HEAD..onto\" (which is almost the same\nas \"master..onto\").\n\n> The \"replay to an updated base\" case (i.e. without \"--onto\")\n\nOr _with_ --onto as in the above example from \"git pull --rebase\".\n\n> On the other hand, when the user replays to an older base, she has\n> some idea what constitutes \"a series\" that she is replaying (i.e.\n> \"$(git merge-base master HEAD)..HEAD\").  It smells to go against the\n> user's world model if the command silently filtered commits by patch\n> equivalence.\n\nIf it's truly about rebasing onto an older base, there can't\npossibly be any patches in \"HEAD..onto\", so assuming you agree\nwith my reasoning above that those are the patches we should\ndrop, rebasing onto older history would be safe.\n\n> Besides, the whole point of a separate \"onto\" is to allow the user\n> to specify a commit that does not have a straightforward ancestry\n> relationship with the bottom of the series (i.e. either \"master\" or\n> \"F\"), and computation of patch equivalence is expected to be much\n> higher.  Given that it is unlikely to find any match, it feels\n> doubly wrong to always run \"git cherry\" equivalent in that case.\n\nYes, this was my only concern (apart from it possibly being\nconceptually wrong to do, depending on what the user meant by\nissuing the command).\n\n>> How about 'rebase --root is not a no-op'?\n>\n>   ---o---o---o---F---B'--o---T master\n>      ^            \\\n>      v1.7.12       A---B---C your work\n>\n> If \"git rebase F\" when you are at C in the above illustration\n> (reproduced only the relevant parts) is a no-op (and I think it\n> should be), \"git rebase --root\" in the illustration below ought to\n> be as well, no?\n>\n>                  F---B'--o---T master\n>                   \\\n>                    A---B---C your work\n\nYeah, that's what I thought as well at first. I think my test\ncase even started out as \"rebase --root _is_ a no-op\".\n\nWhen thinking about how to handle roots in general, I often\nimagine a single virtual root commit (parent of all \"initial\"\ncommits), and that reasoning also implies that \"git rebase\n--root\" should be a no-op. Then I saw that the test case\nfailed (or perhaps I remembered how it is implemented with the\nclever fake root/initial commit) and started thinking about why\nanyone would use \"git rebase --root\" if it was a no-op. I could\nonly think of using it to linearize history, but that doesn't\nseem like a very likely use case. So it seems like weighing\npurity/correctness against usefulness to me. I'm not sure which\nway to go.\n\nThanks for quick and detailed feedback on an RFC patch.\n\nMartin\n"},{"id":"199954","messageId":"CANiSa6i+A6fkWpkPMXiBRdT48LaSfPe2yki+AmWFAKYg02p=+g@mail.gmail.com","threadId":"31582","inReplyTo":"50582873.603@viscovery.net","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-26T17:07:57Z","receivedAt":"2012-09-26T17:07:57Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"[+Chris Webb regarding \"git rebase --root\"]\n\nFirst of all, thanks for a meticulous review!\n\nOn Tue, Sep 18, 2012 at 12:53 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 9/18/2012 8:31, schrieb Martin von Zweigbergk:\n>\n> Since here and in the following tests the test cases and test descriptions\n> vary in the same way, wouldn't it make sense to factor the description out\n> as well?\n\nDefinitely. I just couldn't think of a good way of doing it, so thanks\nfor great and concrete suggestions!\n\n> (Watch your quoting, though.)\n\nSwitched to putting the test body in double quotes as you suggested in\nyour examples and used single quotes for strings within the test body.\n\n>> +run () {\n>> +echo '\n>> +     reset &&\n>> +     git rebase '\"$@\"' --keep-empty p h &&\n>> +     test_range p.. \"f g h\"\n>> +'\n>> +}\n>> +test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' \"$(run)\"\n>> +test_expect_failure 'rebase -m --keep-empty keeps empty even if already in upstream' \"$(run -m)\"\n>> +test_expect_failure 'rebase -i --keep-empty keeps empty even if already in upstream' \"$(run -i)\"\n>> +test_expect_failure 'rebase -p --keep-empty keeps empty even if already in upstream' \"$(run -p)\"\n>\n> \"is in upstream\" is decided by the patch text. If an empty commit is\n> already in upstream, this adds another one with the same or a different\n> commit message and authorship information. Dubious, but since it is\n> opt-in, it should be OK.\n\nYes, it is a little dubious. See\nhttp://thread.gmane.org/gmane.comp.version-control.git/203097/focus=203159\nand Junio's answer, which I think makes sense.\n\n>> +run () {\n>> +echo '\n>> +     reset &&\n>> +     git rebase '\"$@\"' j w &&\n>> +     test_range j.. \"E n H\" || test_range j.. \"n H E\"\n>> +'\n>\n> Chaining tests with || is dangerous: you do not know whether the first\n> failed because the condition is not satisfied or because of some other\n> failure.\n\nGood point. Thanks.\n\n> Why is this needed in the first place? Shouldn't the history be\n> deterministic, provided that the commit timestamps are all distinct?\n\nIt may be deterministic, but it's not specified, I think, so I didn't\nwant to depend on the order. Thinking more about it, though, I think\nit's good to protect the current behavior from patches that change the\norder of the parents. Although it may not be incorrect to change the\norder, it would at least protect against accidental changes.\n\nIt turns out that \"rebase -i\" goes through the commits in\n--topo-order, while the others use default order, I think. Which\nflavor should pass the test case and which should fail (and be fixed)?\nI would personally prefer to say that \"rebase -i\" is correct in using\n--topo-order and that the others should be fixed. Again, it's not\nspecified, but I would hate to have them behave differently.\n\n>> +run () {\n>> +echo '\n>> +     reset &&\n>> +     git rebase '\"$@\"' --root c &&\n>> +     ! same_revision HEAD c &&\n>> +     test_range c \"a b c\"\n>> +'\n>> +}\n>> +test_expect_success 'rebase --root is not a no-op' \"$(run)\"\n>> +test_expect_success 'rebase -m --root is not a no-op' \"$(run -m)\"\n>> +test_expect_success 'rebase -i --root is not a no-op' \"$(run -i)\"\n>> +test_expect_success 'rebase -p --root is not a no-op' \"$(run -p)\"\n>\n> Why? Is it more like \"--root implies --force\"?\n\nIt doesn't currently exactly imply --force, but the effect is the\nsame. Also see my reply to Junio's email in this thread.\n\nMaybe Chris has some thoughts on this?\n\n>> +run () {\n>> +echo '\n>> +     reset &&\n>> +     git rebase '\"$@\"' --root --onto e y &&\n>> +     test_range e.. \"x y\"\n>> +'\n>> +}\n>> +test_expect_success 'rebase --root --onto' \"$(run)\"\n>> +test_expect_failure 'rebase -m --root --onto' \"$(run -m)\"\n>> +test_expect_success 'rebase -i --root --onto' \"$(run -i)\"\n>> +test_expect_success 'rebase -p --root --onto' \"$(run -p)\"\n>\n> Where does this rebase start? Ah, --root stands in for the \"upstream\"\n> argument, hence, y is the tip to rebase. Right? Then it makes sense.\n\nThanks for pointing that out. I changed the order to \"git rebase\n--onto e --root y\". I hope that makes it clearer.\n\n>> +test_expect_success 'rebase -p re-creates merge from upstream' '\n>> +     reset &&\n>> +     git rebase -p k w &&\n>> +     same_revision HEAD^ H &&\n>> +     same_revision HEAD^2 k\n>> +'\n>\n> IMO, this tests the wrong thing. You have this history:\n>\n>  ---j-------E---k\n>      \\       \\\n>       n---H---w\n>\n> where E is the second parent of w. What does it mean to rebase w onto k?\n> IMO, it is a meaningless operation, and the outcome is irrelevant.\n>\n> It would make sense to test that this history results after the upstream\n> at H moved forward:\n>\n>  ---j-------E---k\n>      \\       \\\n>       n---H   \\\n>            \\   \\\n>             z---w'\n>\n> That is, w began a topic by mergeing the sidebranch E; then upstream\n> advanced to z, and now you rebase the topic to the new upstream.\n\nFair enough. Changed accordingly.\n\n>> +test_expect_success 'rebase -p re-creates internal merge' '\n>> +     reset &&\n>> +     git rebase -p c w &&\n>> +     test_revisions \"f j n E H w\" HEAD~4 HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n>\n> You must also test for c; otherwise the test would succeed if rebase did\n> nothing at all.\n>\n> This comment applies to all other tests as well, even the \"regular\" rebase\n> tests above. (But I noticed only when I read this test.)\n\nI did this only in one or two places thinking that that would be\nenough to make sure that rebase is not normally a no-op. But I think\nyou are right that we should check it most of the time. It turns out\nthat doing this caught a case where the rebase did do something and\nthe right patches were in \"c..\" (or whatever it was; I forgot which\ntest case), but the new base was not \"c\".\n\n> After this plethora of tests, can we get rid of some or many from other\n> test scripts? (t34* tests are the ones that take the longest on Windows to\n> run.)\n\nI was afraid that this file would be the slowest of all and it might\nvery well be :-(. But, yes, it does replace a few test cases. I will\nsend out an updated version of the patch later. That version should\ndelete a few existing test cases as well.\n\nI am having trouble finding enough time to get the patch into shape,\nbut I didn't want to put off this reply for any longer.\n\nMartin\n"},{"id":"200007","messageId":"20120927122035.GL16059@arachsys.com","threadId":"31582","inReplyTo":"CANiSa6i+A6fkWpkPMXiBRdT48LaSfPe2yki+AmWFAKYg02p=+g@mail.gmail.com","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Chris Webb","fromEmail":"chris@arachsys.com","sentAt":"2012-09-27T12:20:35Z","receivedAt":"2012-09-27T12:20:35Z","isPatch":true,"sender":{"key":"chris@arachsys.com","avatar":"https://avatars.githubusercontent.com/u/299056?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> On Tue, Sep 18, 2012 at 12:53 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>\n> > Why? Is it more like \"--root implies --force\"?\n> \n> It doesn't currently exactly imply --force, but the effect is the\n> same. Also see my reply to Junio's email in this thread.\n> \n> Maybe Chris has some thoughts on this?\n\nHi Martin and Johannes. Sorry for the slow follow-up here.\n\nYou're right that rebase --root without --onto always creates a brand new\nroot as a result of the implementation using a sentinel commit. Clearly this\nis what's wanted with --interactive, but rebase --root with neither --onto\nnor --interactive is a slightly odd combination for which I struggle to\nimagine a natural use. Perhaps you're right that for consistency it should\nbe a no-op unless --force-rebase is given?\n\nIf we did this, this combination would be a no-op unconditionally as by\ndefinition we're always descended from the root of our current commit.\nHowever, given the not-very-useful behaviour, I suspect that rebase --root\nis much more likely to be a mistyped version of rebase -i --root than rebase\n--root --force-rebase. (Unless I'm missing a reasonable use for this?\nHistory linearisation perhaps?)\n\nBest wishes,\n\nChris.\n"},{"id":"200118","messageId":"CANiSa6hvs2253yb4s0PpaAfG=hoBK2psP896GMFWT-UjiPZDwA@mail.gmail.com","threadId":"31582","inReplyTo":"20120927122035.GL16059@arachsys.com","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2012-09-28T18:03:19Z","receivedAt":"2012-09-28T18:03:19Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Thu, Sep 27, 2012 at 5:20 AM, Chris Webb <chris@arachsys.com> wrote:\n> You're right that rebase --root without --onto always creates a brand new\n> root as a result of the implementation using a sentinel commit. Clearly this\n> is what's wanted with --interactive\n\nThat's not as clear as one might first think. \"git rebase -i\" actually\nhonors --force; if one marks a commit for \"edit\", but then --continue\nwithout making any changes, the next commit(s) will be fast-forwarded.\nSee the first few lines of pick_one (or pick_one_preserving_merges).\n\n> but rebase --root with neither --onto\n> nor --interactive is a slightly odd combination for which I struggle to\n> imagine a natural use. Perhaps you're right that for consistency it should\n> be a no-op unless --force-rebase is given?\n>\n> If we did this, this combination would be a no-op unconditionally as by\n> definition we're always descended from the root of our current commit.\n\nFor consistency, it seems like \"git rebase -p --root\" should always be\na no-op, while \"git rebase [-i/-m] --root\" should be no-op if the\nhistory has no merges. Also, since \"git rebase -i\" tries to\nfast-forward through existing commits, it seems like \"git rebase -i\n--root\" should ideally not create a sentinel commit, but instead stop\nat the first commit marked for editing.\n\nIf, OTOH, --force-rebase is given, we should rewrite history from the\nfirst commit, which in the case of --root would mean creating a\nsentinel commit.\n\nSo, in short, I have a feeling that the sentinel commit should be\ncreated if and only if both --root and --force-rebase (but not --onto)\nare given.\n\n> However, given the not-very-useful behaviour, I suspect that rebase --root\n> is much more likely to be a mistyped version of rebase -i --root than rebase\n> --root --force-rebase. (Unless I'm missing a reasonable use for this?\n> History linearisation perhaps?)\n\nYes, the \"not-very-useful\"-ness of this is the clear argument against\nmaking them no-ops. But I have to say I was slightly surprised when I\ntried \"git rebase --root\" for the first time and it created completely\nnew history for me. As you say, \"git rebase --root\" is probably often\na mistyped \"git rebase -i --root\", and if that is the case, it seems\nnicer (in addition to being more consistent) if we don't do anything\nrather than rewriting the history. The history rewriting might even go\nunnoticed and come as an unpleasant surprise later.\n\nWhen working on a new project, \"git rebase -i --root\" might even be a\nconvenient replacement for \"git rebase -i <initial commit>\" even when\none does not want to rewrite the initial commit itself, and in such a\ncase, the user would clearly not want a sentinel commit either.\n\nSo I'm getting more and more convinced that the sentinel commit should\nonly be created if --force-rebase was given. Let me know if I'm\nmissing something.\n\nMartin\n"},{"id":"200170","messageId":"20120929080805.GN2792@arachsys.com","threadId":"31582","inReplyTo":"CANiSa6hvs2253yb4s0PpaAfG=hoBK2psP896GMFWT-UjiPZDwA@mail.gmail.com","subject":"Re: [RFC PATCH] add t3420-rebase-topology","fromName":"Chris Webb","fromEmail":"chris@arachsys.com","sentAt":"2012-09-29T08:08:06Z","receivedAt":"2012-09-29T08:08:06Z","isPatch":true,"sender":{"key":"chris@arachsys.com","avatar":"https://avatars.githubusercontent.com/u/299056?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> For consistency, it seems like \"git rebase -p --root\" should always be\n> a no-op, while \"git rebase [-i/-m] --root\" should be no-op if the\n> history has no merges. Also, since \"git rebase -i\" tries to\n> fast-forward through existing commits, it seems like \"git rebase -i\n> --root\" should ideally not create a sentinel commit, but instead stop\n> at the first commit marked for editing.\n> \n> If, OTOH, --force-rebase is given, we should rewrite history from the\n> first commit, which in the case of --root would mean creating a\n> sentinel commit.\n> \n> So, in short, I have a feeling that the sentinel commit should be\n> created if and only if both --root and --force-rebase (but not --onto)\n> are given.\n[...]\n> So I'm getting more and more convinced that the sentinel commit should\n> only be created if --force-rebase was given. Let me know if I'm\n> missing something.\n\nNo, that sounds fairly convincing to me. Personally, the only behaviour I\nwant to be able to get at without --force-rebase is for rebase -i --root to\nallow the root commit to be dropped, edited or reworded, and commits to\nreordered to make a different one the root, in the same way as normal\ninteractive rebase does for later commits.\n\nThe least intrusive implementation for rebase --root was the unconditional\nsentinel, but as you say, you don't need it (and it's a bit surprising) if\nthe root commit on the instruction sheet is the same as the original root:\nin the edit/reword case, you could just checkout the existing root and then\ndrop out in the normal way. You only really need the sentinel to deal with\nthe possibility of a conflict if the root is replaced with a different\ncommit.\n\nI think I agree with you it would be better only to create the sentinel on\ndemand when it's required or if --force is given.\n\nCheers,\n\nChris.\n"},{"id":"218773","messageId":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1347949878-12578-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 0/7] Rebase topology test","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:25Z","receivedAt":"2013-05-29T06:39:25Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"After way too long, here is finally a new version of the tests I sent\nat: http://thread.gmane.org/gmane.comp.version-control.git/205796.\n\nI have split the test up into two files. They stil take quite some\ntime to run.\n\nMartin von Zweigbergk (7):\n  add simple tests of consistency across rebase types\n  add tests for rebasing with patch-equivalence present\n  add tests for rebasing of empty commits\n  add tests for rebasing root\n  add tests for rebasing merged history\n  t3406: modernize style\n  tests: move test for rebase messages from t3400 to t3406\n\n t/lib-rebase.sh                   |  32 ++++\n t/t3400-rebase.sh                 |  53 +-----\n t/t3401-rebase-partial.sh         |  69 --------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3406-rebase-message.sh         |  50 +++---\n t/t3409-rebase-preserve-merges.sh |  53 ------\n t/t3420-rebase-topology-linear.sh | 350 ++++++++++++++++++++++++++++++++++++++\n t/t3425-rebase-topology-merges.sh | 250 +++++++++++++++++++++++++++\n 8 files changed, 664 insertions(+), 203 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3420-rebase-topology-linear.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218767","messageId":"1369809572-24431-2-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:26Z","receivedAt":"2013-05-29T06:39:26Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Helped-by: Johannes Sixt <j6t@kdbg.org>\n---\n t/lib-rebase.sh                   | 15 ++++++++\n t/t3420-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 93 insertions(+)\n create mode 100755 t/t3420-rebase-topology-linear.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 6ccf797..62b3887 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -65,3 +65,18 @@ EOF\n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n \tchmod a+x fake-editor.sh\n }\n+\n+# checks that the revisions in \"$2\" represent a linear range with the\n+# subjects in \"$1\"\n+test_linear_range () {\n+\t! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n+\texpected=$1\n+\tset -- $(git log --reverse --format=%s \"$2\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+reset_rebase () {\n+\tgit rebase --abort # may fail; ignore exit code\n+\tgit reset --hard &&\n+\tgit clean -f\n+}\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nnew file mode 100755\nindex 0000000..c4b32db\n--- /dev/null\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+test_description='basic rebase topology tests'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+test_expect_success 'setup' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"simple rebase $*\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c e &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd e' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* is no-op if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* b e &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f b e &&\n+\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev b HEAD~2 &&\n+\t\ttest_linear_range 'd e' b..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* fast-forwards if an ancestor of upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e b &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218772","messageId":"1369809572-24431-3-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:27Z","receivedAt":"2013-05-29T06:39:27Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/lib-rebase.sh                   | 17 ++++++++\n t/t3420-rebase-topology-linear.sh | 85 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 62b3887..16eeb1c 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -80,3 +80,20 @@ reset_rebase () {\n \tgit reset --hard &&\n \tgit clean -f\n }\n+\n+cherry_pick () {\n+\tgit cherry-pick -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+revert () {\n+\tgit revert -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+make_empty () {\n+\tgit commit --allow-empty -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex c4b32db..1152491 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -75,4 +75,89 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for range selection tests' '\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h i &&\n+\t\ttest_cmp_rev h HEAD~2 &&\n+\t\ttest_linear_range 'd i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* can drop last patch if in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h G &&\n+\t\ttest_cmp_rev h HEAD^ &&\n+\t\ttest_linear_range 'd' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto does not lose patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto f h i &&\n+\t\ttest_cmp_rev f HEAD~3 &&\n+\t\ttest_linear_range 'd G i' f..\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase success -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto drops patches in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto h f i &&\n+\t\ttest_cmp_rev h HEAD~2 &&\n+\t\ttest_linear_range 'd i' h..\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218769","messageId":"1369809572-24431-4-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 3/7] add tests for rebasing of empty commits","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:28Z","receivedAt":"2013-05-29T06:39:28Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3401-rebase-partial.sh         | 24 ----------------\n t/t3420-rebase-topology-linear.sh | 58 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 58 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\nindex 58f4823..7ba1797 100755\n--- a/t/t3401-rebase-partial.sh\n+++ b/t/t3401-rebase-partial.sh\n@@ -42,28 +42,4 @@ test_expect_success 'rebase --merge topic branch that was partially merged upstr\n \ttest_path_is_missing .git/rebase-merge\n '\n \n-test_expect_success 'rebase ignores empty commit' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m empty &&\n-\ttest_commit D &&\n-\tgit rebase C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\"\n-'\n-\n-test_expect_success 'rebase --keep-empty' '\n-\tgit reset --hard D &&\n-\tgit rebase --keep-empty C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\n-empty\"\n-'\n-\n-test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m also-empty &&\n-\tgit rebase --keep-empty D &&\n-\ttest \"$(git log --format=%s A..)\" = \"also-empty\n-D\n-empty\"\n-'\n-\n test_done\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex 1152491..40fe264 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -160,4 +160,62 @@ test_run_rebase failure -m\n test_run_rebase failure -i\n test_run_rebase failure -p\n \n+# a---b---c---j!\n+#      \\\n+#       d---k!--l\n+#\n+# ! = empty\n+test_expect_success 'setup of linear history for empty commit tests' '\n+\tgit checkout c &&\n+\tmake_empty j &&\n+\tgit checkout d &&\n+\tmake_empty k &&\n+\ttest_commit l\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops empty commit\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c l &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty c l &&\n+\t\ttest_cmp_rev c HEAD~3 &&\n+\t\ttest_linear_range 'd k l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty keeps empty even if already in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty j l &&\n+\t\ttest_cmp_rev j HEAD~3 &&\n+\t\ttest_linear_range 'd k l' j..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218768","messageId":"1369809572-24431-5-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 4/7] add tests for rebasing root","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:29Z","receivedAt":"2013-05-29T06:39:29Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3420-rebase-topology-linear.sh | 129 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 129 insertions(+)\n\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex 40fe264..2429aa8 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -218,4 +218,133 @@ test_run_rebase failure -m\n test_run_rebase failure -i\n test_run_rebase failure -p\n \n+#       m\n+#      /\n+# a---b---c---g\n+#\n+# x---y---B\n+#\n+# uppercase = cherry-picked\n+# m = reverted b\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for test involving root' '\n+\tgit checkout b &&\n+\trevert m b &&\n+\tgit checkout --orphan disjoint &&\n+\tgit rm -rf . &&\n+\ttest_commit x &&\n+\ttest_commit y &&\n+\tcherry_pick B b\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto c --root y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root g &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'c g' m..\n+\t\"\n+}\n+\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* m B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --root on linear history is a no-op\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --root c &&\n+\t\ttest_cmp_rev c HEAD\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f --root c &&\n+\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_linear_range 'a b c' HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218771","messageId":"1369809572-24431-6-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:30Z","receivedAt":"2013-05-29T06:39:30Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3400-rebase.sh                 |  31 +----\n t/t3401-rebase-partial.sh         |  45 -------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3409-rebase-preserve-merges.sh |  53 --------\n t/t3425-rebase-topology-merges.sh | 250 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 252 insertions(+), 137 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b58fa1a..b436ef4 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '\n \techo Side >>C &&\n \tgit add C &&\n \tgit commit -m \"Add C\" &&\n-\tgit checkout -b nonlinear my-topic-branch &&\n-\techo Edit >>B &&\n-\tgit add B &&\n-\tgit commit -m \"Modify B\" &&\n-\tgit merge side &&\n-\tgit checkout -b upstream-merged-nonlinear &&\n-\tgit merge master &&\n \tgit checkout -f my-topic-branch &&\n \tgit tag topic\n '\n@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase after merge master' '\n-\tgit checkout --detach refs/tags/topic &&\n-\tgit branch -D topic &&\n-\tgit reset --hard topic &&\n-\tgit merge master &&\n-\tgit rebase master &&\n-\t! (git show | grep \"^Merge:\")\n-'\n-\n-test_expect_success 'rebase of history with merges is linearized' '\n-\tgit checkout nonlinear &&\n-\ttest 4 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n-test_expect_success 'rebase of history with merges after upstream merge is linearized' '\n-\tgit checkout upstream-merged-nonlinear &&\n-\ttest 5 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n test_expect_success 'rebase a single mode change' '\n \tgit checkout master &&\n+\tgit branch -D topic &&\n \techo 1 >X &&\n \tgit add X &&\n \ttest_tick &&\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\ndeleted file mode 100755\nindex 7ba1797..0000000\n--- a/t/t3401-rebase-partial.sh\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland\n-#\n-\n-test_description='git rebase should detect patches integrated upstream\n-\n-This test cherry-picks one local change of two into master branch, and\n-checks that git rebase succeeds with only the second patch in the\n-local branch.\n-'\n-. ./test-lib.sh\n-\n-test_expect_success 'prepare repository with topic branch' '\n-\ttest_commit A &&\n-\tgit checkout -b my-topic-branch &&\n-\ttest_commit B &&\n-\ttest_commit C &&\n-\tgit checkout -f master &&\n-\ttest_commit A2 A.t\n-'\n-\n-test_expect_success 'pick top patch from topic branch into master' '\n-\tgit cherry-pick C &&\n-\tgit checkout -f my-topic-branch\n-'\n-\n-test_debug '\n-\tgit cherry master &&\n-\tgit format-patch -k --stdout --full-index master >/dev/null &&\n-\tgitk --all & sleep 1\n-'\n-\n-test_expect_success 'rebase topic branch against new master and check git am did not get halted' '\n-\tgit rebase master &&\n-\ttest_path_is_missing .git/rebase-apply\n-'\n-\n-test_expect_success 'rebase --merge topic branch that was partially merged upstream' '\n-\tgit reset --hard C &&\n-\tgit rebase --merge master &&\n-\ttest_path_is_missing .git/rebase-merge\n-'\n-\n-test_done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a58406d..ffcaf02 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '\n \ttest $one = $(git rev-parse HEAD~2)\n '\n \n-test_expect_success 'ignore patch if in upstream' '\n-\tHEAD=$(git rev-parse HEAD) &&\n-\tgit checkout -b has-cherry-picked HEAD^ &&\n+test_expect_success '--continue tries to commit, even for \"edit\"' '\n \techo unrelated > file7 &&\n \tgit add file7 &&\n \ttest_tick &&\n \tgit commit -m \"unrelated change\" &&\n-\tgit cherry-pick $HEAD &&\n-\tEXPECT_COUNT=1 git rebase -i $HEAD &&\n-\ttest $HEAD = $(git rev-parse HEAD^)\n-'\n-\n-test_expect_success '--continue tries to commit, even for \"edit\"' '\n \tparent=$(git rev-parse HEAD^) &&\n \ttest_tick &&\n \tFAKE_LINES=\"edit 1\" git rebase -i HEAD^ &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 6de4e22..2e0c364 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -11,14 +11,6 @@ Run \"git rebase -p\" and check that merges are properly carried along\n GIT_AUTHOR_EMAIL=bogus_email_address\n export GIT_AUTHOR_EMAIL\n \n-# Clone 1 (trivial merge):\n-#\n-# A1--A2  <-- origin/master\n-#  \\   \\\n-#   B1--M  <-- topic\n-#    \\\n-#     B2  <-- origin/topic\n-#\n # Clone 2 (conflicting merge):\n #\n # A1--A2--B3   <-- origin/master\n@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL\n #     \\--A3    <-- topic2\n #      \\\n #       B2     <-- origin/topic\n-#\n-# Clone 4 (merge using second parent as base):\n-#\n-# A1--A2--B3   <-- origin/master\n-#  \\\n-#   B1--A3--M  <-- topic\n-#    \\     /\n-#     \\--A4    <-- topic2\n-#      \\\n-#       B2     <-- origin/topic\n \n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit checkout -f master &&\n \techo Third >> A &&\n \tgit commit -a -m \"Modify A2\" &&\n-\n-\tgit clone ./. clone1 &&\n-\t(cd clone1 &&\n-\tgit checkout -b topic origin/topic &&\n-\tgit merge origin/master\n-\t) &&\n-\n-\tgit clone ./. clone4 &&\n-\t(\n-\t\tcd clone4 &&\n-\t\tgit checkout -b topic origin/topic &&\n-\t\tgit merge origin/master\n-\t) &&\n-\n \techo Fifth > B &&\n \tgit add B &&\n \tgit commit -m \"Add different B\" &&\n@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit commit -a -m \"Modify B2\"\n '\n \n-test_expect_success 'rebase -p fakes interactive rebase' '\n-\t(\n-\tcd clone1 &&\n-\tgit fetch &&\n-\tgit rebase -p origin/topic &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_expect_success '--continue works after a conflict' '\n \t(\n \tcd clone2 &&\n@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '\n \t)\n '\n \n-test_expect_success 'rebase -p works when base inside second parent' '\n-\t(\n-\tcd clone4 &&\n-\tgit fetch &&\n-\tgit rebase -p HEAD^2 &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify B\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nnew file mode 100755\nindex 0000000..0f56407\n--- /dev/null\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -0,0 +1,250 @@\n+#!/bin/sh\n+\n+test_description='rebase topology tests with merges'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+test_revision_subjects () {\n+\texpected=\"$1\"\n+\tshift\n+\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n+#\n+# uppercase = cherry-picked\n+test_expect_success 'setup of non-linear-history' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+\n+\tgit checkout d &&\n+\ttest_commit n &&\n+\ttest_commit o &&\n+\ttest_merge w e &&\n+\ttest_merge v c &&\n+\tgit checkout o &&\n+\ttest_commit z\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* after merge from upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e w &&\n+\t\ttest_cmp_rev e HEAD~2 &&\n+\t\ttest_linear_range 'n o' e..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized in place\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* d w &&\n+\t\ttest_cmp_rev d HEAD~3 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'e n o' ''\n+test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c w &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history with merges after upstream merge is linearized\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c v &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_expect_success \"rebase -p is no-op in non-linear history\" \"\n+\treset_rebase &&\n+\tgit rebase -p d w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p is no-op when base inside second parent\" \"\n+\treset_rebase &&\n+\tgit rebase -p e w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --root on non-linear history is a no-op\" \"\n+\treset_rebase &&\n+\tgit rebase -p --root w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates merge from side branch\" \"\n+\treset_rebase &&\n+\tgit rebase -p z w &&\n+\ttest_cmp_rev z HEAD^ &&\n+\ttest_cmp_rev w^2 HEAD^2\n+\"\n+\n+test_expect_success \"rebase -p re-creates internal merge\" \"\n+\treset_rebase &&\n+\tgit rebase -p c w &&\n+\ttest_revision_subjects 'c d n e o w' HEAD~4 HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p can re-create two branches on onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto c d w &&\n+\ttest_revision_subjects 'c n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#        \\       \\\n+#         e-------u\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n+\tgit checkout e &&\n+\ttest_merge u i\n+'\n+\n+test_expect_success \"rebase -p re-creates history around dropped commit matching upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p h u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --onto in merged history does not lose patches in upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto f h u &&\n+\ttest_cmp_rev f HEAD~3 &&\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history drops patches in onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto h f u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+# a---b---c---g---h\n+#      \\\n+#       d---G---s\n+#        \\   \\ /\n+#         \\   X\n+#          \\ / \\\n+#           e---t\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for dropping whole side' '\n+\tgit checkout G &&\n+\ttest_merge s e &&\n+\tgit checkout e &&\n+\ttest_merge t G\n+'\n+\n+test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h s &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+test_expect_success \"rebase -p drops merge commit when entire second-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h t &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+#        \\   \\\n+#         n---r\n+#          \\\n+#           o\n+#\n+# r = tree-same with n\n+# uppercace = cherry-picked\n+test_expect_success 'setup of non-linear-history for empty commits' '\n+\tgit checkout n &&\n+\tgit merge --no-commit e &&\n+\tgit reset n . &&\n+\tgit commit -m r &&\n+\tgit reset --hard &&\n+\tgit clean -f &&\n+\tgit tag r\n+'\n+\n+test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p c r &&\n+\ttest_revision_subjects 'c d e n r' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates empty merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p o r &&\n+\ttest_revision_subjects 'e o r' HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218766","messageId":"1369809572-24431-7-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 6/7] t3406: modernize style","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:31Z","receivedAt":"2013-05-29T06:39:31Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Update the following:\n\n - Quote 'setup'\n - Remove blank lines within test case body\n - Use test_commit instead of custom quick_one\n - Create branch \"topic\" from tag created by test_commit\n---\n t/t3406-rebase-message.sh | 30 +++++++++---------------------\n 1 file changed, 9 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex e6a9a0d..fe8c27f 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -4,27 +4,17 @@ test_description='messages from rebase operation'\n \n . ./test-lib.sh\n \n-quick_one () {\n-\techo \"$1\" >\"file$1\" &&\n-\tgit add \"file$1\" &&\n-\ttest_tick &&\n-\tgit commit -m \"$1\"\n-}\n+test_expect_success 'setup' '\n+\ttest_commit O fileO &&\n+\ttest_commit X fileX &&\n+\ttest_commit A fileA &&\n+\ttest_commit B fileB &&\n+\ttest_commit Y fileY &&\n \n-test_expect_success setup '\n-\tquick_one O &&\n-\tgit branch topic &&\n-\tquick_one X &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Y &&\n-\n-\tgit checkout topic &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Z &&\n+\tgit checkout -b topic O &&\n+\tgit cherry-pick A B &&\n+\ttest_commit Z fileZ &&\n \tgit tag start\n-\n '\n \n cat >expect <<\\EOF\n@@ -34,12 +24,10 @@ Committed: 0003 Z\n EOF\n \n test_expect_success 'rebase -m' '\n-\n \tgit rebase -m master >report &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\n-\n '\n \n test_expect_success 'rebase --stat' '\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218770","messageId":"1369809572-24431-8-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v2 7/7] tests: move test for rebase messages from t3400 to t3406","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:39:32Z","receivedAt":"2013-05-29T06:39:32Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"t3406 is supposed to test \"messages from rebase operation\", so let's\nmove tests in t3400 that fit that description into 3406. Most of the\nfunctionality they tested, except for the messages, has now been\nsubsumed by t3420.\n---\n t/t3400-rebase.sh         | 22 ----------------------\n t/t3406-rebase-message.sh | 22 ++++++++++++++++++++++\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b436ef4..45a55e9 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -59,28 +59,6 @@ test_expect_success 'rebase against master' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase against master twice' '\n-\tgit rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase against master twice with --force' '\n-\tgit rebase --force-rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date, rebase forced\" out\n-'\n-\n-test_expect_success 'rebase against master twice from another branch' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase master my-topic-branch >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase fast-forward to master' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase my-topic-branch >out &&\n-\ttest_i18ngrep \"Fast-forwarded HEAD to my-topic-branch\" out\n-'\n-\n test_expect_success 'the rebase operation should not have destroyed author information' '\n \t! (git log | grep \"Author:\" | grep \"<>\")\n '\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex fe8c27f..0392e36 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -30,6 +30,28 @@ test_expect_success 'rebase -m' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'rebase against master twice' '\n+\tgit rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase against master twice with --force' '\n+\tgit rebase --force-rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date, rebase forced\" out\n+'\n+\n+test_expect_success 'rebase against master twice from another branch' '\n+\tgit checkout topic^ &&\n+\tgit rebase master topic >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase fast-forward to master' '\n+\tgit checkout topic^ &&\n+\tgit rebase topic >out &&\n+\ttest_i18ngrep \"Fast-forwarded HEAD to topic\" out\n+'\n+\n test_expect_success 'rebase --stat' '\n \tgit reset --hard start &&\n         git rebase --stat master >diffstat.txt &&\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"218775","messageId":"51A5A992.306@viscovery.net","threadId":"31582","inReplyTo":"1369809572-24431-3-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-05-29T07:09:06Z","receivedAt":"2013-05-29T07:09:06Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n> +#       f\n> +#      /\n> +# a---b---c---g---h\n> +#      \\\n> +#       d---G---i\n...\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"rebase $* --onto drops patches in onto\" \"\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* --onto h f i &&\n> +\t\ttest_cmp_rev h HEAD~2 &&\n> +\t\ttest_linear_range 'd i' h..\n\nIsn't this expectation wrong? The upstream of the rebased branch is f, and\nit does not contain G. Hence, G should be replayed. Since h is the\nreversal of g, the state at h is the same as at c, and applying G should\nsucceed (it is the same change as g). Therefore, I think the correct\nexpectation is:\n\n\t\ttest_linear_range 'd G i' h..\n\n> +\t\"\n> +}\n> +test_run_rebase failure ''\n> +test_run_rebase failure -m\n> +test_run_rebase failure -i\n> +test_run_rebase failure -p\n\n-- Hannes\n"},{"id":"218776","messageId":"CAMP44s1a-C7upUvouH+7=Zc-V16BOxUVDv+UVzkuOt9bpip1Eg@mail.gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 0/7] Rebase topology test","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T07:10:04Z","receivedAt":"2013-05-29T07:10:04Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 1:39 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> After way too long, here is finally a new version of the tests I sent\n> at: http://thread.gmane.org/gmane.comp.version-control.git/205796.\n>\n> I have split the test up into two files. They stil take quite some\n> time to run.\n\nThis is definitely needed. I'm doing some experiments with 'git\nrebase' and I see so many problems in the code that these tests do\nexercise.\n\nI think a lot of the functionality of 'git rebase' should move to 'git\ncherry-pick', and then all the 'git rebase' code can be simplified\ngreatly, and tests like these would help a lot.\n\n-- \nFelipe Contreras\n"},{"id":"218778","messageId":"51A5AECF.6070702@viscovery.net","threadId":"31582","inReplyTo":"1369809572-24431-5-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 4/7] add tests for rebasing root","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-05-29T07:31:27Z","receivedAt":"2013-05-29T07:31:27Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* --onto m --root g &&\n> +\t\ttest_cmp_rev m HEAD~2 &&\n> +\t\ttest_linear_range 'c g' m..\n\nHere you check the outcome. There is no explicit check whether the rebase\nattempted to replay a and b. But that check is implicit: If a or b were\nattempted to replay, the rebase would have been interrupted with \"no new\nchanges\". Right?\n\n> +\t\"\n> +}\n> +\n> +test_run_rebase success ''\n> +test_run_rebase success -m\n> +test_run_rebase success -i\n> +test_run_rebase failure -p\n\nJust curious: Does the last one fail because the result is not correct or\nbecause it does go to the root?\n\n-- Hannes\n"},{"id":"218782","messageId":"51A5B4E1.3070205@viscovery.net","threadId":"31582","inReplyTo":"1369809572-24431-6-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 5/7] add tests for rebasing merged history","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-05-29T07:57:21Z","receivedAt":"2013-05-29T07:57:21Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n> +# a---b-----------c\n> +#      \\           \\\n> +#       d-------e   \\\n> +#        \\       \\   \\\n> +#         n---o---w---v\n> +#              \\\n> +#               z\n\n> +#TODO: make all flavors of rebase use --topo-order\n> +test_run_rebase success 'e n o' ''\n> +test_run_rebase success 'e n o' -m\n> +test_run_rebase success 'n o e' -i\n\nAs test_commit offers predictable timestamps, I think you can work around\nthis discrepancy by generating commits n and o before e. (That is not a\nsolution--just a workaround that depends on the current\nimplementation--because the order in which parents of a merge are listed\nis unspecified.)\n\n> +test_expect_success \"rebase -p re-creates internal merge\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p c w &&\n> +\ttest_revision_subjects 'c d n e o w' HEAD~4 HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n\nShouldn't this better be\n\n\ttest_cmp_rev c HEAD~4 &&\n\ttest_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n\nto ensure that c is not a rewritten commit?\n\n> +\"\n> +\n> +test_expect_success \"rebase -p can re-create two branches on onto\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p --onto c d w &&\n> +\ttest_revision_subjects 'c n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n> +\"\n\nSame here.\n\nTime is fleeting. I have to stop here.\n\n-- Hannes\n"},{"id":"218794","messageId":"51A5D989.90009@viscovery.net","threadId":"31582","inReplyTo":"1369809572-24431-6-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 5/7] add tests for rebasing merged history","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-05-29T10:33:45Z","receivedAt":"2013-05-29T10:33:45Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n> +#       f\n> +#      /\n> +# a---b---c---g---h\n> +#      \\\n> +#       d---G---i\n> +#        \\       \\\n> +#         e-------u\n> +#\n> +# uppercase = cherry-picked\n> +# h = reverted g\n\n> +test_expect_failure \"rebase -p --onto in merged history does not lose patches in upstream\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p --onto f h u &&\n> +\ttest_cmp_rev f HEAD~3 &&\n> +\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n> +\"\n\nMy expectations are different: When a patch is in upstream, then it is not\nto be rebased, even --onto somewhere else than upstream.\n\nBut take this with a grain of salt, as I never encounter(ed) this use-case\nin practice.\n\n> +test_expect_success \"rebase -p --onto in merged history drops patches in onto\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p --onto h f u &&\n> +\ttest_cmp_rev h HEAD~3 &&\n> +\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n> +\"\n\nAnd this is just the opposite case, where I think the patch should be kept.\n\n> +# a---b---c\n> +#      \\\n> +#       d---e\n> +#        \\   \\\n> +#         n---r\n> +#          \\\n> +#           o\n> +#\n> +# r = tree-same with n\n> +# uppercace = cherry-picked\n\nI do not see any upper-cased letters in this graph. ;)\n\n> +test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p c r &&\n> +\ttest_revision_subjects 'c d e n r' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n\nAgain, check c with test_cmp_rev.\n\n-- Hannes\n"},{"id":"218816","messageId":"CALkWK0nXgbtYXVG5tosee9eQG5ody0OvFdF9bjfAzuAoRMchow@mail.gmail.com","threadId":"31582","inReplyTo":"CAMP44s1a-C7upUvouH+7=Zc-V16BOxUVDv+UVzkuOt9bpip1Eg@mail.gmail.com","subject":"Re: [PATCH v2 0/7] Rebase topology test","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-05-29T12:50:10Z","receivedAt":"2013-05-29T12:50:10Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> I think a lot of the functionality of 'git rebase' should move to 'git\n> cherry-pick', and then all the 'git rebase' code can be simplified\n> greatly, and tests like these would help a lot.\n\nWhat do we do about the leakages?  Want to take on the task of fixing\nthe merge-recursive machinery?\n\nCf. $gmane/222887\n"},{"id":"218839","messageId":"CAMP44s2nJD1wLRY8JRQOdcmnMjtrFK852qCJtWS0N2GPE8Q1tA@mail.gmail.com","threadId":"31582","inReplyTo":"CALkWK0nXgbtYXVG5tosee9eQG5ody0OvFdF9bjfAzuAoRMchow@mail.gmail.com","subject":"Re: [PATCH v2 0/7] Rebase topology test","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T13:54:07Z","receivedAt":"2013-05-29T13:54:07Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 7:50 AM, Ramkumar Ramachandra\n<artagnon@gmail.com> wrote:\n> Felipe Contreras wrote:\n>> I think a lot of the functionality of 'git rebase' should move to 'git\n>> cherry-pick', and then all the 'git rebase' code can be simplified\n>> greatly, and tests like these would help a lot.\n>\n> What do we do about the leakages?  Want to take on the task of fixing\n> the merge-recursive machinery?\n>\n> Cf. $gmane/222887\n\nHmm, I saw that, but I also saw the fix.\n\nAnyway, if this is such a big issue, I'm sure it should be possible to\ntrigger it in our test frameework.\n\n-- \nFelipe Contreras\n"},{"id":"218936","messageId":"CANiSa6joMXeh7HoGAFXskdXaPZjN+0uHrtN7V85FyQHTGCwZMQ@mail.gmail.com","threadId":"31582","inReplyTo":"51A5A992.306@viscovery.net","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-30T05:30:49Z","receivedAt":"2013-05-30T05:30:49Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>> +#       f\n>> +#      /\n>> +# a---b---c---g---h\n>> +#      \\\n>> +#       d---G---i\n> ...\n>> +test_run_rebase () {\n>> +     result=$1\n>> +     shift\n>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>> +             reset_rebase &&\n>> +             git rebase $* --onto h f i &&\n>> +             test_cmp_rev h HEAD~2 &&\n>> +             test_linear_range 'd i' h..\n>\n> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n> it does not contain G. Hence, G should be replayed. Since h is the\n> reversal of g, the state at h is the same as at c, and applying G should\n> succeed (it is the same change as g). Therefore, I think the correct\n> expectation is:\n>\n>                 test_linear_range 'd G i' h..\n\nGood question! It is really not obvious what the right answer is. Some\narguments in favor of dropping 'G':\n\n1. Let's say origin/master points to 'b' when you start the 'd G i'\nbranch. You then send the 'G' patch to Junio who applies it as 'g'\n(cherry-picking direction is reversed compared to figure, but same\neffect). You then \"git pull --rebase\" when master on origin points to\n'h'. Because of the cleverness in 'git pull --rebase', it issues 'git\nrebase --onto h b i'. In this case it's clearly useful to have the\npatch dropped.\n\n2. In the test a little before the above one, we instead do 'git\nrebase --onto f h i' and make sure that the 'G' is _not_ lost. In that\ncase it doesn't matter what's in $branch..$upstream. Do we agree that\n$branch..$upstream should never matter (instead, $upstream is only\nused to find merge base with $branch)? Do we also agree that 'git\nrebase a b' should be identical to 'git rebase --onto a a b'? Because\n'git rebase h i' should clearly drop 'G', then so should 'git rebase\n--onto h h i'. Then, if we agreed that $branch..$upstream doesn't\nmatter, 'git rebase --onto h f i' should behave the same, no?\n\n\nThe set of commits to rebase that I was thinking of using was\n\"$upstream..$branch, unless equivalent with patch in $branch..$onto\".\nBut I'm not very confident about my conclusions above :-)\n\n\nMartin\n"},{"id":"218937","messageId":"CAMP44s0x8e2xpycOEswnYDBM5WKn=fCp7hcUEniARGVZUw1XkQ@mail.gmail.com","threadId":"31582","inReplyTo":"CANiSa6joMXeh7HoGAFXskdXaPZjN+0uHrtN7V85FyQHTGCwZMQ@mail.gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-30T05:41:17Z","receivedAt":"2013-05-30T05:41:17Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, May 30, 2013 at 12:30 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>> +#       f\n>>> +#      /\n>>> +# a---b---c---g---h\n>>> +#      \\\n>>> +#       d---G---i\n>> ...\n>>> +test_run_rebase () {\n>>> +     result=$1\n>>> +     shift\n>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>> +             reset_rebase &&\n>>> +             git rebase $* --onto h f i &&\n>>> +             test_cmp_rev h HEAD~2 &&\n>>> +             test_linear_range 'd i' h..\n>>\n>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>> it does not contain G. Hence, G should be replayed. Since h is the\n>> reversal of g, the state at h is the same as at c, and applying G should\n>> succeed (it is the same change as g). Therefore, I think the correct\n>> expectation is:\n>>\n>>                 test_linear_range 'd G i' h..\n>\n> Good question! It is really not obvious what the right answer is. Some\n> arguments in favor of dropping 'G':\n\nI think the answer is obvious; G should not be dropped. Maybe it made\nsense to drop g in upstream, but d fixes an issue, and it makes sense\nto apply G on upstream.\n\nGit should not make any assumptions, if the user wants G to be\ndropped, he can easily do that by himself.\n\nI don't think it's easy to implement that code-wise, but I think the\nideal behavior is clear.\n\n-- \nFelipe Contreras\n"},{"id":"218938","messageId":"CANiSa6hMcBVcpqwbvQkCBq=fnVhUv+Va8Q_5XFQ1bjFEHERh5A@mail.gmail.com","threadId":"31582","inReplyTo":"51A5AECF.6070702@viscovery.net","subject":"Re: [PATCH v2 4/7] add tests for rebasing root","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-30T05:51:12Z","receivedAt":"2013-05-30T05:51:12Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Wed, May 29, 2013 at 12:31 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>> +test_run_rebase () {\n>> +     result=$1\n>> +     shift\n>> +     test_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n>> +             reset_rebase &&\n>> +             git rebase $* --onto m --root g &&\n>> +             test_cmp_rev m HEAD~2 &&\n>> +             test_linear_range 'c g' m..\n>\n> Here you check the outcome. There is no explicit check whether the rebase\n> attempted to replay a and b. But that check is implicit: If a or b were\n> attempted to replay, the rebase would have been interrupted with \"no new\n> changes\". Right?\n\nBecause 'm' is a reverted 'b', I think if it had gone to the root, we\nwould have seen 'b m c g' (I _think_ 'a' would be silently skipped at\nleast in am mode).\n\n>> +test_run_rebase failure -p\n>\n> Just curious: Does the last one fail because the result is not correct or\n> because it does go to the root?\n\nBecause the result is not correct; it first checks out 'm', but\nsomething goes wrong (maybe because 'm' gets written to\n/rewritten/root?) and it somehow fast-forwards to 'c' (from 'b'?).\n"},{"id":"218940","messageId":"CANiSa6hxhiFYn1atdh+zA76H=XsiAHown8Ndn0T6fXRPJEaWEw@mail.gmail.com","threadId":"31582","inReplyTo":"CAMP44s0x8e2xpycOEswnYDBM5WKn=fCp7hcUEniARGVZUw1XkQ@mail.gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-30T06:14:33Z","receivedAt":"2013-05-30T06:14:33Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Wed, May 29, 2013 at 10:41 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Thu, May 30, 2013 at 12:30 AM, Martin von Zweigbergk\n> <martinvonz@gmail.com> wrote:\n>> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>>> +#       f\n>>>> +#      /\n>>>> +# a---b---c---g---h\n>>>> +#      \\\n>>>> +#       d---G---i\n>>> ...\n>>>> +test_run_rebase () {\n>>>> +     result=$1\n>>>> +     shift\n>>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>>> +             reset_rebase &&\n>>>> +             git rebase $* --onto h f i &&\n>>>> +             test_cmp_rev h HEAD~2 &&\n>>>> +             test_linear_range 'd i' h..\n>>>\n>>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>>> it does not contain G. Hence, G should be replayed. Since h is the\n>>> reversal of g, the state at h is the same as at c, and applying G should\n>>> succeed (it is the same change as g). Therefore, I think the correct\n>>> expectation is:\n>>>\n>>>                 test_linear_range 'd G i' h..\n>>\n>> Good question! It is really not obvious what the right answer is. Some\n>> arguments in favor of dropping 'G':\n>\n> I think the answer is obvious; G should not be dropped. Maybe it made\n> sense to drop g in upstream, but d fixes an issue, and it makes sense\n> to apply G on upstream.\n\nWell, maybe I was wrong in thinking that dropping 'G' in 'git rebase\n--onto f h i' is bad. It seems to complicate things a lot, so maybe we\nshould just decide that it's fine to do that (to drop 'G' in that\ncase). Since that's mostly how it has worked forever and no one seems\nto have reported a problem with it, I'm probably just being paranoid.\nThoughts?\n"},{"id":"218941","messageId":"CAMP44s0eUWRXcXFeKyUrMwKDWcpn7dMX0km10Zpe0ZALW6T6LA@mail.gmail.com","threadId":"31582","inReplyTo":"CANiSa6hxhiFYn1atdh+zA76H=XsiAHown8Ndn0T6fXRPJEaWEw@mail.gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-30T06:40:29Z","receivedAt":"2013-05-30T06:40:29Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, May 30, 2013 at 1:14 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> On Wed, May 29, 2013 at 10:41 PM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n>> On Thu, May 30, 2013 at 12:30 AM, Martin von Zweigbergk\n>> <martinvonz@gmail.com> wrote:\n>>> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>>>> +#       f\n>>>>> +#      /\n>>>>> +# a---b---c---g---h\n>>>>> +#      \\\n>>>>> +#       d---G---i\n>>>> ...\n>>>>> +test_run_rebase () {\n>>>>> +     result=$1\n>>>>> +     shift\n>>>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>>>> +             reset_rebase &&\n>>>>> +             git rebase $* --onto h f i &&\n>>>>> +             test_cmp_rev h HEAD~2 &&\n>>>>> +             test_linear_range 'd i' h..\n>>>>\n>>>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>>>> it does not contain G. Hence, G should be replayed. Since h is the\n>>>> reversal of g, the state at h is the same as at c, and applying G should\n>>>> succeed (it is the same change as g). Therefore, I think the correct\n>>>> expectation is:\n>>>>\n>>>>                 test_linear_range 'd G i' h..\n>>>\n>>> Good question! It is really not obvious what the right answer is. Some\n>>> arguments in favor of dropping 'G':\n>>\n>> I think the answer is obvious; G should not be dropped. Maybe it made\n>> sense to drop g in upstream, but d fixes an issue, and it makes sense\n>> to apply G on upstream.\n>\n> Well, maybe I was wrong in thinking that dropping 'G' in 'git rebase\n> --onto f h i' is bad. It seems to complicate things a lot, so maybe we\n> should just decide that it's fine to do that (to drop 'G' in that\n> case). Since that's mostly how it has worked forever and no one seems\n> to have reported a problem with it, I'm probably just being paranoid.\n> Thoughts?\n\nHuh? I said the opposite; G should *not* be dropped.\n\n-- \nFelipe Contreras\n"},{"id":"218942","messageId":"CANiSa6jfXSygcPVnW_6t4mbXG=5Lt0W0NPsspXs4mF4TUETqpA@mail.gmail.com","threadId":"31582","inReplyTo":"CAMP44s0eUWRXcXFeKyUrMwKDWcpn7dMX0km10Zpe0ZALW6T6LA@mail.gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-30T06:46:08Z","receivedAt":"2013-05-30T06:46:08Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Wed, May 29, 2013 at 11:40 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Thu, May 30, 2013 at 1:14 AM, Martin von Zweigbergk\n> <martinvonz@gmail.com> wrote:\n>> On Wed, May 29, 2013 at 10:41 PM, Felipe Contreras\n>> <felipe.contreras@gmail.com> wrote:\n>>> On Thu, May 30, 2013 at 12:30 AM, Martin von Zweigbergk\n>>> <martinvonz@gmail.com> wrote:\n>>>> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>>>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>>>>> +#       f\n>>>>>> +#      /\n>>>>>> +# a---b---c---g---h\n>>>>>> +#      \\\n>>>>>> +#       d---G---i\n>>>>> ...\n>>>>>> +test_run_rebase () {\n>>>>>> +     result=$1\n>>>>>> +     shift\n>>>>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>>>>> +             reset_rebase &&\n>>>>>> +             git rebase $* --onto h f i &&\n>>>>>> +             test_cmp_rev h HEAD~2 &&\n>>>>>> +             test_linear_range 'd i' h..\n>>>>>\n>>>>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>>>>> it does not contain G. Hence, G should be replayed. Since h is the\n>>>>> reversal of g, the state at h is the same as at c, and applying G should\n>>>>> succeed (it is the same change as g). Therefore, I think the correct\n>>>>> expectation is:\n>>>>>\n>>>>>                 test_linear_range 'd G i' h..\n>>>>\n>>>> Good question! It is really not obvious what the right answer is. Some\n>>>> arguments in favor of dropping 'G':\n>>>\n>>> I think the answer is obvious; G should not be dropped. Maybe it made\n>>> sense to drop g in upstream, but d fixes an issue, and it makes sense\n>>> to apply G on upstream.\n>>\n>> Well, maybe I was wrong in thinking that dropping 'G' in 'git rebase\n>> --onto f h i' is bad. It seems to complicate things a lot, so maybe we\n>> should just decide that it's fine to do that (to drop 'G' in that\n>> case). Since that's mostly how it has worked forever and no one seems\n>> to have reported a problem with it, I'm probably just being paranoid.\n>> Thoughts?\n>\n> Huh? I said the opposite; G should *not* be dropped.\n\nI suspect you missed that I said 'git rebase --onto f h i', not 'git\nrebase --onto h f i'. Sorry, I should have pointed that out.\n"},{"id":"218988","messageId":"51A74BFC.4020900@kdbg.org","threadId":"31582","inReplyTo":"CANiSa6joMXeh7HoGAFXskdXaPZjN+0uHrtN7V85FyQHTGCwZMQ@mail.gmail.com","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2013-05-30T12:54:20Z","receivedAt":"2013-05-30T12:54:20Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 30.05.2013 07:30, schrieb Martin von Zweigbergk:\n> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>> +#       f\n>>> +#      /\n>>> +# a---b---c---g---h\n>>> +#      \\\n>>> +#       d---G---i\n>> ...\n>>> +test_run_rebase () {\n>>> +     result=$1\n>>> +     shift\n>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>> +             reset_rebase &&\n>>> +             git rebase $* --onto h f i &&\n>>> +             test_cmp_rev h HEAD~2 &&\n>>> +             test_linear_range 'd i' h..\n>>\n>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>> it does not contain G. Hence, G should be replayed. Since h is the\n>> reversal of g, the state at h is the same as at c, and applying G should\n>> succeed (it is the same change as g). Therefore, I think the correct\n>> expectation is:\n>>\n>>                 test_linear_range 'd G i' h..\n> \n> Good question! It is really not obvious what the right answer is. Some\n> arguments in favor of dropping 'G':\n> \n> 1. Let's say origin/master points to 'b' when you start the 'd G i'\n> branch. You then send the 'G' patch to Junio who applies it as 'g'\n> (cherry-picking direction is reversed compared to figure, but same\n> effect). You then \"git pull --rebase\" when master on origin points to\n> 'h'. Because of the cleverness in 'git pull --rebase', it issues 'git\n> rebase --onto h b i'.\n\nThe reason for this git pull cleverness is to be prepared for rewritten\nhistory:\n\n   b'--c'--g'--h'\n  /\n a---b\n      \\\n       d---G---i\n\nto avoid that b is rebased.\n\n> In this case it's clearly useful to have the\n> patch dropped.\n> \n> 2. In the test a little before the above one, we instead do 'git\n> rebase --onto f h i' and make sure that the 'G' is _not_ lost. In that\n> case it doesn't matter what's in $branch..$upstream. Do we agree that\n> $branch..$upstream should never matter (instead, $upstream is only\n> used to find merge base with $branch)?\n\nNo, we do not agree. $branch..$upstream should be the set of patches\nthat should be omitted. $branch..$onto should not matter. $onto is only\nused to specify the destination of the rebased commits.\n\n> Do we also agree that 'git\n> rebase a b' should be identical to 'git rebase --onto a a b'?\n\nAbsolutely!\n\n> Because\n> 'git rebase h i' should clearly drop 'G', then so should 'git rebase\n> --onto h h i'.\n\nYes!\n\n> Then, if we agreed that $branch..$upstream doesn't\n> matter, 'git rebase --onto h f i' should behave the same, no?\n\nCorrect in the mathematically logical sense. ;) But we do not agree that\n$branch..$upstream doesn't matter.\n\n> The set of commits to rebase that I was thinking of using was\n> \"$upstream..$branch, unless equivalent with patch in $branch..$onto\".\n> But I'm not very confident about my conclusions above :-)\n\nAt least the man page says that ..$upstream counts and $onto tells just\nthe new base.\n\nThe way how git pull calls rebase should be revisited, I think.\n\n-- Hannes\n"},{"id":"219016","messageId":"CANiSa6jEnzhJT3j8kYT03oz41wwbUJYgKeFFuP=kMLKCS=u97A@mail.gmail.com","threadId":"31582","inReplyTo":"51A74BFC.4020900@kdbg.org","subject":"Re: [PATCH v2 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-30T15:01:03Z","receivedAt":"2013-05-30T15:01:03Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Thu, May 30, 2013 at 5:54 AM, Johannes Sixt <j6t@kdbg.org> wrote:\n> Am 30.05.2013 07:30, schrieb Martin von Zweigbergk:\n>> On Wed, May 29, 2013 at 12:09 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>>>> +#       f\n>>>> +#      /\n>>>> +# a---b---c---g---h\n>>>> +#      \\\n>>>> +#       d---G---i\n>>> ...\n>>>> +test_run_rebase () {\n>>>> +     result=$1\n>>>> +     shift\n>>>> +     test_expect_$result \"rebase $* --onto drops patches in onto\" \"\n>>>> +             reset_rebase &&\n>>>> +             git rebase $* --onto h f i &&\n>>>> +             test_cmp_rev h HEAD~2 &&\n>>>> +             test_linear_range 'd i' h..\n>>>\n>>> Isn't this expectation wrong? The upstream of the rebased branch is f, and\n>>> it does not contain G. Hence, G should be replayed. Since h is the\n>>> reversal of g, the state at h is the same as at c, and applying G should\n>>> succeed (it is the same change as g). Therefore, I think the correct\n>>> expectation is:\n>>>\n>>>                 test_linear_range 'd G i' h..\n>>\n>> Good question! It is really not obvious what the right answer is. Some\n>> arguments in favor of dropping 'G':\n>>\n>> 1. Let's say origin/master points to 'b' when you start the 'd G i'\n>> branch. You then send the 'G' patch to Junio who applies it as 'g'\n>> (cherry-picking direction is reversed compared to figure, but same\n>> effect). You then \"git pull --rebase\" when master on origin points to\n>> 'h'. Because of the cleverness in 'git pull --rebase', it issues 'git\n>> rebase --onto h b i'.\n>\n> The reason for this git pull cleverness is to be prepared for rewritten\n> history:\n>\n>    b'--c'--g'--h'\n>   /\n>  a---b\n>       \\\n>        d---G---i\n>\n> to avoid that b is rebased.\n\nRight. It doesn't currently drop 'G' and maybe it shouldn't, so let's\nleave it as is for now, I would say.\n\n>> 2. In the test a little before the above one, we instead do 'git\n>> rebase --onto f h i' and make sure that the 'G' is _not_ lost. In that\n>> case it doesn't matter what's in $branch..$upstream. Do we agree that\n>> $branch..$upstream should never matter (instead, $upstream is only\n>> used to find merge base with $branch)?\n>\n> No, we do not agree. $branch..$upstream should be the set of patches\n> that should be omitted. $branch..$onto should not matter. $onto is only\n> used to specify the destination of the rebased commits.\n\nOk. As I said to Felipe, I'm not sure why I was so convinced that it's\nbad to lose the patch in 'git rebase --onto f h i'. It can result in\nlost work, but it seems rare enough that no one has reported it,\nAFAIK.\n\nI'll change those tests in a re-roll, and perhaps I'll drop a few of\nthem. Let me know if you (anyone) disagree.\n\n\nMartin\n\nPS. Thanks for a meticulous review!\n"},{"id":"219056","messageId":"CANiSa6gK99W=x-RXmgxqZ+UFJbps2nu0S_RApD2hAiQU2wgnQg@mail.gmail.com","threadId":"31582","inReplyTo":"51A5B4E1.3070205@viscovery.net","subject":"Re: [PATCH v2 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T05:42:46Z","receivedAt":"2013-05-31T05:42:46Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Wed, May 29, 2013 at 12:57 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/29/2013 8:39, schrieb Martin von Zweigbergk:\n>> +# a---b-----------c\n>> +#      \\           \\\n>> +#       d-------e   \\\n>> +#        \\       \\   \\\n>> +#         n---o---w---v\n>> +#              \\\n>> +#               z\n>\n>> +#TODO: make all flavors of rebase use --topo-order\n>> +test_run_rebase success 'e n o' ''\n>> +test_run_rebase success 'e n o' -m\n>> +test_run_rebase success 'n o e' -i\n>\n> As test_commit offers predictable timestamps, I think you can work around\n> this discrepancy by generating commits n and o before e. (That is not a\n> solution--just a workaround that depends on the current\n> implementation--because the order in which parents of a merge are listed\n> is unspecified.)\n\nI actually liked it as documentation of the current inconsistency and\nwith an explicit TODO.\n\nI have addressed the remainder of your comments in this and the next\nmessage. Thanks again.\n"},{"id":"219059","messageId":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 0/7] Rebase topology test","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:40Z","receivedAt":"2013-05-31T06:49:40Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Patches are now expected to be dropped iff they are on upstream. I've\nalso followed all of Johannes's other suggestions except for the one\nabout topo-order.\n\nMartin von Zweigbergk (7):\n  add simple tests of consistency across rebase types\n  add tests for rebasing with patch-equivalence present\n  add tests for rebasing of empty commits\n  add tests for rebasing root\n  add tests for rebasing merged history\n  t3406: modernize style\n  tests: move test for rebase messages from t3400 to t3406\n\n t/lib-rebase.sh                   |  32 ++++\n t/t3400-rebase.sh                 |  53 +-----\n t/t3401-rebase-partial.sh         |  69 --------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3406-rebase-message.sh         |  50 +++---\n t/t3409-rebase-preserve-merges.sh |  53 ------\n t/t3420-rebase-topology-linear.sh | 350 ++++++++++++++++++++++++++++++++++++++\n t/t3425-rebase-topology-merges.sh | 252 +++++++++++++++++++++++++++\n 8 files changed, 666 insertions(+), 203 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3420-rebase-topology-linear.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219060","messageId":"1369982987-18954-2-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:41Z","receivedAt":"2013-05-31T06:49:41Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Helped-by: Johannes Sixt <j6t@kdbg.org>\n---\n t/lib-rebase.sh                   | 15 ++++++++\n t/t3420-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 93 insertions(+)\n create mode 100755 t/t3420-rebase-topology-linear.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 6ccf797..62b3887 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -65,3 +65,18 @@ EOF\n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n \tchmod a+x fake-editor.sh\n }\n+\n+# checks that the revisions in \"$2\" represent a linear range with the\n+# subjects in \"$1\"\n+test_linear_range () {\n+\t! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n+\texpected=$1\n+\tset -- $(git log --reverse --format=%s \"$2\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+reset_rebase () {\n+\tgit rebase --abort # may fail; ignore exit code\n+\tgit reset --hard &&\n+\tgit clean -f\n+}\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nnew file mode 100755\nindex 0000000..c4b32db\n--- /dev/null\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+test_description='basic rebase topology tests'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+test_expect_success 'setup' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"simple rebase $*\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c e &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd e' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* is no-op if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* b e &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f b e &&\n+\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev b HEAD~2 &&\n+\t\ttest_linear_range 'd e' b..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* fast-forwards if an ancestor of upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e b &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219061","messageId":"1369982987-18954-3-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:42Z","receivedAt":"2013-05-31T06:49:42Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/lib-rebase.sh                   | 17 ++++++++\n t/t3420-rebase-topology-linear.sh | 85 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 62b3887..16eeb1c 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -80,3 +80,20 @@ reset_rebase () {\n \tgit reset --hard &&\n \tgit clean -f\n }\n+\n+cherry_pick () {\n+\tgit cherry-pick -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+revert () {\n+\tgit revert -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+make_empty () {\n+\tgit commit --allow-empty -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex c4b32db..75cc476 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -75,4 +75,89 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for range selection tests' '\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h i &&\n+\t\ttest_cmp_rev h HEAD~2 &&\n+\t\ttest_linear_range 'd i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* can drop last patch if in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h G &&\n+\t\ttest_cmp_rev h HEAD^ &&\n+\t\ttest_linear_range 'd' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto f h i &&\n+\t\ttest_cmp_rev f HEAD~2 &&\n+\t\ttest_linear_range 'd i' f..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto does not drop patches in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto h f i &&\n+\t\ttest_cmp_rev h HEAD~3 &&\n+\t\ttest_linear_range 'd G i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219062","messageId":"1369982987-18954-4-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 3/7] add tests for rebasing of empty commits","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:43Z","receivedAt":"2013-05-31T06:49:43Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3401-rebase-partial.sh         | 24 ----------------\n t/t3420-rebase-topology-linear.sh | 58 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 58 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\nindex 58f4823..7ba1797 100755\n--- a/t/t3401-rebase-partial.sh\n+++ b/t/t3401-rebase-partial.sh\n@@ -42,28 +42,4 @@ test_expect_success 'rebase --merge topic branch that was partially merged upstr\n \ttest_path_is_missing .git/rebase-merge\n '\n \n-test_expect_success 'rebase ignores empty commit' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m empty &&\n-\ttest_commit D &&\n-\tgit rebase C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\"\n-'\n-\n-test_expect_success 'rebase --keep-empty' '\n-\tgit reset --hard D &&\n-\tgit rebase --keep-empty C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\n-empty\"\n-'\n-\n-test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m also-empty &&\n-\tgit rebase --keep-empty D &&\n-\ttest \"$(git log --format=%s A..)\" = \"also-empty\n-D\n-empty\"\n-'\n-\n test_done\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex 75cc476..81e3d59 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -160,4 +160,62 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+# a---b---c---j!\n+#      \\\n+#       d---k!--l\n+#\n+# ! = empty\n+test_expect_success 'setup of linear history for empty commit tests' '\n+\tgit checkout c &&\n+\tmake_empty j &&\n+\tgit checkout d &&\n+\tmake_empty k &&\n+\ttest_commit l\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops empty commit\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c l &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty c l &&\n+\t\ttest_cmp_rev c HEAD~3 &&\n+\t\ttest_linear_range 'd k l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty keeps empty even if already in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty j l &&\n+\t\ttest_cmp_rev j HEAD~3 &&\n+\t\ttest_linear_range 'd k l' j..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219064","messageId":"1369982987-18954-5-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 4/7] add tests for rebasing root","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:44Z","receivedAt":"2013-05-31T06:49:44Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3420-rebase-topology-linear.sh | 129 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 129 insertions(+)\n\ndiff --git a/t/t3420-rebase-topology-linear.sh b/t/t3420-rebase-topology-linear.sh\nindex 81e3d59..659a7b3 100755\n--- a/t/t3420-rebase-topology-linear.sh\n+++ b/t/t3420-rebase-topology-linear.sh\n@@ -218,4 +218,133 @@ test_run_rebase failure -m\n test_run_rebase failure -i\n test_run_rebase failure -p\n \n+#       m\n+#      /\n+# a---b---c---g\n+#\n+# x---y---B\n+#\n+# uppercase = cherry-picked\n+# m = reverted b\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for test involving root' '\n+\tgit checkout b &&\n+\trevert m b &&\n+\tgit checkout --orphan disjoint &&\n+\tgit rm -rf . &&\n+\ttest_commit x &&\n+\ttest_commit y &&\n+\tcherry_pick B b\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto c --root y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root g &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'c g' m..\n+\t\"\n+}\n+\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* m B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --root on linear history is a no-op\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --root c &&\n+\t\ttest_cmp_rev c HEAD\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f --root c &&\n+\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_linear_range 'a b c' HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219063","messageId":"1369982987-18954-6-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:45Z","receivedAt":"2013-05-31T06:49:45Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3400-rebase.sh                 |  31 +----\n t/t3401-rebase-partial.sh         |  45 -------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3409-rebase-preserve-merges.sh |  53 --------\n t/t3425-rebase-topology-merges.sh | 252 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 254 insertions(+), 137 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b58fa1a..b436ef4 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '\n \techo Side >>C &&\n \tgit add C &&\n \tgit commit -m \"Add C\" &&\n-\tgit checkout -b nonlinear my-topic-branch &&\n-\techo Edit >>B &&\n-\tgit add B &&\n-\tgit commit -m \"Modify B\" &&\n-\tgit merge side &&\n-\tgit checkout -b upstream-merged-nonlinear &&\n-\tgit merge master &&\n \tgit checkout -f my-topic-branch &&\n \tgit tag topic\n '\n@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase after merge master' '\n-\tgit checkout --detach refs/tags/topic &&\n-\tgit branch -D topic &&\n-\tgit reset --hard topic &&\n-\tgit merge master &&\n-\tgit rebase master &&\n-\t! (git show | grep \"^Merge:\")\n-'\n-\n-test_expect_success 'rebase of history with merges is linearized' '\n-\tgit checkout nonlinear &&\n-\ttest 4 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n-test_expect_success 'rebase of history with merges after upstream merge is linearized' '\n-\tgit checkout upstream-merged-nonlinear &&\n-\ttest 5 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n test_expect_success 'rebase a single mode change' '\n \tgit checkout master &&\n+\tgit branch -D topic &&\n \techo 1 >X &&\n \tgit add X &&\n \ttest_tick &&\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\ndeleted file mode 100755\nindex 7ba1797..0000000\n--- a/t/t3401-rebase-partial.sh\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland\n-#\n-\n-test_description='git rebase should detect patches integrated upstream\n-\n-This test cherry-picks one local change of two into master branch, and\n-checks that git rebase succeeds with only the second patch in the\n-local branch.\n-'\n-. ./test-lib.sh\n-\n-test_expect_success 'prepare repository with topic branch' '\n-\ttest_commit A &&\n-\tgit checkout -b my-topic-branch &&\n-\ttest_commit B &&\n-\ttest_commit C &&\n-\tgit checkout -f master &&\n-\ttest_commit A2 A.t\n-'\n-\n-test_expect_success 'pick top patch from topic branch into master' '\n-\tgit cherry-pick C &&\n-\tgit checkout -f my-topic-branch\n-'\n-\n-test_debug '\n-\tgit cherry master &&\n-\tgit format-patch -k --stdout --full-index master >/dev/null &&\n-\tgitk --all & sleep 1\n-'\n-\n-test_expect_success 'rebase topic branch against new master and check git am did not get halted' '\n-\tgit rebase master &&\n-\ttest_path_is_missing .git/rebase-apply\n-'\n-\n-test_expect_success 'rebase --merge topic branch that was partially merged upstream' '\n-\tgit reset --hard C &&\n-\tgit rebase --merge master &&\n-\ttest_path_is_missing .git/rebase-merge\n-'\n-\n-test_done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a58406d..ffcaf02 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '\n \ttest $one = $(git rev-parse HEAD~2)\n '\n \n-test_expect_success 'ignore patch if in upstream' '\n-\tHEAD=$(git rev-parse HEAD) &&\n-\tgit checkout -b has-cherry-picked HEAD^ &&\n+test_expect_success '--continue tries to commit, even for \"edit\"' '\n \techo unrelated > file7 &&\n \tgit add file7 &&\n \ttest_tick &&\n \tgit commit -m \"unrelated change\" &&\n-\tgit cherry-pick $HEAD &&\n-\tEXPECT_COUNT=1 git rebase -i $HEAD &&\n-\ttest $HEAD = $(git rev-parse HEAD^)\n-'\n-\n-test_expect_success '--continue tries to commit, even for \"edit\"' '\n \tparent=$(git rev-parse HEAD^) &&\n \ttest_tick &&\n \tFAKE_LINES=\"edit 1\" git rebase -i HEAD^ &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 6de4e22..2e0c364 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -11,14 +11,6 @@ Run \"git rebase -p\" and check that merges are properly carried along\n GIT_AUTHOR_EMAIL=bogus_email_address\n export GIT_AUTHOR_EMAIL\n \n-# Clone 1 (trivial merge):\n-#\n-# A1--A2  <-- origin/master\n-#  \\   \\\n-#   B1--M  <-- topic\n-#    \\\n-#     B2  <-- origin/topic\n-#\n # Clone 2 (conflicting merge):\n #\n # A1--A2--B3   <-- origin/master\n@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL\n #     \\--A3    <-- topic2\n #      \\\n #       B2     <-- origin/topic\n-#\n-# Clone 4 (merge using second parent as base):\n-#\n-# A1--A2--B3   <-- origin/master\n-#  \\\n-#   B1--A3--M  <-- topic\n-#    \\     /\n-#     \\--A4    <-- topic2\n-#      \\\n-#       B2     <-- origin/topic\n \n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit checkout -f master &&\n \techo Third >> A &&\n \tgit commit -a -m \"Modify A2\" &&\n-\n-\tgit clone ./. clone1 &&\n-\t(cd clone1 &&\n-\tgit checkout -b topic origin/topic &&\n-\tgit merge origin/master\n-\t) &&\n-\n-\tgit clone ./. clone4 &&\n-\t(\n-\t\tcd clone4 &&\n-\t\tgit checkout -b topic origin/topic &&\n-\t\tgit merge origin/master\n-\t) &&\n-\n \techo Fifth > B &&\n \tgit add B &&\n \tgit commit -m \"Add different B\" &&\n@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit commit -a -m \"Modify B2\"\n '\n \n-test_expect_success 'rebase -p fakes interactive rebase' '\n-\t(\n-\tcd clone1 &&\n-\tgit fetch &&\n-\tgit rebase -p origin/topic &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_expect_success '--continue works after a conflict' '\n \t(\n \tcd clone2 &&\n@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '\n \t)\n '\n \n-test_expect_success 'rebase -p works when base inside second parent' '\n-\t(\n-\tcd clone4 &&\n-\tgit fetch &&\n-\tgit rebase -p HEAD^2 &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify B\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nnew file mode 100755\nindex 0000000..72fa76d\n--- /dev/null\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -0,0 +1,252 @@\n+#!/bin/sh\n+\n+test_description='rebase topology tests with merges'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+test_revision_subjects () {\n+\texpected=\"$1\"\n+\tshift\n+\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n+test_expect_success 'setup of non-linear-history' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+\n+\tgit checkout d &&\n+\ttest_commit n &&\n+\ttest_commit o &&\n+\ttest_merge w e &&\n+\ttest_merge v c &&\n+\tgit checkout o &&\n+\ttest_commit z\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* after merge from upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e w &&\n+\t\ttest_cmp_rev e HEAD~2 &&\n+\t\ttest_linear_range 'n o' e..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized in place\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* d w &&\n+\t\ttest_cmp_rev d HEAD~3 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'e n o' ''\n+test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c w &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history with merges after upstream merge is linearized\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c v &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_expect_success \"rebase -p is no-op in non-linear history\" \"\n+\treset_rebase &&\n+\tgit rebase -p d w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p is no-op when base inside second parent\" \"\n+\treset_rebase &&\n+\tgit rebase -p e w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --root on non-linear history is a no-op\" \"\n+\treset_rebase &&\n+\tgit rebase -p --root w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates merge from side branch\" \"\n+\treset_rebase &&\n+\tgit rebase -p z w &&\n+\ttest_cmp_rev z HEAD^ &&\n+\ttest_cmp_rev w^2 HEAD^2\n+\"\n+\n+test_expect_success \"rebase -p re-creates internal merge\" \"\n+\treset_rebase &&\n+\tgit rebase -p c w &&\n+\ttest_cmp_rev c HEAD~4 &&\n+\ttest_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p can re-create two branches on onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto c d w &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#        \\       \\\n+#         e-------u\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n+\tgit checkout e &&\n+\ttest_merge u i\n+'\n+\n+test_expect_success \"rebase -p re-creates history around dropped commit matching upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p h u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto f h u &&\n+\ttest_cmp_rev f HEAD~3 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto h f u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\"\n+\n+# a---b---c---g---h\n+#      \\\n+#       d---G---s\n+#        \\   \\ /\n+#         \\   X\n+#          \\ / \\\n+#           e---t\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for dropping whole side' '\n+\tgit checkout G &&\n+\ttest_merge s e &&\n+\tgit checkout e &&\n+\ttest_merge t G\n+'\n+\n+test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h s &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+test_expect_success \"rebase -p drops merge commit when entire second-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h t &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+#        \\   \\\n+#         n---r\n+#          \\\n+#           o\n+#\n+# r = tree-same with n\n+test_expect_success 'setup of non-linear-history for empty commits' '\n+\tgit checkout n &&\n+\tgit merge --no-commit e &&\n+\tgit reset n . &&\n+\tgit commit -m r &&\n+\tgit reset --hard &&\n+\tgit clean -f &&\n+\tgit tag r\n+'\n+\n+test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p c r &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_revision_subjects 'd e n r' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates empty merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p o r &&\n+\ttest_cmp_rev e HEAD^2 &&\n+\ttest_cmp_rev o HEAD^ &&\n+\ttest_revision_subjects 'r' HEAD\n+\"\n+\n+test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219066","messageId":"1369982987-18954-7-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 6/7] t3406: modernize style","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:46Z","receivedAt":"2013-05-31T06:49:46Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Update the following:\n\n - Quote 'setup'\n - Remove blank lines within test case body\n - Use test_commit instead of custom quick_one\n - Create branch \"topic\" from tag created by test_commit\n---\n t/t3406-rebase-message.sh | 30 +++++++++---------------------\n 1 file changed, 9 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex e6a9a0d..fe8c27f 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -4,27 +4,17 @@ test_description='messages from rebase operation'\n \n . ./test-lib.sh\n \n-quick_one () {\n-\techo \"$1\" >\"file$1\" &&\n-\tgit add \"file$1\" &&\n-\ttest_tick &&\n-\tgit commit -m \"$1\"\n-}\n+test_expect_success 'setup' '\n+\ttest_commit O fileO &&\n+\ttest_commit X fileX &&\n+\ttest_commit A fileA &&\n+\ttest_commit B fileB &&\n+\ttest_commit Y fileY &&\n \n-test_expect_success setup '\n-\tquick_one O &&\n-\tgit branch topic &&\n-\tquick_one X &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Y &&\n-\n-\tgit checkout topic &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Z &&\n+\tgit checkout -b topic O &&\n+\tgit cherry-pick A B &&\n+\ttest_commit Z fileZ &&\n \tgit tag start\n-\n '\n \n cat >expect <<\\EOF\n@@ -34,12 +24,10 @@ Committed: 0003 Z\n EOF\n \n test_expect_success 'rebase -m' '\n-\n \tgit rebase -m master >report &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\n-\n '\n \n test_expect_success 'rebase --stat' '\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219065","messageId":"1369982987-18954-8-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v3 7/7] tests: move test for rebase messages from t3400 to t3406","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-31T06:49:47Z","receivedAt":"2013-05-31T06:49:47Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"t3406 is supposed to test \"messages from rebase operation\", so let's\nmove tests in t3400 that fit that description into 3406. Most of the\nfunctionality they tested, except for the messages, has now been\nsubsumed by t3420.\n---\n t/t3400-rebase.sh         | 22 ----------------------\n t/t3406-rebase-message.sh | 22 ++++++++++++++++++++++\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b436ef4..45a55e9 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -59,28 +59,6 @@ test_expect_success 'rebase against master' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase against master twice' '\n-\tgit rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase against master twice with --force' '\n-\tgit rebase --force-rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date, rebase forced\" out\n-'\n-\n-test_expect_success 'rebase against master twice from another branch' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase master my-topic-branch >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase fast-forward to master' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase my-topic-branch >out &&\n-\ttest_i18ngrep \"Fast-forwarded HEAD to my-topic-branch\" out\n-'\n-\n test_expect_success 'the rebase operation should not have destroyed author information' '\n \t! (git log | grep \"Author:\" | grep \"<>\")\n '\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex fe8c27f..0392e36 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -30,6 +30,28 @@ test_expect_success 'rebase -m' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'rebase against master twice' '\n+\tgit rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase against master twice with --force' '\n+\tgit rebase --force-rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date, rebase forced\" out\n+'\n+\n+test_expect_success 'rebase against master twice from another branch' '\n+\tgit checkout topic^ &&\n+\tgit rebase master topic >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase fast-forward to master' '\n+\tgit checkout topic^ &&\n+\tgit rebase topic >out &&\n+\ttest_i18ngrep \"Fast-forwarded HEAD to topic\" out\n+'\n+\n test_expect_success 'rebase --stat' '\n \tgit reset --hard start &&\n         git rebase --stat master >diffstat.txt &&\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219101","messageId":"51A8955B.1040007@kdbg.org","threadId":"31582","inReplyTo":"1369982987-18954-6-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v3 5/7] add tests for rebasing merged history","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2013-05-31T12:19:39Z","receivedAt":"2013-05-31T12:19:39Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 31.05.2013 08:49, schrieb Martin von Zweigbergk:\n> +#       f\n> +#      /\n> +# a---b---c---g---h\n> +#      \\\n> +#       d---G---i\n> +#        \\       \\\n> +#         e-------u\n> +#\n> +# uppercase = cherry-picked\n> +# h = reverted g\n...\n> +test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p --onto f h u &&\n> +\ttest_cmp_rev f HEAD~3 &&\n> +\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n> +\"\n> +\n> +test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n> +\treset_rebase &&\n> +\tgit rebase -p --onto h f u &&\n> +\ttest_cmp_rev h HEAD~3 &&\n> +\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n> +\"\n\nI noticed one new aspect:\n\nThe interdiff between v2 and v3 looks like this:\n\n-test_expect_failure \"rebase -p --onto in merged history does not lose patches in upstream\" \"\n+test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n \treset_rebase &&\n \tgit rebase -p --onto f h u &&\n \ttest_cmp_rev f HEAD~3 &&\n-\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n \"\n \n-test_expect_success \"rebase -p --onto in merged history drops patches in onto\" \"\n+test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n \treset_rebase &&\n \tgit rebase -p --onto h f u &&\n \ttest_cmp_rev h HEAD~3 &&\n-\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n\nThe expectations that these two tests check changed from v2 to v3.\nNotice that former test goes from expect_failure to expect_success,\nas it should, but the latter does not change. Strange, isn't it?\n\nThe reason is that this check is incomplete:\n\n\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n\nand allowed the latter test in the v2 form to pass.\n\nIt should be\n\n\ttest_revision_subjects 'd i d e u' HEAD^2^ HEAD^2 HEAD~2 HEAD^ HEAD\n\nThe check of the latter test should be:\n\n\ttest_revision_subjects 'd G i d e u' HEAD^2~2 HEAD^2^ HEAD^2 HEAD~2 HEAD^ HEAD\n\ni.e. check all the way back to the mergebase via both branches. This\ncan be extrapolated to all tests that reconstruct mergy history (not\njust these two cases).\n\n-- Hannes\n"},{"id":"219156","messageId":"1370122575-12322-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"51A8955B.1040007@kdbg.org","subject":"[PATCH v4 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-01T21:36:15Z","receivedAt":"2013-06-01T21:36:15Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n\n> The reason is that this check is incomplete:\n>\n>    test_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n\nNice catch! This should fix it. I couldn't use the method you\nsuggested because of how test_revision_subjects works (repeated\nrevisions are ignored), but this makes the check stricter anyway.\n\nJunio, all the previous patches are unchanged since v3, so I'm not\nresending them. Thanks.\n\n t/t3400-rebase.sh                 |  31 +----\n t/t3401-rebase-partial.sh         |  45 -------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3409-rebase-preserve-merges.sh |  53 --------\n t/t3425-rebase-topology-merges.sh | 258 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 260 insertions(+), 137 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b58fa1a..b436ef4 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '\n \techo Side >>C &&\n \tgit add C &&\n \tgit commit -m \"Add C\" &&\n-\tgit checkout -b nonlinear my-topic-branch &&\n-\techo Edit >>B &&\n-\tgit add B &&\n-\tgit commit -m \"Modify B\" &&\n-\tgit merge side &&\n-\tgit checkout -b upstream-merged-nonlinear &&\n-\tgit merge master &&\n \tgit checkout -f my-topic-branch &&\n \tgit tag topic\n '\n@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase after merge master' '\n-\tgit checkout --detach refs/tags/topic &&\n-\tgit branch -D topic &&\n-\tgit reset --hard topic &&\n-\tgit merge master &&\n-\tgit rebase master &&\n-\t! (git show | grep \"^Merge:\")\n-'\n-\n-test_expect_success 'rebase of history with merges is linearized' '\n-\tgit checkout nonlinear &&\n-\ttest 4 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n-test_expect_success 'rebase of history with merges after upstream merge is linearized' '\n-\tgit checkout upstream-merged-nonlinear &&\n-\ttest 5 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n test_expect_success 'rebase a single mode change' '\n \tgit checkout master &&\n+\tgit branch -D topic &&\n \techo 1 >X &&\n \tgit add X &&\n \ttest_tick &&\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\ndeleted file mode 100755\nindex 7ba1797..0000000\n--- a/t/t3401-rebase-partial.sh\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland\n-#\n-\n-test_description='git rebase should detect patches integrated upstream\n-\n-This test cherry-picks one local change of two into master branch, and\n-checks that git rebase succeeds with only the second patch in the\n-local branch.\n-'\n-. ./test-lib.sh\n-\n-test_expect_success 'prepare repository with topic branch' '\n-\ttest_commit A &&\n-\tgit checkout -b my-topic-branch &&\n-\ttest_commit B &&\n-\ttest_commit C &&\n-\tgit checkout -f master &&\n-\ttest_commit A2 A.t\n-'\n-\n-test_expect_success 'pick top patch from topic branch into master' '\n-\tgit cherry-pick C &&\n-\tgit checkout -f my-topic-branch\n-'\n-\n-test_debug '\n-\tgit cherry master &&\n-\tgit format-patch -k --stdout --full-index master >/dev/null &&\n-\tgitk --all & sleep 1\n-'\n-\n-test_expect_success 'rebase topic branch against new master and check git am did not get halted' '\n-\tgit rebase master &&\n-\ttest_path_is_missing .git/rebase-apply\n-'\n-\n-test_expect_success 'rebase --merge topic branch that was partially merged upstream' '\n-\tgit reset --hard C &&\n-\tgit rebase --merge master &&\n-\ttest_path_is_missing .git/rebase-merge\n-'\n-\n-test_done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a58406d..ffcaf02 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '\n \ttest $one = $(git rev-parse HEAD~2)\n '\n \n-test_expect_success 'ignore patch if in upstream' '\n-\tHEAD=$(git rev-parse HEAD) &&\n-\tgit checkout -b has-cherry-picked HEAD^ &&\n+test_expect_success '--continue tries to commit, even for \"edit\"' '\n \techo unrelated > file7 &&\n \tgit add file7 &&\n \ttest_tick &&\n \tgit commit -m \"unrelated change\" &&\n-\tgit cherry-pick $HEAD &&\n-\tEXPECT_COUNT=1 git rebase -i $HEAD &&\n-\ttest $HEAD = $(git rev-parse HEAD^)\n-'\n-\n-test_expect_success '--continue tries to commit, even for \"edit\"' '\n \tparent=$(git rev-parse HEAD^) &&\n \ttest_tick &&\n \tFAKE_LINES=\"edit 1\" git rebase -i HEAD^ &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 6de4e22..2e0c364 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -11,14 +11,6 @@ Run \"git rebase -p\" and check that merges are properly carried along\n GIT_AUTHOR_EMAIL=bogus_email_address\n export GIT_AUTHOR_EMAIL\n \n-# Clone 1 (trivial merge):\n-#\n-# A1--A2  <-- origin/master\n-#  \\   \\\n-#   B1--M  <-- topic\n-#    \\\n-#     B2  <-- origin/topic\n-#\n # Clone 2 (conflicting merge):\n #\n # A1--A2--B3   <-- origin/master\n@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL\n #     \\--A3    <-- topic2\n #      \\\n #       B2     <-- origin/topic\n-#\n-# Clone 4 (merge using second parent as base):\n-#\n-# A1--A2--B3   <-- origin/master\n-#  \\\n-#   B1--A3--M  <-- topic\n-#    \\     /\n-#     \\--A4    <-- topic2\n-#      \\\n-#       B2     <-- origin/topic\n \n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit checkout -f master &&\n \techo Third >> A &&\n \tgit commit -a -m \"Modify A2\" &&\n-\n-\tgit clone ./. clone1 &&\n-\t(cd clone1 &&\n-\tgit checkout -b topic origin/topic &&\n-\tgit merge origin/master\n-\t) &&\n-\n-\tgit clone ./. clone4 &&\n-\t(\n-\t\tcd clone4 &&\n-\t\tgit checkout -b topic origin/topic &&\n-\t\tgit merge origin/master\n-\t) &&\n-\n \techo Fifth > B &&\n \tgit add B &&\n \tgit commit -m \"Add different B\" &&\n@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit commit -a -m \"Modify B2\"\n '\n \n-test_expect_success 'rebase -p fakes interactive rebase' '\n-\t(\n-\tcd clone1 &&\n-\tgit fetch &&\n-\tgit rebase -p origin/topic &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_expect_success '--continue works after a conflict' '\n \t(\n \tcd clone2 &&\n@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '\n \t)\n '\n \n-test_expect_success 'rebase -p works when base inside second parent' '\n-\t(\n-\tcd clone4 &&\n-\tgit fetch &&\n-\tgit rebase -p HEAD^2 &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify B\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nnew file mode 100755\nindex 0000000..efd7dfd\n--- /dev/null\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -0,0 +1,258 @@\n+#!/bin/sh\n+\n+test_description='rebase topology tests with merges'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+test_revision_subjects () {\n+\texpected=\"$1\"\n+\tshift\n+\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n+test_expect_success 'setup of non-linear-history' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+\n+\tgit checkout d &&\n+\ttest_commit n &&\n+\ttest_commit o &&\n+\ttest_merge w e &&\n+\ttest_merge v c &&\n+\tgit checkout o &&\n+\ttest_commit z\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* after merge from upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e w &&\n+\t\ttest_cmp_rev e HEAD~2 &&\n+\t\ttest_linear_range 'n o' e..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized in place\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* d w &&\n+\t\ttest_cmp_rev d HEAD~3 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'e n o' ''\n+test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c w &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history with merges after upstream merge is linearized\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c v &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_expect_success \"rebase -p is no-op in non-linear history\" \"\n+\treset_rebase &&\n+\tgit rebase -p d w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p is no-op when base inside second parent\" \"\n+\treset_rebase &&\n+\tgit rebase -p e w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --root on non-linear history is a no-op\" \"\n+\treset_rebase &&\n+\tgit rebase -p --root w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates merge from side branch\" \"\n+\treset_rebase &&\n+\tgit rebase -p z w &&\n+\ttest_cmp_rev z HEAD^ &&\n+\ttest_cmp_rev w^2 HEAD^2\n+\"\n+\n+test_expect_success \"rebase -p re-creates internal merge\" \"\n+\treset_rebase &&\n+\tgit rebase -p c w &&\n+\ttest_cmp_rev c HEAD~4 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~3 &&\n+\ttest_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p can re-create two branches on onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto c d w &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev c HEAD^2^ &&\n+\ttest_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#        \\       \\\n+#         e-------u\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n+\tgit checkout e &&\n+\ttest_merge u i\n+'\n+\n+test_expect_success \"rebase -p re-creates history around dropped commit matching upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p h u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto f h u &&\n+\ttest_cmp_rev f HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto h f u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2~2 HEAD~2 &&\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\"\n+\n+# a---b---c---g---h\n+#      \\\n+#       d---G---s\n+#        \\   \\ /\n+#         \\   X\n+#          \\ / \\\n+#           e---t\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for dropping whole side' '\n+\tgit checkout G &&\n+\ttest_merge s e &&\n+\tgit checkout e &&\n+\ttest_merge t G\n+'\n+\n+test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h s &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+test_expect_success \"rebase -p drops merge commit when entire second-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h t &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+#        \\   \\\n+#         n---r\n+#          \\\n+#           o\n+#\n+# r = tree-same with n\n+test_expect_success 'setup of non-linear-history for empty commits' '\n+\tgit checkout n &&\n+\tgit merge --no-commit e &&\n+\tgit reset n . &&\n+\tgit commit -m r &&\n+\tgit reset --hard &&\n+\tgit clean -f &&\n+\tgit tag r\n+'\n+\n+test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p c r &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd e n r' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates empty merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p o r &&\n+\ttest_cmp_rev e HEAD^2 &&\n+\ttest_cmp_rev o HEAD^ &&\n+\ttest_revision_subjects 'r' HEAD\n+\"\n+\n+test_done\n-- \n1.8.2.674.gd17d3d2\n"},{"id":"219247","messageId":"CANiSa6hH3APigj_vozsbBQriNhqnPT=2Qcb0T76qs9hPhbhacg@mail.gmail.com","threadId":"31582","inReplyTo":"1369809572-24431-2-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v2 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T17:16:52Z","receivedAt":"2013-06-03T17:16:52Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Tue, May 28, 2013 at 11:39 PM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n>  create mode 100755 t/t3420-rebase-topology-linear.sh\n\nJust FYI, there's another test case with the same number\n(t3420-rebase-autostash) in pu. I don't know how you normally handle\nsuch cases.\n"},{"id":"219265","messageId":"7v8v2rf4sb.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"CANiSa6hH3APigj_vozsbBQriNhqnPT=2Qcb0T76qs9hPhbhacg@mail.gmail.com","subject":"Re: [PATCH v2 1/7] add simple tests of consistency across rebase types","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-03T18:05:56Z","receivedAt":"2013-06-03T18:05:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> On Tue, May 28, 2013 at 11:39 PM, Martin von Zweigbergk\n> <martinvonz@gmail.com> wrote:\n>>  create mode 100755 t/t3420-rebase-topology-linear.sh\n>\n> Just FYI, there's another test case with the same number\n> (t3420-rebase-autostash) in pu. I don't know how you normally handle\n> such cases.\n\nThanks for a heads-up.  Usually, the series that appears later on\nthe list yields and finds a unique number.\n"},{"id":"219267","messageId":"CANiSa6g_QgvQgaTmVdTxbhdf=sxYmNjhYszxxXeh66rGrR1A_Q@mail.gmail.com","threadId":"31582","inReplyTo":"7v8v2rf4sb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T18:12:31Z","receivedAt":"2013-06-03T18:12:31Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Mon, Jun 3, 2013 at 11:05 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Martin von Zweigbergk <martinvonz@gmail.com> writes:\n>\n>> On Tue, May 28, 2013 at 11:39 PM, Martin von Zweigbergk\n>> <martinvonz@gmail.com> wrote:\n>>>  create mode 100755 t/t3420-rebase-topology-linear.sh\n>>\n>> Just FYI, there's another test case with the same number\n>> (t3420-rebase-autostash) in pu. I don't know how you normally handle\n>> such cases.\n>\n> Thanks for a heads-up.  Usually, the series that appears later on\n> the list yields and finds a unique number.\n\nIn this case, that's my series. Want a resend or do you want to do it\nyourself? I'm fine either way, whatever is easiest for you.\n"},{"id":"219287","messageId":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1369982987-18954-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 0/7] Rebase topology test","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:08Z","receivedAt":"2013-06-03T20:42:08Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"The only change since v4 should be that t3420 was renamed t3421.\n\nMartin von Zweigbergk (7):\n  add simple tests of consistency across rebase types\n  add tests for rebasing with patch-equivalence present\n  add tests for rebasing of empty commits\n  add tests for rebasing root\n  add tests for rebasing merged history\n  t3406: modernize style\n  tests: move test for rebase messages from t3400 to t3406\n\n t/lib-rebase.sh                   |  32 ++++\n t/t3400-rebase.sh                 |  53 +-----\n t/t3401-rebase-partial.sh         |  69 --------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3406-rebase-message.sh         |  50 +++---\n t/t3409-rebase-preserve-merges.sh |  53 ------\n t/t3421-rebase-topology-linear.sh | 350 ++++++++++++++++++++++++++++++++++++++\n t/t3425-rebase-topology-merges.sh | 258 ++++++++++++++++++++++++++++\n 8 files changed, 672 insertions(+), 203 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3421-rebase-topology-linear.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219291","messageId":"1370292135-1236-2-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:09Z","receivedAt":"2013-06-03T20:42:09Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Helped-by: Johannes Sixt <j6t@kdbg.org>\n---\n t/lib-rebase.sh                   | 15 ++++++++\n t/t3421-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 93 insertions(+)\n create mode 100755 t/t3421-rebase-topology-linear.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 6ccf797..62b3887 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -65,3 +65,18 @@ EOF\n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n \tchmod a+x fake-editor.sh\n }\n+\n+# checks that the revisions in \"$2\" represent a linear range with the\n+# subjects in \"$1\"\n+test_linear_range () {\n+\t! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n+\texpected=$1\n+\tset -- $(git log --reverse --format=%s \"$2\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+reset_rebase () {\n+\tgit rebase --abort # may fail; ignore exit code\n+\tgit reset --hard &&\n+\tgit clean -f\n+}\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nnew file mode 100755\nindex 0000000..c4b32db\n--- /dev/null\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+test_description='basic rebase topology tests'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+test_expect_success 'setup' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"simple rebase $*\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c e &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd e' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* is no-op if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* b e &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f b e &&\n+\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev b HEAD~2 &&\n+\t\ttest_linear_range 'd e' b..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* fast-forwards if an ancestor of upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e b &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219288","messageId":"1370292135-1236-3-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:10Z","receivedAt":"2013-06-03T20:42:10Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/lib-rebase.sh                   | 17 ++++++++\n t/t3421-rebase-topology-linear.sh | 85 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 62b3887..16eeb1c 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -80,3 +80,20 @@ reset_rebase () {\n \tgit reset --hard &&\n \tgit clean -f\n }\n+\n+cherry_pick () {\n+\tgit cherry-pick -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+revert () {\n+\tgit revert -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+make_empty () {\n+\tgit commit --allow-empty -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex c4b32db..75cc476 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -75,4 +75,89 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for range selection tests' '\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h i &&\n+\t\ttest_cmp_rev h HEAD~2 &&\n+\t\ttest_linear_range 'd i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* can drop last patch if in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h G &&\n+\t\ttest_cmp_rev h HEAD^ &&\n+\t\ttest_linear_range 'd' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto f h i &&\n+\t\ttest_cmp_rev f HEAD~2 &&\n+\t\ttest_linear_range 'd i' f..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto does not drop patches in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto h f i &&\n+\t\ttest_cmp_rev h HEAD~3 &&\n+\t\ttest_linear_range 'd G i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219294","messageId":"1370292135-1236-4-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 3/7] add tests for rebasing of empty commits","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:11Z","receivedAt":"2013-06-03T20:42:11Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3401-rebase-partial.sh         | 24 ----------------\n t/t3421-rebase-topology-linear.sh | 58 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 58 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\nindex 58f4823..7ba1797 100755\n--- a/t/t3401-rebase-partial.sh\n+++ b/t/t3401-rebase-partial.sh\n@@ -42,28 +42,4 @@ test_expect_success 'rebase --merge topic branch that was partially merged upstr\n \ttest_path_is_missing .git/rebase-merge\n '\n \n-test_expect_success 'rebase ignores empty commit' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m empty &&\n-\ttest_commit D &&\n-\tgit rebase C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\"\n-'\n-\n-test_expect_success 'rebase --keep-empty' '\n-\tgit reset --hard D &&\n-\tgit rebase --keep-empty C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\n-empty\"\n-'\n-\n-test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m also-empty &&\n-\tgit rebase --keep-empty D &&\n-\ttest \"$(git log --format=%s A..)\" = \"also-empty\n-D\n-empty\"\n-'\n-\n test_done\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 75cc476..81e3d59 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -160,4 +160,62 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+# a---b---c---j!\n+#      \\\n+#       d---k!--l\n+#\n+# ! = empty\n+test_expect_success 'setup of linear history for empty commit tests' '\n+\tgit checkout c &&\n+\tmake_empty j &&\n+\tgit checkout d &&\n+\tmake_empty k &&\n+\ttest_commit l\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops empty commit\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c l &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty c l &&\n+\t\ttest_cmp_rev c HEAD~3 &&\n+\t\ttest_linear_range 'd k l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty keeps empty even if already in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty j l &&\n+\t\ttest_cmp_rev j HEAD~3 &&\n+\t\ttest_linear_range 'd k l' j..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219289","messageId":"1370292135-1236-5-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 4/7] add tests for rebasing root","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:12Z","receivedAt":"2013-06-03T20:42:12Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3421-rebase-topology-linear.sh | 129 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 129 insertions(+)\n\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 81e3d59..659a7b3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -218,4 +218,133 @@ test_run_rebase failure -m\n test_run_rebase failure -i\n test_run_rebase failure -p\n \n+#       m\n+#      /\n+# a---b---c---g\n+#\n+# x---y---B\n+#\n+# uppercase = cherry-picked\n+# m = reverted b\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for test involving root' '\n+\tgit checkout b &&\n+\trevert m b &&\n+\tgit checkout --orphan disjoint &&\n+\tgit rm -rf . &&\n+\ttest_commit x &&\n+\ttest_commit y &&\n+\tcherry_pick B b\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto c --root y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root g &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'c g' m..\n+\t\"\n+}\n+\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* m B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --root on linear history is a no-op\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --root c &&\n+\t\ttest_cmp_rev c HEAD\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f --root c &&\n+\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_linear_range 'a b c' HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219290","messageId":"1370292135-1236-6-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:13Z","receivedAt":"2013-06-03T20:42:13Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"---\n t/t3400-rebase.sh                 |  31 +----\n t/t3401-rebase-partial.sh         |  45 -------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3409-rebase-preserve-merges.sh |  53 --------\n t/t3425-rebase-topology-merges.sh | 258 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 260 insertions(+), 137 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b58fa1a..b436ef4 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '\n \techo Side >>C &&\n \tgit add C &&\n \tgit commit -m \"Add C\" &&\n-\tgit checkout -b nonlinear my-topic-branch &&\n-\techo Edit >>B &&\n-\tgit add B &&\n-\tgit commit -m \"Modify B\" &&\n-\tgit merge side &&\n-\tgit checkout -b upstream-merged-nonlinear &&\n-\tgit merge master &&\n \tgit checkout -f my-topic-branch &&\n \tgit tag topic\n '\n@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase after merge master' '\n-\tgit checkout --detach refs/tags/topic &&\n-\tgit branch -D topic &&\n-\tgit reset --hard topic &&\n-\tgit merge master &&\n-\tgit rebase master &&\n-\t! (git show | grep \"^Merge:\")\n-'\n-\n-test_expect_success 'rebase of history with merges is linearized' '\n-\tgit checkout nonlinear &&\n-\ttest 4 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n-test_expect_success 'rebase of history with merges after upstream merge is linearized' '\n-\tgit checkout upstream-merged-nonlinear &&\n-\ttest 5 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n test_expect_success 'rebase a single mode change' '\n \tgit checkout master &&\n+\tgit branch -D topic &&\n \techo 1 >X &&\n \tgit add X &&\n \ttest_tick &&\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\ndeleted file mode 100755\nindex 7ba1797..0000000\n--- a/t/t3401-rebase-partial.sh\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland\n-#\n-\n-test_description='git rebase should detect patches integrated upstream\n-\n-This test cherry-picks one local change of two into master branch, and\n-checks that git rebase succeeds with only the second patch in the\n-local branch.\n-'\n-. ./test-lib.sh\n-\n-test_expect_success 'prepare repository with topic branch' '\n-\ttest_commit A &&\n-\tgit checkout -b my-topic-branch &&\n-\ttest_commit B &&\n-\ttest_commit C &&\n-\tgit checkout -f master &&\n-\ttest_commit A2 A.t\n-'\n-\n-test_expect_success 'pick top patch from topic branch into master' '\n-\tgit cherry-pick C &&\n-\tgit checkout -f my-topic-branch\n-'\n-\n-test_debug '\n-\tgit cherry master &&\n-\tgit format-patch -k --stdout --full-index master >/dev/null &&\n-\tgitk --all & sleep 1\n-'\n-\n-test_expect_success 'rebase topic branch against new master and check git am did not get halted' '\n-\tgit rebase master &&\n-\ttest_path_is_missing .git/rebase-apply\n-'\n-\n-test_expect_success 'rebase --merge topic branch that was partially merged upstream' '\n-\tgit reset --hard C &&\n-\tgit rebase --merge master &&\n-\ttest_path_is_missing .git/rebase-merge\n-'\n-\n-test_done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a58406d..ffcaf02 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '\n \ttest $one = $(git rev-parse HEAD~2)\n '\n \n-test_expect_success 'ignore patch if in upstream' '\n-\tHEAD=$(git rev-parse HEAD) &&\n-\tgit checkout -b has-cherry-picked HEAD^ &&\n+test_expect_success '--continue tries to commit, even for \"edit\"' '\n \techo unrelated > file7 &&\n \tgit add file7 &&\n \ttest_tick &&\n \tgit commit -m \"unrelated change\" &&\n-\tgit cherry-pick $HEAD &&\n-\tEXPECT_COUNT=1 git rebase -i $HEAD &&\n-\ttest $HEAD = $(git rev-parse HEAD^)\n-'\n-\n-test_expect_success '--continue tries to commit, even for \"edit\"' '\n \tparent=$(git rev-parse HEAD^) &&\n \ttest_tick &&\n \tFAKE_LINES=\"edit 1\" git rebase -i HEAD^ &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 6de4e22..2e0c364 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -11,14 +11,6 @@ Run \"git rebase -p\" and check that merges are properly carried along\n GIT_AUTHOR_EMAIL=bogus_email_address\n export GIT_AUTHOR_EMAIL\n \n-# Clone 1 (trivial merge):\n-#\n-# A1--A2  <-- origin/master\n-#  \\   \\\n-#   B1--M  <-- topic\n-#    \\\n-#     B2  <-- origin/topic\n-#\n # Clone 2 (conflicting merge):\n #\n # A1--A2--B3   <-- origin/master\n@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL\n #     \\--A3    <-- topic2\n #      \\\n #       B2     <-- origin/topic\n-#\n-# Clone 4 (merge using second parent as base):\n-#\n-# A1--A2--B3   <-- origin/master\n-#  \\\n-#   B1--A3--M  <-- topic\n-#    \\     /\n-#     \\--A4    <-- topic2\n-#      \\\n-#       B2     <-- origin/topic\n \n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit checkout -f master &&\n \techo Third >> A &&\n \tgit commit -a -m \"Modify A2\" &&\n-\n-\tgit clone ./. clone1 &&\n-\t(cd clone1 &&\n-\tgit checkout -b topic origin/topic &&\n-\tgit merge origin/master\n-\t) &&\n-\n-\tgit clone ./. clone4 &&\n-\t(\n-\t\tcd clone4 &&\n-\t\tgit checkout -b topic origin/topic &&\n-\t\tgit merge origin/master\n-\t) &&\n-\n \techo Fifth > B &&\n \tgit add B &&\n \tgit commit -m \"Add different B\" &&\n@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit commit -a -m \"Modify B2\"\n '\n \n-test_expect_success 'rebase -p fakes interactive rebase' '\n-\t(\n-\tcd clone1 &&\n-\tgit fetch &&\n-\tgit rebase -p origin/topic &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_expect_success '--continue works after a conflict' '\n \t(\n \tcd clone2 &&\n@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '\n \t)\n '\n \n-test_expect_success 'rebase -p works when base inside second parent' '\n-\t(\n-\tcd clone4 &&\n-\tgit fetch &&\n-\tgit rebase -p HEAD^2 &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify B\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nnew file mode 100755\nindex 0000000..efd7dfd\n--- /dev/null\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -0,0 +1,258 @@\n+#!/bin/sh\n+\n+test_description='rebase topology tests with merges'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+test_revision_subjects () {\n+\texpected=\"$1\"\n+\tshift\n+\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n+test_expect_success 'setup of non-linear-history' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+\n+\tgit checkout d &&\n+\ttest_commit n &&\n+\ttest_commit o &&\n+\ttest_merge w e &&\n+\ttest_merge v c &&\n+\tgit checkout o &&\n+\ttest_commit z\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* after merge from upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e w &&\n+\t\ttest_cmp_rev e HEAD~2 &&\n+\t\ttest_linear_range 'n o' e..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized in place\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* d w &&\n+\t\ttest_cmp_rev d HEAD~3 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'e n o' ''\n+test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c w &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history with merges after upstream merge is linearized\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c v &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make all flavors of rebase use --topo-order\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_expect_success \"rebase -p is no-op in non-linear history\" \"\n+\treset_rebase &&\n+\tgit rebase -p d w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p is no-op when base inside second parent\" \"\n+\treset_rebase &&\n+\tgit rebase -p e w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --root on non-linear history is a no-op\" \"\n+\treset_rebase &&\n+\tgit rebase -p --root w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates merge from side branch\" \"\n+\treset_rebase &&\n+\tgit rebase -p z w &&\n+\ttest_cmp_rev z HEAD^ &&\n+\ttest_cmp_rev w^2 HEAD^2\n+\"\n+\n+test_expect_success \"rebase -p re-creates internal merge\" \"\n+\treset_rebase &&\n+\tgit rebase -p c w &&\n+\ttest_cmp_rev c HEAD~4 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~3 &&\n+\ttest_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p can re-create two branches on onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto c d w &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev c HEAD^2^ &&\n+\ttest_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#        \\       \\\n+#         e-------u\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n+\tgit checkout e &&\n+\ttest_merge u i\n+'\n+\n+test_expect_success \"rebase -p re-creates history around dropped commit matching upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p h u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto f h u &&\n+\ttest_cmp_rev f HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto h f u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2~2 HEAD~2 &&\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\"\n+\n+# a---b---c---g---h\n+#      \\\n+#       d---G---s\n+#        \\   \\ /\n+#         \\   X\n+#          \\ / \\\n+#           e---t\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for dropping whole side' '\n+\tgit checkout G &&\n+\ttest_merge s e &&\n+\tgit checkout e &&\n+\ttest_merge t G\n+'\n+\n+test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h s &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+test_expect_success \"rebase -p drops merge commit when entire second-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h t &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+#        \\   \\\n+#         n---r\n+#          \\\n+#           o\n+#\n+# r = tree-same with n\n+test_expect_success 'setup of non-linear-history for empty commits' '\n+\tgit checkout n &&\n+\tgit merge --no-commit e &&\n+\tgit reset n . &&\n+\tgit commit -m r &&\n+\tgit reset --hard &&\n+\tgit clean -f &&\n+\tgit tag r\n+'\n+\n+test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p c r &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd e n r' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates empty merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p o r &&\n+\ttest_cmp_rev e HEAD^2 &&\n+\ttest_cmp_rev o HEAD^ &&\n+\ttest_revision_subjects 'r' HEAD\n+\"\n+\n+test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219292","messageId":"1370292135-1236-7-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 6/7] t3406: modernize style","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:14Z","receivedAt":"2013-06-03T20:42:14Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Update the following:\n\n - Quote 'setup'\n - Remove blank lines within test case body\n - Use test_commit instead of custom quick_one\n - Create branch \"topic\" from tag created by test_commit\n---\n t/t3406-rebase-message.sh | 30 +++++++++---------------------\n 1 file changed, 9 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex e6a9a0d..fe8c27f 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -4,27 +4,17 @@ test_description='messages from rebase operation'\n \n . ./test-lib.sh\n \n-quick_one () {\n-\techo \"$1\" >\"file$1\" &&\n-\tgit add \"file$1\" &&\n-\ttest_tick &&\n-\tgit commit -m \"$1\"\n-}\n+test_expect_success 'setup' '\n+\ttest_commit O fileO &&\n+\ttest_commit X fileX &&\n+\ttest_commit A fileA &&\n+\ttest_commit B fileB &&\n+\ttest_commit Y fileY &&\n \n-test_expect_success setup '\n-\tquick_one O &&\n-\tgit branch topic &&\n-\tquick_one X &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Y &&\n-\n-\tgit checkout topic &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Z &&\n+\tgit checkout -b topic O &&\n+\tgit cherry-pick A B &&\n+\ttest_commit Z fileZ &&\n \tgit tag start\n-\n '\n \n cat >expect <<\\EOF\n@@ -34,12 +24,10 @@ Committed: 0003 Z\n EOF\n \n test_expect_success 'rebase -m' '\n-\n \tgit rebase -m master >report &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\n-\n '\n \n test_expect_success 'rebase --stat' '\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219293","messageId":"1370292135-1236-8-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v5 7/7] tests: move test for rebase messages from t3400 to t3406","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-03T20:42:15Z","receivedAt":"2013-06-03T20:42:15Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"t3406 is supposed to test \"messages from rebase operation\", so let's\nmove tests in t3400 that fit that description into 3406. Most of the\nfunctionality they tested, except for the messages, has now been\nsubsumed by t3420.\n---\n t/t3400-rebase.sh         | 22 ----------------------\n t/t3406-rebase-message.sh | 22 ++++++++++++++++++++++\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b436ef4..45a55e9 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -59,28 +59,6 @@ test_expect_success 'rebase against master' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase against master twice' '\n-\tgit rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase against master twice with --force' '\n-\tgit rebase --force-rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date, rebase forced\" out\n-'\n-\n-test_expect_success 'rebase against master twice from another branch' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase master my-topic-branch >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase fast-forward to master' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase my-topic-branch >out &&\n-\ttest_i18ngrep \"Fast-forwarded HEAD to my-topic-branch\" out\n-'\n-\n test_expect_success 'the rebase operation should not have destroyed author information' '\n \t! (git log | grep \"Author:\" | grep \"<>\")\n '\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex fe8c27f..0392e36 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -30,6 +30,28 @@ test_expect_success 'rebase -m' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'rebase against master twice' '\n+\tgit rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase against master twice with --force' '\n+\tgit rebase --force-rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date, rebase forced\" out\n+'\n+\n+test_expect_success 'rebase against master twice from another branch' '\n+\tgit checkout topic^ &&\n+\tgit rebase master topic >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase fast-forward to master' '\n+\tgit checkout topic^ &&\n+\tgit rebase topic >out &&\n+\ttest_i18ngrep \"Fast-forwarded HEAD to topic\" out\n+'\n+\n test_expect_success 'rebase --stat' '\n \tgit reset --hard start &&\n         git rebase --stat master >diffstat.txt &&\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219311","messageId":"7v1u8ide2b.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"1370292135-1236-2-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-03T22:28:28Z","receivedAt":"2013-06-03T22:28:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> Helped-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  t/lib-rebase.sh                   | 15 ++++++++\n>  t/t3421-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 93 insertions(+)\n>  create mode 100755 t/t3421-rebase-topology-linear.sh\n>\n> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\n> index 6ccf797..62b3887 100644\n> --- a/t/lib-rebase.sh\n> +++ b/t/lib-rebase.sh\n> @@ -65,3 +65,18 @@ EOF\n>  \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n>  \tchmod a+x fake-editor.sh\n>  }\n> +\n> +# checks that the revisions in \"$2\" represent a linear range with the\n> +# subjects in \"$1\"\n> +test_linear_range () {\n> +\t! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n\nAn interesting way to spell:\n\n    test $(git rev-list --merges \"$2\" | wc -l) = 0\n\nI think I am fine with either, though.\n\n> +\texpected=$1\n> +\tset -- $(git log --reverse --format=%s \"$2\")\n> +\ttest \"$expected\" = \"$*\"\n\nOK.\n\n> +}\n> +\n> +reset_rebase () {\n> +\tgit rebase --abort # may fail; ignore exit code\n\ntest_might_fail to catch unusual exit codes?\n\n> +\tgit reset --hard &&\n> +\tgit clean -f\n> +}\n> diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\n> new file mode 100755\n> index 0000000..c4b32db\n> --- /dev/null\n> +++ b/t/t3421-rebase-topology-linear.sh\n> @@ -0,0 +1,78 @@\n> +#!/bin/sh\n> +\n> +test_description='basic rebase topology tests'\n> +. ./test-lib.sh\n> +. \"$TEST_DIRECTORY\"/lib-rebase.sh\n> +\n> +# a---b---c\n> +#      \\\n> +#       d---e\n> +test_expect_success 'setup' '\n> +\ttest_commit a &&\n> +\ttest_commit b &&\n> +\ttest_commit c &&\n> +\tgit checkout b &&\n> +\ttest_commit d &&\n> +\ttest_commit e\n> +'\n> +\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"simple rebase $*\" \"\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* c e &&\n> +\t\ttest_cmp_rev c HEAD~2 &&\n> +\t\ttest_linear_range 'd e' c..\n> +\t\"\n> +}\n> +test_run_rebase success ''\n> +test_run_rebase success -m\n> +test_run_rebase success -i\n> +test_run_rebase success -p\n> +\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"rebase $* is no-op if upstream is an ancestor\" \"\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* b e &&\n> +\t\ttest_cmp_rev e HEAD\n> +\t\"\n> +}\n> +test_run_rebase success ''\n> +test_run_rebase success -m\n> +test_run_rebase success -i\n> +test_run_rebase success -p\n> +\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* -f b e &&\n\nAsking to rebase the history leading to e from b on top of the merge\nbase (which happens to be b) may be no-op or force-create a new\nhistory that is parallel.  OK.\n\n> +\t\t! test_cmp_rev e HEAD &&\n> +\t\ttest_cmp_rev b HEAD~2 &&\n> +\t\ttest_linear_range 'd e' b..\n> +\t\"\n> +}\n> +test_run_rebase success ''\n> +test_run_rebase success -m\n> +test_run_rebase success -i\n> +test_run_rebase failure -p\n> +\n> +test_run_rebase () {\n> +\tresult=$1\n> +\tshift\n> +\ttest_expect_$result \"rebase $* fast-forwards if an ancestor of upstream\" \"\n\nThe description is a non-sentence, and while I can tell what it\nwants to say, I do not have a good suggestion for rephrasing this.\n\nThis is asking to rebase the history leading to b on top of e, but e\nalready includes everything in b, so it just turns into a no-op of\nnot moving from e.  So it is not even a fast-forward.\n\n> +\t\treset_rebase &&\n> +\t\tgit rebase $* e b &&\n> +\t\ttest_cmp_rev e HEAD\n> +\t\"\n> +}\n> +test_run_rebase success ''\n> +test_run_rebase success -m\n> +test_run_rebase success -i\n> +test_run_rebase success -p\n> +\n> +test_done\n"},{"id":"219320","messageId":"CANiSa6hGLKATn3uUJKoi4917R4qoiyRHHJWo-p8vFrCZsg5joQ@mail.gmail.com","threadId":"31582","inReplyTo":"7v1u8ide2b.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-04T05:14:43Z","receivedAt":"2013-06-04T05:14:43Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Mon, Jun 3, 2013 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> +\n>> +# checks that the revisions in \"$2\" represent a linear range with the\n>> +# subjects in \"$1\"\n>> +test_linear_range () {\n>> +     ! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n>\n> An interesting way to spell:\n>\n>     test $(git rev-list --merges \"$2\" | wc -l) = 0\n\nHeh, true. I'll change that. (\"My\" version was based on the one in\ngit-rebase.sh, around line 495.)\n\n>> +reset_rebase () {\n>> +     git rebase --abort # may fail; ignore exit code\n>\n> test_might_fail to catch unusual exit codes?\n\nWill change.\n\n>> +# a---b---c\n>> +#      \\\n>> +#       d---e\n\n>> +test_run_rebase () {\n>> +     result=$1\n>> +     shift\n>> +     test_expect_$result \"rebase $* fast-forwards if an ancestor of upstream\" \"\n>\n> The description is a non-sentence, and while I can tell what it\n> wants to say, I do not have a good suggestion for rephrasing this.\n\nChanging description to \"... fast-forwards from an ancestor of upstream\".\n\n> This is asking to rebase the history leading to b on top of e, but e\n> already includes everything in b, so it just turns into a no-op of\n> not moving from e.  So it is not even a fast-forward.\n>\n>> +             reset_rebase &&\n>> +             git rebase $* e b &&\n>> +             test_cmp_rev e HEAD\n\nWell, \"git rebase e b\" is of course a kind of short form of \"git\ncheckout b && git rebase e\". While it's true that the implementation\ndoesn't bother checking out b first, that's just an optimization, but\nlet me know if you meant something else.\n\nThanks. Will wait another day or two for further comments before I\nsend another version.\n"},{"id":"219322","messageId":"7vehcia0ip.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"CANiSa6hGLKATn3uUJKoi4917R4qoiyRHHJWo-p8vFrCZsg5joQ@mail.gmail.com","subject":"Re: [PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-04T05:49:18Z","receivedAt":"2013-06-04T05:49:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> Thanks. Will wait another day or two for further comments before I\n> send another version.\n\nThanks; I just noticed that your patches lack S-o-b:.\n"},{"id":"219325","messageId":"51AD860B.1070507@viscovery.net","threadId":"31582","inReplyTo":"CANiSa6hGLKATn3uUJKoi4917R4qoiyRHHJWo-p8vFrCZsg5joQ@mail.gmail.com","subject":"Re: [PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-06-04T06:15:39Z","receivedAt":"2013-06-04T06:15:39Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/4/2013 7:14, schrieb Martin von Zweigbergk:\n> On Mon, Jun 3, 2013 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> +\n>>> +# checks that the revisions in \"$2\" represent a linear range with the\n>>> +# subjects in \"$1\"\n>>> +test_linear_range () {\n>>> +     ! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n>>\n>> An interesting way to spell:\n>>\n>>     test $(git rev-list --merges \"$2\" | wc -l) = 0\n> \n> Heh, true. I'll change that.\n\nThen I think it would be even better written as\n\n\trevlist_merges=$(git rev-list --merges \"$2\") &&\n\ttest -z \"$revlist_merges\"\n\nso as not to ignore errors in the git invocation (and at least one less\nfork()).\n\n-- Hannes\n"},{"id":"219383","messageId":"7vk3m994mu.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"1370292135-1236-6-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v5 5/7] add tests for rebasing merged history","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-04T17:18:01Z","receivedAt":"2013-06-04T17:18:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> ---\n> +#TODO: make all flavors of rebase use --topo-order\n> +test_run_rebase success 'e n o' ''\n> +test_run_rebase success 'e n o' -m\n> +test_run_rebase success 'n o e' -i\n\nI do not quite follow this TODO.\n\nWhile I think it would be nice to update \"rebase\" so that all\nvariants consider replaying the commits in the same order, in this\nhistory you have:\n\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n\nas long as o comes after n and e is shown before n or after o, which\nall three expected results satisify, it is in --topo-order, isn't it?\n\nThe same comment applies to the other TODO that talks about eno/noe\ndifferences.\n\n> +test_expect_success \"rebase -p re-creates merge from side branch\" \"\n> +     reset_rebase &&\n> +     git rebase -p z w &&\n> +     test_cmp_rev z HEAD^ &&\n> +     test_cmp_rev w^2 HEAD^2\n> +\"\n\nHmm, turning the left one to the right one?\n\n+#       d-------e               d-------e    \n+#        \\       \\               \\       \\   \n+#         n---o---w     ===>      n---o   \\\n+#              \\                       \\   \\ \n+#               z                       z---W\n\nIf w were a merge of o into e (i.e. w^1 were e not o), what should\nhappen?  Would we get the same topology?\n\nIn other words, when asked to replay w on top of z, how would we\ndecide which parent to keep (in this case, e is kept)?\n\n> +test_expect_success \"rebase -p can re-create two branches on onto\" \"\n> +     reset_rebase &&\n> +     git rebase -p --onto c d w &&\n> +     test_cmp_rev c HEAD~3 &&\n> +     test_cmp_rev c HEAD^2^ &&\n> +     test_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD\n> +\"\n\nNice (so are all the rest).\n"},{"id":"219432","messageId":"CANiSa6jSFVykguWgF_n=N+TqTC6VLf-gyzYgetKAKO9kLnbGzQ@mail.gmail.com","threadId":"31582","inReplyTo":"51AD860B.1070507@viscovery.net","subject":"Re: [PATCH v5 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-05T04:31:01Z","receivedAt":"2013-06-05T04:31:01Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Mon, Jun 3, 2013 at 11:15 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 6/4/2013 7:14, schrieb Martin von Zweigbergk:\n>> On Mon, Jun 3, 2013 at 3:28 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>>> +\n>>>> +# checks that the revisions in \"$2\" represent a linear range with the\n>>>> +# subjects in \"$1\"\n>>>> +test_linear_range () {\n>>>> +     ! { git log --format=%p \"$2\" | sane_grep \" \" ;} &&\n>>>\n>>> An interesting way to spell:\n>>>\n>>>     test $(git rev-list --merges \"$2\" | wc -l) = 0\n>>\n>> Heh, true. I'll change that.\n>\n> Then I think it would be even better written as\n>\n>         revlist_merges=$(git rev-list --merges \"$2\") &&\n>         test -z \"$revlist_merges\"\n>\n> so as not to ignore errors in the git invocation (and at least one less\n> fork()).\n\nDone. I'll send it out in a day or two.\n"},{"id":"219435","messageId":"CANiSa6hGasdoeTtBp_DRaeo++LBPXL9D61EtmVLPz-YSGT-Jgw@mail.gmail.com","threadId":"31582","inReplyTo":"7vk3m994mu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v5 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-05T05:44:21Z","receivedAt":"2013-06-05T05:44:21Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Tue, Jun 4, 2013 at 10:18 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Martin von Zweigbergk <martinvonz@gmail.com> writes:\n>\n>> ---\n>> +#TODO: make all flavors of rebase use --topo-order\n>> +test_run_rebase success 'e n o' ''\n>> +test_run_rebase success 'e n o' -m\n>> +test_run_rebase success 'n o e' -i\n>\n> I do not quite follow this TODO.\n>\n> While I think it would be nice to update \"rebase\" so that all\n> variants consider replaying the commits in the same order, in this\n> history you have:\n>\n> +# a---b-----------c\n> +#      \\           \\\n> +#       d-------e   \\\n> +#        \\       \\   \\\n> +#         n---o---w---v\n> +#              \\\n> +#               z\n>\n> as long as o comes after n and e is shown before n or after o, which\n> all three expected results satisify, it is in --topo-order, isn't it?\n\nTrue, the TODO was too specific. I intended to get the list of commits\nto rebase for all kinds of rebase by using 'git rev-list\n--topo-order', but it doesn't really matter how the order is decided;\nmy goal was just to make it consistent. I'll update the TODOs.\n\n>> +test_expect_success \"rebase -p re-creates merge from side branch\" \"\n>> +     reset_rebase &&\n>> +     git rebase -p z w &&\n>> +     test_cmp_rev z HEAD^ &&\n>> +     test_cmp_rev w^2 HEAD^2\n>> +\"\n>\n> Hmm, turning the left one to the right one?\n>\n> +#       d-------e               d-------e\n> +#        \\       \\               \\       \\\n> +#         n---o---w     ===>      n---o   \\\n> +#              \\                       \\   \\\n> +#               z                       z---W\n>\n> If w were a merge of o into e (i.e. w^1 were e not o), what should\n> happen?  Would we get the same topology?\n\nYes, it seems like it does yield the same topology. That seems to be\nwhat I tested at first. Search for \"wrong\" in [1]. I think Johannes's\npoint was that it was not realistic, not that he's against it working\nin the same way independent of parent order. I don't feel strongly on\nwhether to include a test for each direction. Unless others do, I\nguess I'll leave it as is. (But I did add a test case just now to see,\nso it's very little work for me if someone does want it included.)\n\n> In other words, when asked to replay w on top of z, how would we\n> decide which parent to keep (in this case, e is kept)?\n\nKeep any parent that is not an ancestor of the new base? Or something like that.\n\n\n  [1] http://thread.gmane.org/gmane.comp.version-control.git/205796/focus=205806\n"},{"id":"219436","messageId":"51AED6B8.8080406@viscovery.net","threadId":"31582","inReplyTo":"7vk3m994mu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v5 5/7] add tests for rebasing merged history","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-06-05T06:12:08Z","receivedAt":"2013-06-05T06:12:08Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/4/2013 19:18, schrieb Junio C Hamano:\n> Martin von Zweigbergk <martinvonz@gmail.com> writes:\n> \n>> ---\n>> +#TODO: make all flavors of rebase use --topo-order\n>> +test_run_rebase success 'e n o' ''\n>> +test_run_rebase success 'e n o' -m\n>> +test_run_rebase success 'n o e' -i\n> \n> I do not quite follow this TODO.\n> \n> While I think it would be nice to update \"rebase\" so that all\n> variants consider replaying the commits in the same order, in this\n> history you have:\n> \n> +# a---b-----------c\n> +#      \\           \\\n> +#       d-------e   \\\n> +#        \\       \\   \\\n> +#         n---o---w---v\n> +#              \\\n> +#               z\n> \n> as long as o comes after n and e is shown before n or after o, which\n> all three expected results satisify, it is in --topo-order, isn't it?\n\nThe comment is really just about the inconsistency, not about a request to\nhave a guaranteed order among the parents of a merge commit.\n\nHaving said that, wouldn't it be useful (generally, not just in this\ncontext) to have a guarantee in which order --topo-order lists parents of\na merge?\n\n>> +test_expect_success \"rebase -p re-creates merge from side branch\" \"\n>> +     reset_rebase &&\n>> +     git rebase -p z w &&\n>> +     test_cmp_rev z HEAD^ &&\n>> +     test_cmp_rev w^2 HEAD^2\n>> +\"\n> \n> Hmm, turning the left one to the right one?\n> \n> +#       d-------e               d-------e    \n> +#        \\       \\               \\       \\   \n> +#         n---o---w     ===>      n---o   \\\n> +#              \\                       \\   \\ \n> +#               z                       z---W\n> \n> If w were a merge of o into e (i.e. w^1 were e not o), what should\n> happen?  Would we get the same topology?\n\n'git rebase -p z w' is a nonsense request in this situation. (I.e., there\nis no requirement on the result.) At best, we could detect it and bail out\nor warn.\n\n-- Hannes\n"},{"id":"219606","messageId":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370292135-1236-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 0/8] Rebase topology test","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:36Z","receivedAt":"2013-06-07T06:11:36Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Changes since v5:\n\n * Improved test_linear_range\n * Changed TODOs to be about consistency, not --topo-order\n\nMartin von Zweigbergk (7):\n  add simple tests of consistency across rebase types\n  add tests for rebasing with patch-equivalence present\n  add tests for rebasing of empty commits\n  add tests for rebasing root\n  add tests for rebasing merged history\n  t3406: modernize style\n  tests: move test for rebase messages from t3400 to t3406\n\n t/lib-rebase.sh                   |  33 ++++\n t/t3400-rebase.sh                 |  53 +-----\n t/t3401-rebase-partial.sh         |  69 --------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3406-rebase-message.sh         |  50 +++---\n t/t3409-rebase-preserve-merges.sh |  53 ------\n t/t3421-rebase-topology-linear.sh | 350 ++++++++++++++++++++++++++++++++++++++\n t/t3425-rebase-topology-merges.sh | 258 ++++++++++++++++++++++++++++\n 8 files changed, 673 insertions(+), 203 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3421-rebase-topology-linear.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219600","messageId":"1370585503-11374-2-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 1/7] add simple tests of consistency across rebase types","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:37Z","receivedAt":"2013-06-07T06:11:37Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Helped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/lib-rebase.sh                   | 16 ++++++++\n t/t3421-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 94 insertions(+)\n create mode 100755 t/t3421-rebase-topology-linear.sh\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 6ccf797..1e0ff28 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -65,3 +65,19 @@ EOF\n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n \tchmod a+x fake-editor.sh\n }\n+\n+# checks that the revisions in \"$2\" represent a linear range with the\n+# subjects in \"$1\"\n+test_linear_range () {\n+\trevlist_merges=$(git rev-list --merges \"$2\") &&\n+\ttest -z \"$revlist_merges\" &&\n+\texpected=$1\n+\tset -- $(git log --reverse --format=%s \"$2\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+reset_rebase () {\n+\ttest_might_fail git rebase --abort &&\n+\tgit reset --hard &&\n+\tgit clean -f\n+}\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nnew file mode 100755\nindex 0000000..60365d1\n--- /dev/null\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+test_description='basic rebase topology tests'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+test_expect_success 'setup' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"simple rebase $*\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c e &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd e' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* is no-op if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* b e &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f b e &&\n+\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev b HEAD~2 &&\n+\t\ttest_linear_range 'd e' b..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* fast-forwards from ancestor of upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e b &&\n+\t\ttest_cmp_rev e HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219601","messageId":"1370585503-11374-3-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 2/7] add tests for rebasing with patch-equivalence present","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:38Z","receivedAt":"2013-06-07T06:11:38Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/lib-rebase.sh                   | 17 ++++++++\n t/t3421-rebase-topology-linear.sh | 85 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 1e0ff28..4b74ae4 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -81,3 +81,20 @@ reset_rebase () {\n \tgit reset --hard &&\n \tgit clean -f\n }\n+\n+cherry_pick () {\n+\tgit cherry-pick -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+revert () {\n+\tgit revert -n \"$2\" &&\n+\tgit commit -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\n+\n+make_empty () {\n+\tgit commit --allow-empty -m \"$1\" &&\n+\tgit tag \"$1\"\n+}\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 60365d1..ddcbfc6 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -75,4 +75,89 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for range selection tests' '\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h i &&\n+\t\ttest_cmp_rev h HEAD~2 &&\n+\t\ttest_linear_range 'd i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* can drop last patch if in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* h G &&\n+\t\ttest_cmp_rev h HEAD^ &&\n+\t\ttest_linear_range 'd' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto drops patches in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto f h i &&\n+\t\ttest_cmp_rev f HEAD~2 &&\n+\t\ttest_linear_range 'd i' f..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto does not drop patches in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto h f i &&\n+\t\ttest_cmp_rev h HEAD~3 &&\n+\t\ttest_linear_range 'd G i' h..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219602","messageId":"1370585503-11374-4-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 3/7] add tests for rebasing of empty commits","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:39Z","receivedAt":"2013-06-07T06:11:39Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/t3401-rebase-partial.sh         | 24 ----------------\n t/t3421-rebase-topology-linear.sh | 58 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 58 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\nindex 58f4823..7ba1797 100755\n--- a/t/t3401-rebase-partial.sh\n+++ b/t/t3401-rebase-partial.sh\n@@ -42,28 +42,4 @@ test_expect_success 'rebase --merge topic branch that was partially merged upstr\n \ttest_path_is_missing .git/rebase-merge\n '\n \n-test_expect_success 'rebase ignores empty commit' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m empty &&\n-\ttest_commit D &&\n-\tgit rebase C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\"\n-'\n-\n-test_expect_success 'rebase --keep-empty' '\n-\tgit reset --hard D &&\n-\tgit rebase --keep-empty C &&\n-\ttest \"$(git log --format=%s C..)\" = \"D\n-empty\"\n-'\n-\n-test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '\n-\tgit reset --hard A &&\n-\tgit commit --allow-empty -m also-empty &&\n-\tgit rebase --keep-empty D &&\n-\ttest \"$(git log --format=%s A..)\" = \"also-empty\n-D\n-empty\"\n-'\n-\n test_done\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex ddcbfc6..f19f0d0 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -160,4 +160,62 @@ test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n+# a---b---c---j!\n+#      \\\n+#       d---k!--l\n+#\n+# ! = empty\n+test_expect_success 'setup of linear history for empty commit tests' '\n+\tgit checkout c &&\n+\tmake_empty j &&\n+\tgit checkout d &&\n+\tmake_empty k &&\n+\ttest_commit l\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* drops empty commit\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c l &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'd l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty c l &&\n+\t\ttest_cmp_rev c HEAD~3 &&\n+\t\ttest_linear_range 'd k l' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --keep-empty keeps empty even if already in upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --keep-empty j l &&\n+\t\ttest_cmp_rev j HEAD~3 &&\n+\t\ttest_linear_range 'd k l' j..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219604","messageId":"1370585503-11374-5-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 4/7] add tests for rebasing root","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:40Z","receivedAt":"2013-06-07T06:11:40Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/t3421-rebase-topology-linear.sh | 129 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 129 insertions(+)\n\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex f19f0d0..e67add6 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -218,4 +218,133 @@ test_run_rebase failure -m\n test_run_rebase failure -i\n test_run_rebase failure -p\n \n+#       m\n+#      /\n+# a---b---c---g\n+#\n+# x---y---B\n+#\n+# uppercase = cherry-picked\n+# m = reverted b\n+#\n+# Reverted patches are there for tests to be able to check if a commit\n+# that introduced the same change as another commit is\n+# dropped. Without reverted commits, we could get false positives\n+# because applying the patch succeeds, but simply results in no\n+# changes.\n+test_expect_success 'setup of linear history for test involving root' '\n+\tgit checkout b &&\n+\trevert m b &&\n+\tgit checkout --orphan disjoint &&\n+\tgit rm -rf . &&\n+\ttest_commit x &&\n+\ttest_commit y &&\n+\tcherry_pick B b\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto c --root y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c y &&\n+\t\ttest_cmp_rev c HEAD~2 &&\n+\t\ttest_linear_range 'x y' c..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --onto --root with merge-base does not go to root\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --onto m --root g &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'c g' m..\n+\t\"\n+}\n+\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* without --onto --root with disjoint history drops patch in onto\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* m B &&\n+\t\ttest_cmp_rev m HEAD~2 &&\n+\t\ttest_linear_range 'x y' m..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase failure -m\n+test_run_rebase success -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* --root on linear history is a no-op\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* --root c &&\n+\t\ttest_cmp_rev c HEAD\n+\t\"\n+}\n+test_run_rebase failure ''\n+test_run_rebase failure -m\n+test_run_rebase failure -i\n+test_run_rebase failure -p\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* -f --root c &&\n+\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_linear_range 'a b c' HEAD\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+test_run_rebase success -p\n+\n test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219607","messageId":"1370585503-11374-6-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 5/7] add tests for rebasing merged history","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:41Z","receivedAt":"2013-06-07T06:11:41Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/t3400-rebase.sh                 |  31 +----\n t/t3401-rebase-partial.sh         |  45 -------\n t/t3404-rebase-interactive.sh     |  10 +-\n t/t3409-rebase-preserve-merges.sh |  53 --------\n t/t3425-rebase-topology-merges.sh | 258 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 260 insertions(+), 137 deletions(-)\n delete mode 100755 t/t3401-rebase-partial.sh\n create mode 100755 t/t3425-rebase-topology-merges.sh\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b58fa1a..b436ef4 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '\n \techo Side >>C &&\n \tgit add C &&\n \tgit commit -m \"Add C\" &&\n-\tgit checkout -b nonlinear my-topic-branch &&\n-\techo Edit >>B &&\n-\tgit add B &&\n-\tgit commit -m \"Modify B\" &&\n-\tgit merge side &&\n-\tgit checkout -b upstream-merged-nonlinear &&\n-\tgit merge master &&\n \tgit checkout -f my-topic-branch &&\n \tgit tag topic\n '\n@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase after merge master' '\n-\tgit checkout --detach refs/tags/topic &&\n-\tgit branch -D topic &&\n-\tgit reset --hard topic &&\n-\tgit merge master &&\n-\tgit rebase master &&\n-\t! (git show | grep \"^Merge:\")\n-'\n-\n-test_expect_success 'rebase of history with merges is linearized' '\n-\tgit checkout nonlinear &&\n-\ttest 4 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n-test_expect_success 'rebase of history with merges after upstream merge is linearized' '\n-\tgit checkout upstream-merged-nonlinear &&\n-\ttest 5 = $(git rev-list master.. | wc -l) &&\n-\tgit rebase master &&\n-\ttest 3 = $(git rev-list master.. | wc -l)\n-'\n-\n test_expect_success 'rebase a single mode change' '\n \tgit checkout master &&\n+\tgit branch -D topic &&\n \techo 1 >X &&\n \tgit add X &&\n \ttest_tick &&\ndiff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh\ndeleted file mode 100755\nindex 7ba1797..0000000\n--- a/t/t3401-rebase-partial.sh\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland\n-#\n-\n-test_description='git rebase should detect patches integrated upstream\n-\n-This test cherry-picks one local change of two into master branch, and\n-checks that git rebase succeeds with only the second patch in the\n-local branch.\n-'\n-. ./test-lib.sh\n-\n-test_expect_success 'prepare repository with topic branch' '\n-\ttest_commit A &&\n-\tgit checkout -b my-topic-branch &&\n-\ttest_commit B &&\n-\ttest_commit C &&\n-\tgit checkout -f master &&\n-\ttest_commit A2 A.t\n-'\n-\n-test_expect_success 'pick top patch from topic branch into master' '\n-\tgit cherry-pick C &&\n-\tgit checkout -f my-topic-branch\n-'\n-\n-test_debug '\n-\tgit cherry master &&\n-\tgit format-patch -k --stdout --full-index master >/dev/null &&\n-\tgitk --all & sleep 1\n-'\n-\n-test_expect_success 'rebase topic branch against new master and check git am did not get halted' '\n-\tgit rebase master &&\n-\ttest_path_is_missing .git/rebase-apply\n-'\n-\n-test_expect_success 'rebase --merge topic branch that was partially merged upstream' '\n-\tgit reset --hard C &&\n-\tgit rebase --merge master &&\n-\ttest_path_is_missing .git/rebase-merge\n-'\n-\n-test_done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a58406d..ffcaf02 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '\n \ttest $one = $(git rev-parse HEAD~2)\n '\n \n-test_expect_success 'ignore patch if in upstream' '\n-\tHEAD=$(git rev-parse HEAD) &&\n-\tgit checkout -b has-cherry-picked HEAD^ &&\n+test_expect_success '--continue tries to commit, even for \"edit\"' '\n \techo unrelated > file7 &&\n \tgit add file7 &&\n \ttest_tick &&\n \tgit commit -m \"unrelated change\" &&\n-\tgit cherry-pick $HEAD &&\n-\tEXPECT_COUNT=1 git rebase -i $HEAD &&\n-\ttest $HEAD = $(git rev-parse HEAD^)\n-'\n-\n-test_expect_success '--continue tries to commit, even for \"edit\"' '\n \tparent=$(git rev-parse HEAD^) &&\n \ttest_tick &&\n \tFAKE_LINES=\"edit 1\" git rebase -i HEAD^ &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 6de4e22..2e0c364 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -11,14 +11,6 @@ Run \"git rebase -p\" and check that merges are properly carried along\n GIT_AUTHOR_EMAIL=bogus_email_address\n export GIT_AUTHOR_EMAIL\n \n-# Clone 1 (trivial merge):\n-#\n-# A1--A2  <-- origin/master\n-#  \\   \\\n-#   B1--M  <-- topic\n-#    \\\n-#     B2  <-- origin/topic\n-#\n # Clone 2 (conflicting merge):\n #\n # A1--A2--B3   <-- origin/master\n@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL\n #     \\--A3    <-- topic2\n #      \\\n #       B2     <-- origin/topic\n-#\n-# Clone 4 (merge using second parent as base):\n-#\n-# A1--A2--B3   <-- origin/master\n-#  \\\n-#   B1--A3--M  <-- topic\n-#    \\     /\n-#     \\--A4    <-- topic2\n-#      \\\n-#       B2     <-- origin/topic\n \n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit checkout -f master &&\n \techo Third >> A &&\n \tgit commit -a -m \"Modify A2\" &&\n-\n-\tgit clone ./. clone1 &&\n-\t(cd clone1 &&\n-\tgit checkout -b topic origin/topic &&\n-\tgit merge origin/master\n-\t) &&\n-\n-\tgit clone ./. clone4 &&\n-\t(\n-\t\tcd clone4 &&\n-\t\tgit checkout -b topic origin/topic &&\n-\t\tgit merge origin/master\n-\t) &&\n-\n \techo Fifth > B &&\n \tgit add B &&\n \tgit commit -m \"Add different B\" &&\n@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \\\n \tgit commit -a -m \"Modify B2\"\n '\n \n-test_expect_success 'rebase -p fakes interactive rebase' '\n-\t(\n-\tcd clone1 &&\n-\tgit fetch &&\n-\tgit rebase -p origin/topic &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_expect_success '--continue works after a conflict' '\n \t(\n \tcd clone2 &&\n@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '\n \t)\n '\n \n-test_expect_success 'rebase -p works when base inside second parent' '\n-\t(\n-\tcd clone4 &&\n-\tgit fetch &&\n-\tgit rebase -p HEAD^2 &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Modify B\" | wc -l) &&\n-\ttest 1 = $(git rev-list --all --pretty=oneline | grep \"Merge remote-tracking branch \" | wc -l)\n-\t)\n-'\n-\n test_done\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nnew file mode 100755\nindex 0000000..5400a05\n--- /dev/null\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -0,0 +1,258 @@\n+#!/bin/sh\n+\n+test_description='rebase topology tests with merges'\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n+\n+test_revision_subjects () {\n+\texpected=\"$1\"\n+\tshift\n+\tset -- $(git log --format=%s --no-walk=unsorted \"$@\")\n+\ttest \"$expected\" = \"$*\"\n+}\n+\n+# a---b-----------c\n+#      \\           \\\n+#       d-------e   \\\n+#        \\       \\   \\\n+#         n---o---w---v\n+#              \\\n+#               z\n+test_expect_success 'setup of non-linear-history' '\n+\ttest_commit a &&\n+\ttest_commit b &&\n+\ttest_commit c &&\n+\tgit checkout b &&\n+\ttest_commit d &&\n+\ttest_commit e\n+\n+\tgit checkout c &&\n+\ttest_commit g &&\n+\trevert h g &&\n+\tgit checkout d &&\n+\tcherry_pick G g &&\n+\ttest_commit i &&\n+\tgit checkout b &&\n+\ttest_commit f\n+\n+\tgit checkout d &&\n+\ttest_commit n &&\n+\ttest_commit o &&\n+\ttest_merge w e &&\n+\ttest_merge v c &&\n+\tgit checkout o &&\n+\ttest_commit z\n+'\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* after merge from upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* e w &&\n+\t\ttest_cmp_rev e HEAD~2 &&\n+\t\ttest_linear_range 'n o' e..\n+\t\"\n+}\n+test_run_rebase success ''\n+test_run_rebase success -m\n+test_run_rebase success -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized in place\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* d w &&\n+\t\ttest_cmp_rev d HEAD~3 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n+\t\"\n+}\n+#TODO: make order consistent across all flavors of rebase\n+test_run_rebase success 'e n o' ''\n+test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history is linearized upstream\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c w &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make order consistent across all flavors of rebase\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_run_rebase () {\n+\tresult=$1\n+\tshift\n+\texpected=$1\n+\tshift\n+\ttest_expect_$result \"rebase $* of non-linear history with merges after upstream merge is linearized\" \"\n+\t\treset_rebase &&\n+\t\tgit rebase $* c v &&\n+\t\ttest_cmp_rev c HEAD~4 &&\n+\t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n+\t\"\n+}\n+#TODO: make order consistent across all flavors of rebase\n+test_run_rebase success 'd e n o' ''\n+test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -i\n+\n+test_expect_success \"rebase -p is no-op in non-linear history\" \"\n+\treset_rebase &&\n+\tgit rebase -p d w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p is no-op when base inside second parent\" \"\n+\treset_rebase &&\n+\tgit rebase -p e w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_failure \"rebase -p --root on non-linear history is a no-op\" \"\n+\treset_rebase &&\n+\tgit rebase -p --root w &&\n+\ttest_cmp_rev w HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates merge from side branch\" \"\n+\treset_rebase &&\n+\tgit rebase -p z w &&\n+\ttest_cmp_rev z HEAD^ &&\n+\ttest_cmp_rev w^2 HEAD^2\n+\"\n+\n+test_expect_success \"rebase -p re-creates internal merge\" \"\n+\treset_rebase &&\n+\tgit rebase -p c w &&\n+\ttest_cmp_rev c HEAD~4 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~3 &&\n+\ttest_revision_subjects 'd n e o w' HEAD~3 HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p can re-create two branches on onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto c d w &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev c HEAD^2^ &&\n+\ttest_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+#       f\n+#      /\n+# a---b---c---g---h\n+#      \\\n+#       d---G---i\n+#        \\       \\\n+#         e-------u\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n+\tgit checkout e &&\n+\ttest_merge u i\n+'\n+\n+test_expect_success \"rebase -p re-creates history around dropped commit matching upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p h u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history drops patches in upstream\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto f h u &&\n+\ttest_cmp_rev f HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd i e u' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p --onto in merged history does not drop patches in onto\" \"\n+\treset_rebase &&\n+\tgit rebase -p --onto h f u &&\n+\ttest_cmp_rev h HEAD~3 &&\n+\ttest_cmp_rev HEAD^2~2 HEAD~2 &&\n+\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\"\n+\n+# a---b---c---g---h\n+#      \\\n+#       d---G---s\n+#        \\   \\ /\n+#         \\   X\n+#          \\ / \\\n+#           e---t\n+#\n+# uppercase = cherry-picked\n+# h = reverted g\n+test_expect_success 'setup of non-linear-history for dropping whole side' '\n+\tgit checkout G &&\n+\ttest_merge s e &&\n+\tgit checkout e &&\n+\ttest_merge t G\n+'\n+\n+test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h s &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+test_expect_success \"rebase -p drops merge commit when entire second-parent side is dropped\" \"\n+\treset_rebase &&\n+\tgit rebase -p h t &&\n+\ttest_cmp_rev h HEAD~2 &&\n+\ttest_linear_range 'd e' h..\n+\"\n+\n+# a---b---c\n+#      \\\n+#       d---e\n+#        \\   \\\n+#         n---r\n+#          \\\n+#           o\n+#\n+# r = tree-same with n\n+test_expect_success 'setup of non-linear-history for empty commits' '\n+\tgit checkout n &&\n+\tgit merge --no-commit e &&\n+\tgit reset n . &&\n+\tgit commit -m r &&\n+\tgit reset --hard &&\n+\tgit clean -f &&\n+\tgit tag r\n+'\n+\n+test_expect_success \"rebase -p re-creates empty internal merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p c r &&\n+\ttest_cmp_rev c HEAD~3 &&\n+\ttest_cmp_rev HEAD^2^ HEAD~2 &&\n+\ttest_revision_subjects 'd e n r' HEAD~2 HEAD^2 HEAD^ HEAD\n+\"\n+\n+test_expect_success \"rebase -p re-creates empty merge commit\" \"\n+\treset_rebase &&\n+\tgit rebase -p o r &&\n+\ttest_cmp_rev e HEAD^2 &&\n+\ttest_cmp_rev o HEAD^ &&\n+\ttest_revision_subjects 'r' HEAD\n+\"\n+\n+test_done\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219605","messageId":"1370585503-11374-7-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 6/7] t3406: modernize style","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:42Z","receivedAt":"2013-06-07T06:11:42Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Update the following:\n\n - Quote 'setup'\n - Remove blank lines within test case body\n - Use test_commit instead of custom quick_one\n - Create branch \"topic\" from tag created by test_commit\n\nSigned-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/t3406-rebase-message.sh | 30 +++++++++---------------------\n 1 file changed, 9 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex e6a9a0d..fe8c27f 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -4,27 +4,17 @@ test_description='messages from rebase operation'\n \n . ./test-lib.sh\n \n-quick_one () {\n-\techo \"$1\" >\"file$1\" &&\n-\tgit add \"file$1\" &&\n-\ttest_tick &&\n-\tgit commit -m \"$1\"\n-}\n+test_expect_success 'setup' '\n+\ttest_commit O fileO &&\n+\ttest_commit X fileX &&\n+\ttest_commit A fileA &&\n+\ttest_commit B fileB &&\n+\ttest_commit Y fileY &&\n \n-test_expect_success setup '\n-\tquick_one O &&\n-\tgit branch topic &&\n-\tquick_one X &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Y &&\n-\n-\tgit checkout topic &&\n-\tquick_one A &&\n-\tquick_one B &&\n-\tquick_one Z &&\n+\tgit checkout -b topic O &&\n+\tgit cherry-pick A B &&\n+\ttest_commit Z fileZ &&\n \tgit tag start\n-\n '\n \n cat >expect <<\\EOF\n@@ -34,12 +24,10 @@ Committed: 0003 Z\n EOF\n \n test_expect_success 'rebase -m' '\n-\n \tgit rebase -m master >report &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\n-\n '\n \n test_expect_success 'rebase --stat' '\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219603","messageId":"1370585503-11374-8-git-send-email-martinvonz@gmail.com","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH v6 7/7] tests: move test for rebase messages from t3400 to t3406","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-07T06:11:43Z","receivedAt":"2013-06-07T06:11:43Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"t3406 is supposed to test \"messages from rebase operation\", so let's\nmove tests in t3400 that fit that description into 3406. Most of the\nfunctionality they tested, except for the messages, has now been\nsubsumed by t3420.\n\nSigned-off-by: Martin von Zweigbergk <martinvonz@gmail.com>\n---\n t/t3400-rebase.sh         | 22 ----------------------\n t/t3406-rebase-message.sh | 22 ++++++++++++++++++++++\n 2 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex b436ef4..45a55e9 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -59,28 +59,6 @@ test_expect_success 'rebase against master' '\n \tgit rebase master\n '\n \n-test_expect_success 'rebase against master twice' '\n-\tgit rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase against master twice with --force' '\n-\tgit rebase --force-rebase master >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date, rebase forced\" out\n-'\n-\n-test_expect_success 'rebase against master twice from another branch' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase master my-topic-branch >out &&\n-\ttest_i18ngrep \"Current branch my-topic-branch is up to date\" out\n-'\n-\n-test_expect_success 'rebase fast-forward to master' '\n-\tgit checkout my-topic-branch^ &&\n-\tgit rebase my-topic-branch >out &&\n-\ttest_i18ngrep \"Fast-forwarded HEAD to my-topic-branch\" out\n-'\n-\n test_expect_success 'the rebase operation should not have destroyed author information' '\n \t! (git log | grep \"Author:\" | grep \"<>\")\n '\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex fe8c27f..0392e36 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -30,6 +30,28 @@ test_expect_success 'rebase -m' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'rebase against master twice' '\n+\tgit rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase against master twice with --force' '\n+\tgit rebase --force-rebase master >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date, rebase forced\" out\n+'\n+\n+test_expect_success 'rebase against master twice from another branch' '\n+\tgit checkout topic^ &&\n+\tgit rebase master topic >out &&\n+\ttest_i18ngrep \"Current branch topic is up to date\" out\n+'\n+\n+test_expect_success 'rebase fast-forward to master' '\n+\tgit checkout topic^ &&\n+\tgit rebase topic >out &&\n+\ttest_i18ngrep \"Fast-forwarded HEAD to topic\" out\n+'\n+\n test_expect_success 'rebase --stat' '\n \tgit reset --hard start &&\n         git rebase --stat master >diffstat.txt &&\n-- \n1.8.3.497.g83fddbe\n"},{"id":"219646","messageId":"7vppvxub0s.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v6 0/8] Rebase topology test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-07T16:43:31Z","receivedAt":"2013-06-07T16:43:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin von Zweigbergk <martinvonz@gmail.com> writes:\n\n> Changes since v5:\n>\n>  * Improved test_linear_range\n>  * Changed TODOs to be about consistency, not --topo-order\n\nThanks, looked sensible.\n"},{"id":"219686","messageId":"51B23661.5050002@kdbg.org","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"Re: [PATCH v6 0/8] Rebase topology test","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2013-06-07T19:37:05Z","receivedAt":"2013-06-07T19:37:05Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 07.06.2013 08:11, schrieb Martin von Zweigbergk:\n> Changes since v5:\n> \n>  * Improved test_linear_range\n>  * Changed TODOs to be about consistency, not --topo-order\n> \n> Martin von Zweigbergk (7):\n>   add simple tests of consistency across rebase types\n>   add tests for rebasing with patch-equivalence present\n>   add tests for rebasing of empty commits\n>   add tests for rebasing root\n>   add tests for rebasing merged history\n>   t3406: modernize style\n>   tests: move test for rebase messages from t3400 to t3406\n\nI looked at the interdiff to v3 and have nothing to add.\n\nWell done! Thanks.\n\n-- Hannes\n"},{"id":"221156","messageId":"51C00C07.6080600@viscovery.net","threadId":"31582","inReplyTo":"1370585503-11374-1-git-send-email-martinvonz@gmail.com","subject":"[PATCH mz/rebase-tests] rebase topology tests: fix commit names on case-insensitive file systems","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-06-18T07:28:07Z","receivedAt":"2013-06-18T07:28:07Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nThe recently introduced tests used uppercase letters to denote\ncherry-picks of commits having the corresponding lowercase letter names.\nThe helper functions also set up tags with the names of the commits.\n\nBut this constellation fails on case-insensitive file systems because\nthere cannot be distinct tags with names that differ only in case.\n\nUse a less subtle convention for the names of cherry-picked commits.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n Knowing that the tests would take their time to complete on Windows,\n today was the first time I ran them, and there were some unexpected\n issues. Fixed by this patch.\n\n t/t3421-rebase-topology-linear.sh | 20 ++++++++++----------\n t/t3425-rebase-topology-merges.sh | 16 ++++++++--------\n 2 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex e67add6..9c55cba 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -79,9 +79,9 @@ test_run_rebase success -p\n #      /\n # a---b---c---g---h\n #      \\\n-#       d---G---i\n+#       d---gp--i\n #\n-# uppercase = cherry-picked\n+# gp = cherry-picked g\n # h = reverted g\n #\n # Reverted patches are there for tests to be able to check if a commit\n@@ -94,7 +94,7 @@ test_expect_success 'setup of linear history for range selection tests' '\n \ttest_commit g &&\n \trevert h g &&\n \tgit checkout d &&\n-\tcherry_pick G g &&\n+\tcherry_pick gp g &&\n \ttest_commit i &&\n \tgit checkout b &&\n \ttest_commit f\n@@ -120,7 +120,7 @@ test_run_rebase () {\n \tshift\n \ttest_expect_$result \"rebase $* can drop last patch if in upstream\" \"\n \t\treset_rebase &&\n-\t\tgit rebase $* h G &&\n+\t\tgit rebase $* h gp &&\n \t\ttest_cmp_rev h HEAD^ &&\n \t\ttest_linear_range 'd' h..\n \t\"\n@@ -152,7 +152,7 @@ test_run_rebase () {\n \t\treset_rebase &&\n \t\tgit rebase $* --onto h f i &&\n \t\ttest_cmp_rev h HEAD~3 &&\n-\t\ttest_linear_range 'd G i' h..\n+\t\ttest_linear_range 'd gp i' h..\n \t\"\n }\n test_run_rebase success ''\n@@ -222,9 +222,9 @@ test_run_rebase failure -p\n #      /\n # a---b---c---g\n #\n-# x---y---B\n+# x---y---bp\n #\n-# uppercase = cherry-picked\n+# bp = cherry-picked b\n # m = reverted b\n #\n # Reverted patches are there for tests to be able to check if a commit\n@@ -239,7 +239,7 @@ test_expect_success 'setup of linear history for test involving root' '\n \tgit rm -rf . &&\n \ttest_commit x &&\n \ttest_commit y &&\n-\tcherry_pick B b\n+\tcherry_pick bp b\n '\n \n test_run_rebase () {\n@@ -277,7 +277,7 @@ test_run_rebase () {\n \tshift\n \ttest_expect_$result \"rebase $* --onto --root drops patch in onto\" \"\n \t\treset_rebase &&\n-\t\tgit rebase $* --onto m --root B &&\n+\t\tgit rebase $* --onto m --root bp &&\n \t\ttest_cmp_rev m HEAD~2 &&\n \t\ttest_linear_range 'x y' m..\n \t\"\n@@ -308,7 +308,7 @@ test_run_rebase () {\n \tshift\n \ttest_expect_$result \"rebase $* without --onto --root with disjoint history drops patch in onto\" \"\n \t\treset_rebase &&\n-\t\tgit rebase $* m B &&\n+\t\tgit rebase $* m bp &&\n \t\ttest_cmp_rev m HEAD~2 &&\n \t\ttest_linear_range 'x y' m..\n \t\"\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 5400a05..1d195fb 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -30,7 +30,7 @@ test_expect_success 'setup of non-linear-history' '\n \ttest_commit g &&\n \trevert h g &&\n \tgit checkout d &&\n-\tcherry_pick G g &&\n+\tcherry_pick gp g &&\n \ttest_commit i &&\n \tgit checkout b &&\n \ttest_commit f\n@@ -154,11 +154,11 @@ test_expect_success \"rebase -p can re-create two branches on onto\" \"\n #      /\n # a---b---c---g---h\n #      \\\n-#       d---G---i\n+#       d---gp--i\n #        \\       \\\n #         e-------u\n #\n-# uppercase = cherry-picked\n+# gp = cherry-picked g\n # h = reverted g\n test_expect_success 'setup of non-linear-history for patch-equivalence tests' '\n \tgit checkout e &&\n@@ -186,24 +186,24 @@ test_expect_success \"rebase -p --onto in merged history does not drop patches in\n \tgit rebase -p --onto h f u &&\n \ttest_cmp_rev h HEAD~3 &&\n \ttest_cmp_rev HEAD^2~2 HEAD~2 &&\n-\ttest_revision_subjects 'd G i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n+\ttest_revision_subjects 'd gp i e u' HEAD~2 HEAD^2^ HEAD^2 HEAD^ HEAD\n \"\n \n # a---b---c---g---h\n #      \\\n-#       d---G---s\n+#       d---gp--s\n #        \\   \\ /\n #         \\   X\n #          \\ / \\\n #           e---t\n #\n-# uppercase = cherry-picked\n+# gp = cherry-picked g\n # h = reverted g\n test_expect_success 'setup of non-linear-history for dropping whole side' '\n-\tgit checkout G &&\n+\tgit checkout gp &&\n \ttest_merge s e &&\n \tgit checkout e &&\n-\ttest_merge t G\n+\ttest_merge t gp\n '\n \n test_expect_failure \"rebase -p drops merge commit when entire first-parent side is dropped\" \"\n-- \n1.8.3.1.1749.g223650b\n"},{"id":"221241","messageId":"7vsj0f779e.fsf@alter.siamese.dyndns.org","threadId":"31582","inReplyTo":"51C00C07.6080600@viscovery.net","subject":"Re: [PATCH mz/rebase-tests] rebase topology tests: fix commit names on case-insensitive file systems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-18T15:45:01Z","receivedAt":"2013-06-18T15:45:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> From: Johannes Sixt <j6t@kdbg.org>\n>\n> The recently introduced tests used uppercase letters to denote\n> cherry-picks of commits having the corresponding lowercase letter names.\n> The helper functions also set up tags with the names of the commits.\n>\n> But this constellation fails on case-insensitive file systems because\n> there cannot be distinct tags with names that differ only in case.\n>\n> Use a less subtle convention for the names of cherry-picked commits.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  Knowing that the tests would take their time to complete on Windows,\n>  today was the first time I ran them, and there were some unexpected\n>  issues. Fixed by this patch.\n\nThanks, will queue on top of that series.\n"},{"id":"221245","messageId":"CANiSa6gWkaC62U8oxo0mRc-G-m3UJJSjq8YSuywBh-omtHO=zQ@mail.gmail.com","threadId":"31582","inReplyTo":"51C00C07.6080600@viscovery.net","subject":"Re: [PATCH mz/rebase-tests] rebase topology tests: fix commit names on case-insensitive file systems","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-06-18T15:53:10Z","receivedAt":"2013-06-18T15:53:10Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Tue, Jun 18, 2013 at 12:28 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>\n> The recently introduced tests used uppercase letters to denote\n> cherry-picks of commits having the corresponding lowercase letter names.\n> The helper functions also set up tags with the names of the commits.\n>\n> But this constellation fails on case-insensitive file systems because\n> there cannot be distinct tags with names that differ only in case.\n>\n> Use a less subtle convention for the names of cherry-picked commits.\n\nMakes sense, and the patch looks good. Thanks.\n\n>  Knowing that the tests would take their time to complete on Windows,\n\nI'm curious just how slow it is. Are we talking minutes?\n"},{"id":"221332","messageId":"51C14721.2050500@viscovery.net","threadId":"31582","inReplyTo":"CANiSa6gWkaC62U8oxo0mRc-G-m3UJJSjq8YSuywBh-omtHO=zQ@mail.gmail.com","subject":"Re: [PATCH mz/rebase-tests] rebase topology tests: fix commit names on case-insensitive file systems","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-06-19T05:52:33Z","receivedAt":"2013-06-19T05:52:33Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/18/2013 17:53, schrieb Martin von Zweigbergk:\n> On Tue, Jun 18, 2013 at 12:28 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>  Knowing that the tests would take their time to complete on Windows,\n> \n> I'm curious just how slow it is. Are we talking minutes?\n\nD:\\Src\\mingw-git\\t>bash -c \"time make t342[15]*\"\n...\nreal    5m7.160s\nuser    0m21.831s\nsys     0m6.376s\n\nThe real time is correct, but I don't think that we can trust user or sys\ntimes as the box was otherwise idle.\n\n-- Hannes\n"}]}