{"thread":{"id":"33967","subject":"[RFC/PATCH v2 0/8] rebase: new cherry-pick mode","startedAt":"2013-05-29T04:16:32Z","lastAt":"2013-05-30T02:37:52Z","messageCount":21,"participants":["Felipe Contreras","Martin von Zweigbergk","Stefano Lattarini","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":8},"messages":[{"id":"218735","messageId":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":null,"subject":"[RFC/PATCH v2 0/8] rebase: new cherry-pick mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:32Z","receivedAt":"2013-05-29T04:16:32Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nAfter the fixes I did to cherry-pick, it's now fully usable for 'git rebase'\nand can be used to replace 'git am' for most cases.\n\nWe already rely on cherry-pick for the 'am' mode, but only when using the\n--keep-empty option, and when in such mode the behavior of 'git rebase' changes\ncompletely; more specifically; it's completely broken. Manually enabling\n--keep-empty to be the default and running the test-suite shows a huge lot of\nfailures.\n\nAfter fixing the --keep-empty option by creating a new cherry-pick mode, this\npatch series uses this new mode instead of the 'am' mode, and everything works.\n\nThere's only two tests that fail, one because the output of the shell prompt\nchanges a bit, and the other I have not yet investigated.\n\nThis brings us one step closer to replace scripts with C code.\n\nFelipe Contreras (8):\n  rebase: split the cherry-pick stuff\n  rebase: cherry-pick: fix mode storage\n  rebase: cherry-pick: fix sequence continuation\n  rebase: cherry-pick: fix abort of cherry mode\n  rebase: cherry-pick: fix command invocations\n  rebase: cherry-pick: fix status messages\n  rebase: cherry-pick: automatically commit stage\n  rebase: use 'cherrypick' mode instead of 'am'\n\n .gitignore                             |  1 +\n Makefile                               |  1 +\n contrib/completion/git-prompt.sh       |  2 ++\n git-rebase--am.sh                      | 12 ++-----\n git-rebase--cherrypick.sh              | 64 ++++++++++++++++++++++++++++++++++\n git-rebase.sh                          | 11 ++++--\n t/t3407-rebase-abort.sh                |  2 +-\n t/t5520-pull.sh                        |  2 +-\n t/t9106-git-svn-commit-diff-clobber.sh |  2 +-\n 9 files changed, 82 insertions(+), 15 deletions(-)\n create mode 100644 git-rebase--cherrypick.sh\n\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218736","messageId":"1369801000-3705-2-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 1/8] rebase: split the cherry-pick stuff","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:33Z","receivedAt":"2013-05-29T04:16:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"They do something completely different from 'git am', it belongs in a\ndifferent file.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n .gitignore                |  1 +\n Makefile                  |  1 +\n git-rebase--am.sh         | 11 +----------\n git-rebase--cherrypick.sh | 34 ++++++++++++++++++++++++++++++++++\n git-rebase.sh             |  4 ++++\n 5 files changed, 41 insertions(+), 10 deletions(-)\n create mode 100644 git-rebase--cherrypick.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 6669bf0..a171533 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -113,6 +113,7 @@\n /git-read-tree\n /git-rebase\n /git-rebase--am\n+/git-rebase--cherrypick\n /git-rebase--interactive\n /git-rebase--merge\n /git-receive-pack\ndiff --git a/Makefile b/Makefile\nindex 0f931a2..800e42d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -469,6 +469,7 @@ SCRIPT_SH += git-web--browse.sh\n SCRIPT_LIB += git-mergetool--lib\n SCRIPT_LIB += git-parse-remote\n SCRIPT_LIB += git-rebase--am\n+SCRIPT_LIB += git-rebase--cherrypick\n SCRIPT_LIB += git-rebase--interactive\n SCRIPT_LIB += git-rebase--merge\n SCRIPT_LIB += git-sh-setup\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex f84854f..ee1b1b9 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -19,15 +19,7 @@ esac\n test -n \"$rebase_root\" && root_flag=--root\n \n ret=0\n-if test -n \"$keep_empty\"\n-then\n-\t# we have to do this the hard way.  git format-patch completely squashes\n-\t# empty commits and even if it didn't the format doesn't really lend\n-\t# itself well to recording empty patches.  fortunately, cherry-pick\n-\t# makes this easy\n-\tgit cherry-pick --allow-empty \"$revisions\"\n-\tret=$?\n-else\n+\n rm -f \"$GIT_DIR/rebased-patches\"\n \n git format-patch -k --stdout --full-index --ignore-if-in-upstream \\\n@@ -63,7 +55,6 @@ else\n ret=$?\n \n rm -f \"$GIT_DIR/rebased-patches\"\n-fi\n \n if test 0 != $ret\n then\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nnew file mode 100644\nindex 0000000..cbf80f9\n--- /dev/null\n+++ b/git-rebase--cherrypick.sh\n@@ -0,0 +1,34 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2010 Junio C Hamano.\n+#\n+\n+case \"$action\" in\n+continue)\n+\tgit am --resolved --resolvemsg=\"$resolvemsg\" &&\n+\tmove_to_original_branch\n+\texit\n+\t;;\n+skip)\n+\tgit am --skip --resolvemsg=\"$resolvemsg\" &&\n+\tmove_to_original_branch\n+\texit\n+\t;;\n+esac\n+\n+test -n \"$rebase_root\" && root_flag=--root\n+\n+# we have to do this the hard way.  git format-patch completely squashes\n+# empty commits and even if it didn't the format doesn't really lend\n+# itself well to recording empty patches.  fortunately, cherry-pick\n+# makes this easy\n+git cherry-pick --allow-empty \"$revisions\"\n+ret=$?\n+\n+if test 0 != $ret\n+then\n+\ttest -d \"$state_dir\" && write_basic_state\n+\texit $ret\n+fi\n+\n+move_to_original_branch\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 2c692c3..f929ca3 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -379,6 +379,10 @@ elif test -n \"$do_merge\"\n then\n \ttype=merge\n \tstate_dir=\"$merge_dir\"\n+elif test -n \"$keep_empty\"\n+then\n+\ttype=cherrypick\n+\tstate_dir=\"$apply_dir\"\n else\n \ttype=am\n \tstate_dir=\"$apply_dir\"\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218737","messageId":"1369801000-3705-3-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 2/8] rebase: cherry-pick: fix mode storage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:34Z","receivedAt":"2013-05-29T04:16:34Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We don't use the 'rebase-apply'.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 4 ++++\n git-rebase.sh             | 5 ++++-\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex cbf80f9..51354af 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -18,6 +18,9 @@ esac\n \n test -n \"$rebase_root\" && root_flag=--root\n \n+mkdir \"$state_dir\" || die \"Could not create temporary $state_dir\"\n+: > \"$state_dir\"/cherrypick || die \"Could not mark as cherrypick\"\n+\n # we have to do this the hard way.  git format-patch completely squashes\n # empty commits and even if it didn't the format doesn't really lend\n # itself well to recording empty patches.  fortunately, cherry-pick\n@@ -32,3 +35,4 @@ then\n fi\n \n move_to_original_branch\n+rm -rf \"$state_dir\"\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex f929ca3..76900a0 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -174,6 +174,9 @@ then\n \tthen\n \t\ttype=interactive\n \t\tinteractive_rebase=explicit\n+\telif test -f \"$merge_dir\"/cherrypick\n+\tthen\n+\t\ttype=cherrypick\n \telse\n \t\ttype=merge\n \tfi\n@@ -382,7 +385,7 @@ then\n elif test -n \"$keep_empty\"\n then\n \ttype=cherrypick\n-\tstate_dir=\"$apply_dir\"\n+\tstate_dir=\"$merge_dir\"\n else\n \ttype=am\n \tstate_dir=\"$apply_dir\"\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218738","messageId":"1369801000-3705-4-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:35Z","receivedAt":"2013-05-29T04:16:35Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We are not in am mode.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex 51354af..2fa4993 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -5,13 +5,15 @@\n \n case \"$action\" in\n continue)\n-\tgit am --resolved --resolvemsg=\"$resolvemsg\" &&\n-\tmove_to_original_branch\n+\tgit cherry-pick --continue &&\n+\tmove_to_original_branch &&\n+\trm -rf \"$state_dir\"\n \texit\n \t;;\n skip)\n-\tgit am --skip --resolvemsg=\"$resolvemsg\" &&\n-\tmove_to_original_branch\n+\tgit cherry-pick --skip &&\n+\tmove_to_original_branch &&\n+\trm -rf \"$state_dir\"\n \texit\n \t;;\n esac\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218739","messageId":"1369801000-3705-5-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 4/8] rebase: cherry-pick: fix abort of cherry mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:36Z","receivedAt":"2013-05-29T04:16:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 76900a0..9b5d78b 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -335,6 +335,7 @@ skip)\n \trun_specific_rebase\n \t;;\n abort)\n+\ttest \"$type\" == \"cherrypick\" && git cherry-pick --abort\n \tgit rerere clear\n \tread_basic_state\n \tcase \"$head_name\" in\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218740","messageId":"1369801000-3705-6-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 5/8] rebase: cherry-pick: fix command invocations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:37Z","receivedAt":"2013-05-29T04:16:37Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So that all the tests pass.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 17 ++++++++++++++++-\n 1 file changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex 2fa4993..ab892e6 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -23,11 +23,26 @@ test -n \"$rebase_root\" && root_flag=--root\n mkdir \"$state_dir\" || die \"Could not create temporary $state_dir\"\n : > \"$state_dir\"/cherrypick || die \"Could not mark as cherrypick\"\n \n+if test -n \"$rebase_root\"\n+then\n+\trevisions=\"$onto...$orig_head\"\n+else\n+\trevisions=\"$upstream...$orig_head\"\n+fi\n+\n # we have to do this the hard way.  git format-patch completely squashes\n # empty commits and even if it didn't the format doesn't really lend\n # itself well to recording empty patches.  fortunately, cherry-pick\n # makes this easy\n-git cherry-pick --allow-empty \"$revisions\"\n+if test -n \"$keep_empty\"\n+then\n+\textra=\"--allow-empty\"\n+else\n+\textra=\"--skip-empty --cherry-pick\"\n+fi\n+test -n \"$GIT_QUIET\" && extra=\"$extra -q\"\n+test -z \"$force_rebase\" && extra=\"$extra --ff\"\n+git cherry-pick --no-merges --right-only --topo-order --do-walk --copy-notes $extra \"$revisions\"\n ret=$?\n \n if test 0 != $ret\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218741","messageId":"1369801000-3705-7-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 6/8] rebase: cherry-pick: fix status messages","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:38Z","receivedAt":"2013-05-29T04:16:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex ab892e6..ef3224d 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -3,6 +3,9 @@\n # Copyright (c) 2010 Junio C Hamano.\n #\n \n+GIT_CHERRY_PICK_HELP=\"$resolvemsg\"\n+export GIT_CHERRY_PICK_HELP\n+\n case \"$action\" in\n continue)\n \tgit cherry-pick --continue &&\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218743","messageId":"1369801000-3705-8-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 7/8] rebase: cherry-pick: automatically commit stage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:39Z","receivedAt":"2013-05-29T04:16:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"When there's changes in the staging area. Just like the other rebase\nmodes.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex ef3224d..0fcf2e1 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -8,6 +8,12 @@ export GIT_CHERRY_PICK_HELP\n \n case \"$action\" in\n continue)\n+\t# do we have anything to commit?\n+\tif ! git diff-index --cached --quiet HEAD --\n+\tthen\n+\t\tgit commit --no-verify -e ||\n+\t\t\tdie \"Could not commit staged changes.\"\n+\tfi\n \tgit cherry-pick --continue &&\n \tmove_to_original_branch &&\n \trm -rf \"$state_dir\"\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218742","messageId":"1369801000-3705-9-git-send-email-felipe.contreras@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"[RFC/PATCH v2 8/8] rebase: use 'cherrypick' mode instead of 'am'","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T04:16:40Z","receivedAt":"2013-05-29T04:16:40Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Unless any specific 'git am' options are used.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-prompt.sh       | 2 ++\n git-rebase--am.sh                      | 1 +\n git-rebase.sh                          | 9 ++++-----\n t/t3407-rebase-abort.sh                | 2 +-\n t/t5520-pull.sh                        | 2 +-\n t/t9106-git-svn-commit-diff-clobber.sh | 2 +-\n 6 files changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex eaf5c36..f001463 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -271,6 +271,8 @@ __git_ps1 ()\n \t\t\ttotal=$(cat \"$g/rebase-merge/end\")\n \t\t\tif [ -f \"$g/rebase-merge/interactive\" ]; then\n \t\t\t\tr=\"|REBASE-i\"\n+\t\t\telif [ -f \"$g/rebase-merge/cherrypick\" ]; then\n+\t\t\t\tr=\"|REBASE\"\n \t\t\telse\n \t\t\t\tr=\"|REBASE-m\"\n \t\t\tfi\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex ee1b1b9..7a978fd 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -51,6 +51,7 @@ then\n \texit $?\n fi\n \n+test -n \"$GIT_QUIET\" && git_am_opt=\"$git_am_opt -q\"\n git am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n ret=$?\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 9b5d78b..16cc91b 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -251,7 +251,6 @@ do\n \t\t;;\n \t-q)\n \t\tGIT_QUIET=t\n-\t\tgit_am_opt=\"$git_am_opt -q\"\n \t\tverbose=\n \t\tdiffstat=\n \t\t;;\n@@ -383,13 +382,13 @@ elif test -n \"$do_merge\"\n then\n \ttype=merge\n \tstate_dir=\"$merge_dir\"\n-elif test -n \"$keep_empty\"\n+elif test -n \"$git_am_opt\"\n then\n-\ttype=cherrypick\n-\tstate_dir=\"$merge_dir\"\n-else\n \ttype=am\n \tstate_dir=\"$apply_dir\"\n+else\n+\ttype=cherrypick\n+\tstate_dir=\"$merge_dir\"\n fi\n \n if test -z \"$rebase_root\"\ndiff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh\nindex a6a6c40..2699b08 100755\n--- a/t/t3407-rebase-abort.sh\n+++ b/t/t3407-rebase-abort.sh\n@@ -96,7 +96,7 @@ testrebase() {\n \t'\n }\n \n-testrebase \"\" .git/rebase-apply\n+testrebase \"\" .git/rebase-merge\n testrebase \" --merge\" .git/rebase-merge\n \n test_done\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 6af6c63..ec2373b 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -244,7 +244,7 @@ test_expect_success 'setup for avoiding reapplying old patches' '\n test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(cd dst &&\n \t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t test 1 = $(cat .git/sequencer/todo | wc -l)\n \t)\n '\n \ndiff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh\nindex f6d7ac7..b9cec33 100755\n--- a/t/t9106-git-svn-commit-diff-clobber.sh\n+++ b/t/t9106-git-svn-commit-diff-clobber.sh\n@@ -92,7 +92,7 @@ test_expect_success 'multiple dcommit from git svn will not clobber svn' \"\n \n \n test_expect_success 'check that rebase really failed' '\n-\ttest -d .git/rebase-apply\n+\ttest -d .git/rebase-merge\n '\n \n test_expect_success 'resolve, continue the rebase and dcommit' \"\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218749","messageId":"CANiSa6ivOnRfOVMTsgDygi=2dvxmMOqqWdqs7CBYohThOVzt7Q@mail.gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-4-git-send-email-felipe.contreras@gmail.com","subject":"Re: [RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T05:33:15Z","receivedAt":"2013-05-29T05:33:15Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":" As Junio asked in the previous iteration, shouldn't this have been in\nthe first patch?\n\nOn Tue, May 28, 2013 at 9:16 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> We are not in am mode.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase--cherrypick.sh | 10 ++++++----\n>  1 file changed, 6 insertions(+), 4 deletions(-)\n>\n> diff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\n> index 51354af..2fa4993 100644\n> --- a/git-rebase--cherrypick.sh\n> +++ b/git-rebase--cherrypick.sh\n> @@ -5,13 +5,15 @@\n>\n>  case \"$action\" in\n>  continue)\n> -       git am --resolved --resolvemsg=\"$resolvemsg\" &&\n> -       move_to_original_branch\n> +       git cherry-pick --continue &&\n> +       move_to_original_branch &&\n> +       rm -rf \"$state_dir\"\n>         exit\n>         ;;\n>  skip)\n> -       git am --skip --resolvemsg=\"$resolvemsg\" &&\n> -       move_to_original_branch\n> +       git cherry-pick --skip &&\n> +       move_to_original_branch &&\n> +       rm -rf \"$state_dir\"\n>         exit\n>         ;;\n>  esac\n> --\n> 1.8.3.rc3.312.g47657de\n>\n"},{"id":"218750","messageId":"CANiSa6g10XQJMCrvu1U-YG8OpZXOLA1A_fTYoPh=RHoBkHu2Mw@mail.gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-5-git-send-email-felipe.contreras@gmail.com","subject":"Re: [RFC/PATCH v2 4/8] rebase: cherry-pick: fix abort of cherry mode","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T05:35:44Z","receivedAt":"2013-05-29T05:35:44Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Same here: should this have been in the first patch? If not, do you\nknow for how long it has been broken (since which commit)?\n\nOn Tue, May 28, 2013 at 9:16 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase.sh | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 76900a0..9b5d78b 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -335,6 +335,7 @@ skip)\n>         run_specific_rebase\n>         ;;\n>  abort)\n> +       test \"$type\" == \"cherrypick\" && git cherry-pick --abort\n>         git rerere clear\n>         read_basic_state\n>         case \"$head_name\" in\n> --\n> 1.8.3.rc3.312.g47657de\n>\n"},{"id":"218751","messageId":"CANiSa6jMb0D0ZYDMHtWD3u9tsY+kuX4Gcxu7L-=ZU3X3WPJzJg@mail.gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-3-git-send-email-felipe.contreras@gmail.com","subject":"Re: [RFC/PATCH v2 2/8] rebase: cherry-pick: fix mode storage","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T05:38:23Z","receivedAt":"2013-05-29T05:38:23Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Actually, are all of 2/8 - 7/8 fixes for things that broke in patch 1/8?\n\nOn Tue, May 28, 2013 at 9:16 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> We don't use the 'rebase-apply'.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase--cherrypick.sh | 4 ++++\n>  git-rebase.sh             | 5 ++++-\n>  2 files changed, 8 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\n> index cbf80f9..51354af 100644\n> --- a/git-rebase--cherrypick.sh\n> +++ b/git-rebase--cherrypick.sh\n> @@ -18,6 +18,9 @@ esac\n>\n>  test -n \"$rebase_root\" && root_flag=--root\n>\n> +mkdir \"$state_dir\" || die \"Could not create temporary $state_dir\"\n> +: > \"$state_dir\"/cherrypick || die \"Could not mark as cherrypick\"\n> +\n>  # we have to do this the hard way.  git format-patch completely squashes\n>  # empty commits and even if it didn't the format doesn't really lend\n>  # itself well to recording empty patches.  fortunately, cherry-pick\n> @@ -32,3 +35,4 @@ then\n>  fi\n>\n>  move_to_original_branch\n> +rm -rf \"$state_dir\"\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index f929ca3..76900a0 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -174,6 +174,9 @@ then\n>         then\n>                 type=interactive\n>                 interactive_rebase=explicit\n> +       elif test -f \"$merge_dir\"/cherrypick\n> +       then\n> +               type=cherrypick\n>         else\n>                 type=merge\n>         fi\n> @@ -382,7 +385,7 @@ then\n>  elif test -n \"$keep_empty\"\n>  then\n>         type=cherrypick\n> -       state_dir=\"$apply_dir\"\n> +       state_dir=\"$merge_dir\"\n>  else\n>         type=am\n>         state_dir=\"$apply_dir\"\n> --\n> 1.8.3.rc3.312.g47657de\n>\n"},{"id":"218752","messageId":"CAMP44s0Zy4KpPN1n6HOVXWyCuevenbSFnH589YngMB9NVWcamQ@mail.gmail.com","threadId":"33967","inReplyTo":"CANiSa6ivOnRfOVMTsgDygi=2dvxmMOqqWdqs7CBYohThOVzt7Q@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:41:22Z","receivedAt":"2013-05-29T05:41:22Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 12:33 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n>  As Junio asked in the previous iteration, shouldn't this have been in\n> the first patch?\n\nNo, the first patch is splitting the code without introducing any\nfunctional changes.\n\nThis is fixing a bug that already exists, we could fix it before the\nsplit, or after, but mixing the split and the fix at the same time is\na no-no.\n\nOne change splits, the other change fixes, what's wrong with that?\n\nThis way it's easy to see what each patch does.\n\n-- \nFelipe Contreras\n"},{"id":"218754","messageId":"CAMP44s29KwDMwF2X+_Lu7nyUaTkQAwC9pAx1nGNBe+WoktVGjA@mail.gmail.com","threadId":"33967","inReplyTo":"CANiSa6jMb0D0ZYDMHtWD3u9tsY+kuX4Gcxu7L-=ZU3X3WPJzJg@mail.gmail.com","subject":"Re: [RFC/PATCH v2 2/8] rebase: cherry-pick: fix mode storage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:45:23Z","receivedAt":"2013-05-29T05:45:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 12:38 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> Actually, are all of 2/8 - 7/8 fixes for things that broke in patch 1/8?\n\nNo, everything is already broken.\n\nTry this:\n\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -78,7 +78,7 @@ state_dir=\n action=\n preserve_merges=\n autosquash=\n-keep_empty=\n+keep_empty=yes\n test \"$(git config --bool rebase.autosquash)\" = \"true\" && autosquash=t\n\n read_basic_state () {\n\nAnd tell me what happens when you run the test suite:\n\nHint: This[1] is what would happen; everything breaks, not only the\ntests that check for empty commits.\n\n[1] http://article.gmane.org/gmane.comp.version-control.git/225652\n\n-- \nFelipe Contreras\n"},{"id":"218755","messageId":"CAMP44s1RWNVLWGFAR=MCdYF-uz4XS6-op9pY8Dc-DWXXva-17w@mail.gmail.com","threadId":"33967","inReplyTo":"CANiSa6g10XQJMCrvu1U-YG8OpZXOLA1A_fTYoPh=RHoBkHu2Mw@mail.gmail.com","subject":"Re: [RFC/PATCH v2 4/8] rebase: cherry-pick: fix abort of cherry mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:47:36Z","receivedAt":"2013-05-29T05:47:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 12:35 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> Same here: should this have been in the first patch? If not, do you\n> know for how long it has been broken (since which commit)?\n\nSince day 1 of --keep-empty:\n\n90e1818 git-rebase: add keep_empty flag\n\n-- \nFelipe Contreras\n"},{"id":"218756","messageId":"CANiSa6h7fY=GNM0VvFXvE-LD=nVWbEBGqWbaheZ6gr518_aPNA@mail.gmail.com","threadId":"33967","inReplyTo":"CAMP44s0Zy4KpPN1n6HOVXWyCuevenbSFnH589YngMB9NVWcamQ@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T05:51:14Z","receivedAt":"2013-05-29T05:51:14Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Tue, May 28, 2013 at 10:41 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Wed, May 29, 2013 at 12:33 AM, Martin von Zweigbergk\n> <martinvonz@gmail.com> wrote:\n>>  As Junio asked in the previous iteration, shouldn't this have been in\n>> the first patch?\n>\n> No, the first patch is splitting the code without introducing any\n> functional changes.\n>\n> This is fixing a bug that already exists, we could fix it before the\n> split, or after, but mixing the split and the fix at the same time is\n> a no-no.\n\nOh, now I remember. I ran into that bug once.\n\n> One change splits, the other change fixes, what's wrong with that?\n\nI didn't say there was anything wrong. I was asking if the bug was\nthere before (and I didn't see an answer when Junio asked).\n\nThanks\n"},{"id":"218760","messageId":"CAMP44s0MQ-u=Yo1RAoxsVyiAe7xcorCW992xsa4YsEyH9RbzoQ@mail.gmail.com","threadId":"33967","inReplyTo":"CANiSa6h7fY=GNM0VvFXvE-LD=nVWbEBGqWbaheZ6gr518_aPNA@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T06:05:42Z","receivedAt":"2013-05-29T06:05:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 12:51 AM, Martin von Zweigbergk\n<martinvonz@gmail.com> wrote:\n> On Tue, May 28, 2013 at 10:41 PM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n\n>> One change splits, the other change fixes, what's wrong with that?\n>\n> I didn't say there was anything wrong. I was asking if the bug was\n> there before (and I didn't see an answer when Junio asked).\n\nWhy wouldn't it be before? Did I mention a commit that introduced a\nproblem? No. Did any patch in this series introduce a problem? No.\n\nAll we've done in this series is 1) reorganize the code without\nintroducing *ANY* functional changes, and 2) fix a bug.\n\nIf you see 1) introducing a problem, or 2) introducing a problem, then\nmention that in *those* patches. If there is no problem with 1) or 2)\nthen it follows the problem already exists.\n\n-- \nFelipe Contreras\n"},{"id":"218761","messageId":"CANiSa6i5hzkNXJMDOPa6gHEkQKjgva4vprbD6UvqGtNFM4Qi-A@mail.gmail.com","threadId":"33967","inReplyTo":"CAMP44s0MQ-u=Yo1RAoxsVyiAe7xcorCW992xsa4YsEyH9RbzoQ@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/8] rebase: cherry-pick: fix sequence continuation","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-29T06:06:47Z","receivedAt":"2013-05-29T06:06:47Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":":-)\n\nOn Tue, May 28, 2013 at 11:05 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Wed, May 29, 2013 at 12:51 AM, Martin von Zweigbergk\n> <martinvonz@gmail.com> wrote:\n>> On Tue, May 28, 2013 at 10:41 PM, Felipe Contreras\n>> <felipe.contreras@gmail.com> wrote:\n>\n>>> One change splits, the other change fixes, what's wrong with that?\n>>\n>> I didn't say there was anything wrong. I was asking if the bug was\n>> there before (and I didn't see an answer when Junio asked).\n>\n> Why wouldn't it be before? Did I mention a commit that introduced a\n> problem? No. Did any patch in this series introduce a problem? No.\n>\n> All we've done in this series is 1) reorganize the code without\n> introducing *ANY* functional changes, and 2) fix a bug.\n>\n> If you see 1) introducing a problem, or 2) introducing a problem, then\n> mention that in *those* patches. If there is no problem with 1) or 2)\n> then it follows the problem already exists.\n>\n> --\n> Felipe Contreras\n"},{"id":"218798","messageId":"51A5E2F7.4090505@gmail.com","threadId":"33967","inReplyTo":"1369801000-3705-5-git-send-email-felipe.contreras@gmail.com","subject":"Re: [RFC/PATCH v2 4/8] rebase: cherry-pick: fix abort of cherry mode","fromName":"Stefano Lattarini","fromEmail":"stefano.lattarini@gmail.com","sentAt":"2013-05-29T11:13:59Z","receivedAt":"2013-05-29T11:13:59Z","isPatch":true,"sender":{"key":"stefano.lattarini@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1429199?v=4"},"body":"On 05/29/2013 06:16 AM, Felipe Contreras wrote:\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase.sh | 1 +\n>  1 file changed, 1 insertion(+)\n> \n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 76900a0..9b5d78b 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -335,6 +335,7 @@ skip)\n>  \trun_specific_rebase\n>  \t;;\n>  abort)\n> +\ttest \"$type\" == \"cherrypick\" && git cherry-pick --abort\n>\nBashism; please use \"=\", not \"==\".\n\n>  \tgit rerere clear\n>  \tread_basic_state\n>  \tcase \"$head_name\" in\n\nRegards,\n  Stefano\n"},{"id":"218908","messageId":"7vehcpqsk4.fsf@alter.siamese.dyndns.org","threadId":"33967","inReplyTo":"1369801000-3705-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [RFC/PATCH v2 0/8] rebase: new cherry-pick mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-29T23:23:23Z","receivedAt":"2013-05-29T23:23:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> We already rely on cherry-pick for the 'am' mode, but only when using the\n> --keep-empty option, and when in such mode the behavior of 'git rebase' changes\n> completely; more specifically; it's completely broken. Manually enabling\n> --keep-empty to be the default and running the test-suite shows a huge lot of\n> failures.\n>\n> After fixing the --keep-empty option by creating a new cherry-pick mode, this\n> patch series uses this new mode instead of the 'am' mode, and everything works.\n\nThis may be a stupid question, but does --keep-empty only fail with\nthe \"am\" mode?\n\nMore specifically, how well does \"rebase -i --keep-empty\" work?\n\nIf the answer is \"very well\", then it might make sense not to\nintroduce yet another cherry-pick mode, but do exactly the same\nthing as what -p mode does, namely, to internally delegate the\nprocessing to \"rebase -i\" codepath.  After all, multi-pick mode of\ncherry-pick uses the same sequencer machinery as rebase -i uses,\nso if we are already producing a correct \"rebase todo\" sequencer\ninsn list for \"rebase -i\" anyway, it should be the matter of not\nlaunching the editor to edit the initial insn sheet to make it\nnon-interactive, isn't it?\n\n>\n> There's only two tests that fail, one because the output of the shell prompt\n> changes a bit, and the other I have not yet investigated.\n>\n> This brings us one step closer to replace scripts with C code.\n>\n> Felipe Contreras (8):\n>   rebase: split the cherry-pick stuff\n>   rebase: cherry-pick: fix mode storage\n>   rebase: cherry-pick: fix sequence continuation\n>   rebase: cherry-pick: fix abort of cherry mode\n>   rebase: cherry-pick: fix command invocations\n>   rebase: cherry-pick: fix status messages\n>   rebase: cherry-pick: automatically commit stage\n>   rebase: use 'cherrypick' mode instead of 'am'\n>\n>  .gitignore                             |  1 +\n>  Makefile                               |  1 +\n>  contrib/completion/git-prompt.sh       |  2 ++\n>  git-rebase--am.sh                      | 12 ++-----\n>  git-rebase--cherrypick.sh              | 64 ++++++++++++++++++++++++++++++++++\n>  git-rebase.sh                          | 11 ++++--\n>  t/t3407-rebase-abort.sh                |  2 +-\n>  t/t5520-pull.sh                        |  2 +-\n>  t/t9106-git-svn-commit-diff-clobber.sh |  2 +-\n>  9 files changed, 82 insertions(+), 15 deletions(-)\n>  create mode 100644 git-rebase--cherrypick.sh\n"},{"id":"218923","messageId":"CAMP44s2QtqgfuhyvJ=aZKaFHJzvwdWPkpyWjXOfAHACwTagOow@mail.gmail.com","threadId":"33967","inReplyTo":"7vehcpqsk4.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/PATCH v2 0/8] rebase: new cherry-pick mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-30T02:37:52Z","receivedAt":"2013-05-30T02:37:52Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 6:23 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> We already rely on cherry-pick for the 'am' mode, but only when using the\n>> --keep-empty option, and when in such mode the behavior of 'git rebase' changes\n>> completely; more specifically; it's completely broken. Manually enabling\n>> --keep-empty to be the default and running the test-suite shows a huge lot of\n>> failures.\n>>\n>> After fixing the --keep-empty option by creating a new cherry-pick mode, this\n>> patch series uses this new mode instead of the 'am' mode, and everything works.\n>\n> This may be a stupid question, but does --keep-empty only fail with\n> the \"am\" mode?\n>\n> More specifically, how well does \"rebase -i --keep-empty\" work?\n>\n> If the answer is \"very well\", then it might make sense not to\n> introduce yet another cherry-pick mode, but do exactly the same\n> thing as what -p mode does, namely, to internally delegate the\n> processing to \"rebase -i\" codepath.  After all, multi-pick mode of\n> cherry-pick uses the same sequencer machinery as rebase -i uses,\n\nNo, that's not true. 'rebase -i' implements sequencing completely on\nit's own, and cherry picks commits one by one, it never uses the\nsequencer.c code.\n\nAlso, there's the issue of the 'git am' options, that of course only\nthe am mode respects. I personally wouldn't mind getting rid of them\nfor consistency purposes, but I know you would disagree.\n\nBut the real issue is that we would be detracting from the goal even\nmore; to replace script code with C code.\n\n> so if we are already producing a correct \"rebase todo\" sequencer\n> insn list for \"rebase -i\" anyway, it should be the matter of not\n> launching the editor to edit the initial insn sheet to make it\n> non-interactive, isn't it?\n\nSure, and make 'git rebase' extremely much more complicated (and\nprobably inefficient) in the process.\n\nI don't mind going that way, but I want to rewrite\n'git-rebase--interactive.sh' to use 'git cherry-pick' more, and maybe\n'git-rebase--merge.sh' too, and the first step was to replace the\nsimplest mode.\n\n-- \nFelipe Contreras\n"}]}