{"thread":{"id":"15640","subject":"[PATCH 2/3] git rebase: Support non-interactive merge-preserving rebase","startedAt":"2008-09-23T20:58:16Z","lastAt":"2008-09-23T20:58:16Z","messageCount":1,"participants":["Andreas Ericsson"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"91424","messageId":"48D95868.7040308@op5.se","threadId":"15640","inReplyTo":null,"subject":"[PATCH 2/3] git rebase: Support non-interactive merge-preserving rebase","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-23T20:58:16Z","receivedAt":"2008-09-23T20:58:16Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Previously, 'git rebase --preserve-merges' would only work\nin interactive mode. For some workflows, this was quite a\nlimitation.\n\nThis patch adds a workaround, invoking the\ngit-rebase--interactive helper with GIT_EDITOR set to :\nin case the user passes \"-p\" but not \"-i\" to the rebase\ncommand.\n\nThe effect is that the interactive rebase helper is used,\nbut the user won't see an editor.\n\nSince this patch fixes the latter of the two expected\ntestfailures in t3409-rebase-preserve-merges, that test\nis now set to expect success.\n\nSigned-off-by: Andreas Ericsson <ae@op5.se>\n---\n Documentation/git-rebase.txt      |    3 +--\n git-rebase.sh                     |   22 +++++++++++++++++++---\n t/t3409-rebase-preserve-merges.sh |    2 +-\n 3 files changed, 21 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 59c1b02..ddec6a6 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -250,8 +250,7 @@ OPTIONS\n \n -p::\n --preserve-merges::\n-\tInstead of ignoring merges, try to recreate them.  This option\n-\tonly works in interactive mode.\n+\tInstead of ignoring merges, try to recreate them.\n \n include::merge-strategies.txt[]\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 528b604..03e5f95 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -138,10 +138,26 @@ finish_rb_merge () {\n }\n \n is_interactive () {\n-\ttest -f \"$dotest\"/interactive ||\n-\twhile :; do case $#,\"$1\" in 0,|*,-i|*,--interactive) break ;; esac\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t\t-i|--interactive)\n+\t\t\t\tinteractive_rebase=explicit\n+\t\t\t\tbreak\n+\t\t\t;;\n+\t\t\t-p|--preserve-merges)\n+\t\t\t\tinteractive_rebase=implied\n+\t\t\t;;\n+\t\tesac\n \t\tshift\n-\tdone && test -n \"$1\"\n+\tdone\n+\n+\tif [ \"$interactive_rebase\" = implied ]; then\n+\t\tGIT_EDITOR=:\n+\t\texport GIT_EDITOR\n+\tfi\n+\n+\ttest -n \"$interactive_rebase\" || test -f \"$dotest\"/interactive\n }\n \n test -f \"$GIT_DIR\"/rebase-apply/applying &&\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex 532b220..21b8c79 100644\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -57,7 +57,7 @@ test_expect_failure 'git pull --rebase -p on moved topic' '\n \ttest $(git rev-list --all --pretty=oneline | grep \"Modify A\" | wc -l) = 1\n '\n \n-test_expect_failure 'rebase -p merge on moved topic' '\n+test_expect_success 'rebase -p merge on moved topic' '\n \tcd ../clone2 &&\n \tgit fetch &&\n \tgit rebase -p origin/topic &&\n-- \n1.6.0.2.307.gc4275.dirty\n"}]}