{"thread":{"id":"33960","subject":"[PATCH 0/5] rebase: improve the keep-empty","startedAt":"2013-05-28T13:29:12Z","lastAt":"2013-05-29T05:57:58Z","messageCount":18,"participants":["Felipe Contreras","Martin von Zweigbergk","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"218659","messageId":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":null,"subject":"[PATCH 0/5] rebase: improve the keep-empty","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:12Z","receivedAt":"2013-05-28T13:29:12Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nI've been analyzing 'git rebase' and found that the --keep-empty option\ntriggers a very very different behavior. Here's a bunch of patches that make it\nbehave like the 'am' does does for the most part.\n\nThere's only a few minor changes, after which it might be possible to replace\nthe whole 'am' mode to use cherr-pick instead.\n\nFelipe Contreras (5):\n  rebase: split the cherry-pick stuff\n  rebase: fix 'cherry' mode storage\n  rebase: fix sequence continuation\n  rebase: fix abort of cherry mode\n  rebase: fix cherry-pick invocations\n\n .gitignore            |  1 +\n Makefile              |  1 +\n git-rebase--am.sh     | 65 ++++++++++++++++++++++-----------------------------\n git-rebase--cherry.sh | 55 +++++++++++++++++++++++++++++++++++++++++++\n git-rebase.sh         |  8 +++++++\n 5 files changed, 93 insertions(+), 37 deletions(-)\n create mode 100644 git-rebase--cherry.sh\n\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218660","messageId":"1369747757-10192-2-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 1/5] rebase: split the cherry-pick stuff","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:13Z","receivedAt":"2013-05-28T13:29:13Z","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     | 65 ++++++++++++++++++++++-----------------------------\n git-rebase--cherry.sh | 34 +++++++++++++++++++++++++++\n git-rebase.sh         |  4 ++++\n 5 files changed, 68 insertions(+), 37 deletions(-)\n create mode 100644 git-rebase--cherry.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 6669bf0..284fc8f 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--cherry\n /git-rebase--interactive\n /git-rebase--merge\n /git-receive-pack\ndiff --git a/Makefile b/Makefile\nindex 0f931a2..a3cd4bc 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--cherry\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,52 +19,43 @@ 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-\trm -f \"$GIT_DIR/rebased-patches\"\n-\n-\tgit format-patch -k --stdout --full-index --ignore-if-in-upstream \\\n-\t\t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n-\t\t$root_flag \"$revisions\" >\"$GIT_DIR/rebased-patches\"\n-\tret=$?\n \n-\tif test 0 != $ret\n-\tthen\n-\t\trm -f \"$GIT_DIR/rebased-patches\"\n-\t\tcase \"$head_name\" in\n-\t\trefs/heads/*)\n-\t\t\tgit checkout -q \"$head_name\"\n-\t\t\t;;\n-\t\t*)\n-\t\t\tgit checkout -q \"$orig_head\"\n-\t\t\t;;\n-\t\tesac\n+rm -f \"$GIT_DIR/rebased-patches\"\n \n-\t\tcat >&2 <<-EOF\n+git format-patch -k --stdout --full-index --ignore-if-in-upstream \\\n+\t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n+\t$root_flag \"$revisions\" >\"$GIT_DIR/rebased-patches\"\n+ret=$?\n \n-\t\tgit encountered an error while preparing the patches to replay\n-\t\tthese revisions:\n+if test 0 != $ret\n+then\n+\trm -f \"$GIT_DIR/rebased-patches\"\n+\tcase \"$head_name\" in\n+\trefs/heads/*)\n+\t\tgit checkout -q \"$head_name\"\n+\t\t;;\n+\t*)\n+\t\tgit checkout -q \"$orig_head\"\n+\t\t;;\n+\tesac\n \n-\t\t    $revisions\n+\tcat >&2 <<-EOF\n \n-\t\tAs a result, git cannot rebase them.\n-\t\tEOF\n-\t\texit $?\n-\tfi\n+\tgit encountered an error while preparing the patches to replay\n+\tthese revisions:\n \n-\tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n-\tret=$?\n+\t    $revisions\n \n-\trm -f \"$GIT_DIR/rebased-patches\"\n+\tAs a result, git cannot rebase them.\n+\tEOF\n+\texit $?\n fi\n \n+git am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n+ret=$?\n+\n+rm -f \"$GIT_DIR/rebased-patches\"\n+\n if test 0 != $ret\n then\n \ttest -d \"$state_dir\" && write_basic_state\ndiff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\nnew file mode 100644\nindex 0000000..cbf80f9\n--- /dev/null\n+++ b/git-rebase--cherry.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..2754985 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=cherry\n+\tstate_dir=\"$apply_dir\"\n else\n \ttype=am\n \tstate_dir=\"$apply_dir\"\n-- \n1.8.3.rc3.312.g47657de\n"},{"id":"218662","messageId":"1369747757-10192-3-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 2/5] rebase: fix 'cherry' mode storage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:14Z","receivedAt":"2013-05-28T13:29:14Z","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--cherry.sh | 4 ++++\n git-rebase.sh         | 5 ++++-\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\nindex cbf80f9..ab1f8b7 100644\n--- a/git-rebase--cherry.sh\n+++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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 2754985..b7759d5 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\"/cherry\n+\tthen\n+\t\ttype=cherry\n \telse\n \t\ttype=merge\n \tfi\n@@ -382,7 +385,7 @@ then\n elif test -n \"$keep_empty\"\n then\n \ttype=cherry\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":"218664","messageId":"1369747757-10192-4-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 3/5] rebase: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:15Z","receivedAt":"2013-05-28T13:29:15Z","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--cherry.sh | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\nindex ab1f8b7..ca78b1b 100644\n--- a/git-rebase--cherry.sh\n+++ b/git-rebase--cherry.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":"218661","messageId":"1369747757-10192-5-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 4/5] rebase: fix abort of cherry mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:16Z","receivedAt":"2013-05-28T13:29:16Z","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 b7759d5..48bd1b8 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\" == \"cherry\" && 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":"218663","messageId":"1369747757-10192-6-git-send-email-felipe.contreras@gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 5/5] rebase: fix cherry-pick invocations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:29:17Z","receivedAt":"2013-05-28T13:29:17Z","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--cherry.sh | 17 ++++++++++++++++-\n 1 file changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\nindex ca78b1b..c3a2ac9 100644\n--- a/git-rebase--cherry.sh\n+++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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":"218665","messageId":"CAMP44s2KX+Rsd+WL-=PUeF4jt9J2sp1QbkyaTL0VU+8aggaWYw@mail.gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 0/5] rebase: improve the keep-empty","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-28T13:33:22Z","receivedAt":"2013-05-28T13:33:22Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Tue, May 28, 2013 at 8:29 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Hi,\n>\n> I've been analyzing 'git rebase' and found that the --keep-empty option\n> triggers a very very different behavior. Here's a bunch of patches that make it\n> behave like the 'am' does does for the most part.\n>\n> There's only a few minor changes, after which it might be possible to replace\n> the whole 'am' mode to use cherr-pick instead.\n>\n> Felipe Contreras (5):\n>   rebase: split the cherry-pick stuff\n>   rebase: fix 'cherry' mode storage\n>   rebase: fix sequence continuation\n>   rebase: fix abort of cherry mode\n>   rebase: fix cherry-pick invocations\n\nTo see the issue, simply enable keep_mode by default, and run the tests:\n\n    Test Summary Report\n    -------------------\n    ./t3401-rebase-partial.sh                          (Wstat: 256\nTests: 7 Failed: 4)\n      Failed tests:  3, 5-7\n      Non-zero exit status: 1\n    ./t3403-rebase-skip.sh                             (Wstat: 256\nTests: 10 Failed: 3)\n      Failed tests:  4-5, 9\n      Non-zero exit status: 1\n    ./t3406-rebase-message.sh                          (Wstat: 256\nTests: 6 Failed: 3)\n      Failed tests:  3-5\n      Non-zero exit status: 1\n    ./t3400-rebase.sh                                  (Wstat: 256\nTests: 27 Failed: 10)\n      Failed tests:  13-17, 22-25, 27\n      Non-zero exit status: 1\n    ./t3407-rebase-abort.sh                            (Wstat: 256\nTests: 11 Failed: 5)\n      Failed tests:  2-6\n      Non-zero exit status: 1\n    ./t3412-rebase-root.sh                             (Wstat: 256\nTests: 31 Failed: 17)\n      Failed tests:  4, 6-8, 10-12, 14-17, 23, 25-26, 28-29\n                    31\n      Non-zero exit status: 1\n    ./t3417-rebase-whitespace-fix.sh                   (Wstat: 256\nTests: 4 Failed: 4)\n      Failed tests:  1-4\n      Non-zero exit status: 1\n    ./t3419-rebase-patch-id.sh                         (Wstat: 256\nTests: 9 Failed: 1)\n      Failed test:  4\n      Non-zero exit status: 1\n    ./t3418-rebase-continue.sh                         (Wstat: 256\nTests: 6 Failed: 2)\n      Failed tests:  3, 5\n      Non-zero exit status: 1\n    ./t5407-post-rewrite-hook.sh                       (Wstat: 256\nTests: 13 Failed: 4)\n      Failed tests:  4-6, 8\n      Non-zero exit status: 1\n    ./t5520-pull.sh                                    (Wstat: 256\nTests: 21 Failed: 8)\n      Failed tests:  12-15, 18-21\n      Non-zero exit status: 1\n    ./t7512-status-help.sh                             (Wstat: 256\nTests: 35 Failed: 3)\n      Failed tests:  5-6, 28\n      Non-zero exit status: 1\n    ./t9106-git-svn-commit-diff-clobber.sh             (Wstat: 256\nTests: 10 Failed: 3)\n      Failed tests:  6, 9-10\n      Non-zero exit status: 1\n    ./t3404-rebase-interactive.sh                      (Wstat: 256\nTests: 71 Failed: 2)\n      Failed tests:  50, 69\n      Non-zero exit status: 1\n    ./t9137-git-svn-dcommit-clobber-series.sh          (Wstat: 256\nTests: 5 Failed: 1)\n      Failed test:  4\n      Non-zero exit status: 1\n    ./t9140-git-svn-reset.sh                           (Wstat: 256\nTests: 6 Failed: 1)\n      Failed test:  6\n      Non-zero exit status: 1\n    ./t9903-bash-prompt.sh                             (Wstat: 256\nTests: 51 Failed: 20)\n      Failed tests:  27-34, 36-39, 41-42, 45-49, 51\n      Non-zero exit status: 1\n    ./t9164-git-svn-dcommit-concurrent.sh              (Wstat: 256\nTests: 8 Failed: 4)\n      Failed tests:  4-6, 8\n      Non-zero exit status: 1\n    Files=629, Tests=10036, 308 wallclock secs ( 7.60 usr  1.39 sys +\n556.35 cusr 382.46 csys = 947.80 CPU)\n    Result: FAIL\n\n-- \nFelipe Contreras\n"},{"id":"218683","messageId":"CANiSa6haWGOjpydxX-B9W1ZGAANAJ5Wi5_sLqedQwGCSTu86nA@mail.gmail.com","threadId":"33960","inReplyTo":"1369747757-10192-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 0/5] rebase: improve the keep-empty","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2013-05-28T17:17:09Z","receivedAt":"2013-05-28T17:17:09Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Hi,\n\nI think I have some patches at home that instead teach 'git am' the\n--keep-empty flag. Does that make sense? It's been a while since I\nlooked at it, but I'll try to take a look tonight (PST).\n\nMartin\n\nOn Tue, May 28, 2013 at 6:29 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Hi,\n>\n> I've been analyzing 'git rebase' and found that the --keep-empty option\n> triggers a very very different behavior. Here's a bunch of patches that make it\n> behave like the 'am' does does for the most part.\n>\n> There's only a few minor changes, after which it might be possible to replace\n> the whole 'am' mode to use cherr-pick instead.\n>\n> Felipe Contreras (5):\n>   rebase: split the cherry-pick stuff\n>   rebase: fix 'cherry' mode storage\n>   rebase: fix sequence continuation\n>   rebase: fix abort of cherry mode\n>   rebase: fix cherry-pick invocations\n>\n>  .gitignore            |  1 +\n>  Makefile              |  1 +\n>  git-rebase--am.sh     | 65 ++++++++++++++++++++++-----------------------------\n>  git-rebase--cherry.sh | 55 +++++++++++++++++++++++++++++++++++++++++++\n>  git-rebase.sh         |  8 +++++++\n>  5 files changed, 93 insertions(+), 37 deletions(-)\n>  create mode 100644 git-rebase--cherry.sh\n>\n> --\n> 1.8.3.rc3.312.g47657de\n>\n"},{"id":"218704","messageId":"7vd2sayc8f.fsf@alter.siamese.dyndns.org","threadId":"33960","inReplyTo":"1369747757-10192-2-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 1/5] rebase: split the cherry-pick stuff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-28T22:24:16Z","receivedAt":"2013-05-28T22:24:16Z","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> They do something completely different from 'git am', it belongs in a\n> different file.\n\nI would prefer to see it called --cherry-pick, not --cherry, as they\nare different commands (the latter may be useful when deciding which\none to use the former).\n\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  .gitignore            |  1 +\n>  Makefile              |  1 +\n>  git-rebase--am.sh     | 65 ++++++++++++++++++++++-----------------------------\n>  git-rebase--cherry.sh | 34 +++++++++++++++++++++++++++\n>  git-rebase.sh         |  4 ++++\n>  5 files changed, 68 insertions(+), 37 deletions(-)\n>  create mode 100644 git-rebase--cherry.sh\n>\n> diff --git a/.gitignore b/.gitignore\n> index 6669bf0..284fc8f 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--cherry\n>  /git-rebase--interactive\n>  /git-rebase--merge\n>  /git-receive-pack\n> diff --git a/Makefile b/Makefile\n> index 0f931a2..a3cd4bc 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--cherry\n>  SCRIPT_LIB += git-rebase--interactive\n>  SCRIPT_LIB += git-rebase--merge\n>  SCRIPT_LIB += git-sh-setup\n> diff --git a/git-rebase--am.sh b/git-rebase--am.sh\n> index f84854f..ee1b1b9 100644\n> --- a/git-rebase--am.sh\n> +++ b/git-rebase--am.sh\n> @@ -19,52 +19,43 @@ esac\n>  test -n \"$rebase_root\" && root_flag=--root\n>  \n>  ret=0\n> +rm -f \"$GIT_DIR/rebased-patches\"\n>  \n> -\t\tcat >&2 <<-EOF\n> +git format-patch -k --stdout --full-index --ignore-if-in-upstream \\\n> +\t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n> +\t$root_flag \"$revisions\" >\"$GIT_DIR/rebased-patches\"\n> +ret=$?\n>  \n> +if test 0 != $ret\n> +then\n> +\trm -f \"$GIT_DIR/rebased-patches\"\n> +\tcase \"$head_name\" in\n> +\trefs/heads/*)\n> +\t\tgit checkout -q \"$head_name\"\n> +\t\t;;\n> +\t*)\n> +\t\tgit checkout -q \"$orig_head\"\n> +\t\t;;\n> +\tesac\n>  \n> -\t\t    $revisions\n> +\tcat >&2 <<-EOF\n>  \n> +\tgit encountered an error while preparing the patches to replay\n> +\tthese revisions:\n>  \n> +\t    $revisions\n>  \n> +\tAs a result, git cannot rebase them.\n> +\tEOF\n> +\texit $?\n>  fi\n>  \n> +git am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n> +ret=$?\n> +\n> +rm -f \"$GIT_DIR/rebased-patches\"\n> +\n>  if test 0 != $ret\n>  then\n>  \ttest -d \"$state_dir\" && write_basic_state\n\nOK, this part seems a straightforward reindentation of \"else\" side.\n\n> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> new file mode 100644\n> index 0000000..cbf80f9\n> --- /dev/null\n> +++ b/git-rebase--cherry.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\nHmm, do we want to duplicate this part between the two?  Perhaps it\nwill be unified in a later patch---I'll read on.\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\n\nOK.  This is the \"then\" side of the original, with clean-up phase\ncopied.\n\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 2c692c3..2754985 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=cherry\n> +\tstate_dir=\"$apply_dir\"\n>  else\n>  \ttype=am\n>  \tstate_dir=\"$apply_dir\"\n"},{"id":"218705","messageId":"7v8v2yyc04.fsf@alter.siamese.dyndns.org","threadId":"33960","inReplyTo":"1369747757-10192-3-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 2/5] rebase: fix 'cherry' mode storage","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-28T22:29:15Z","receivedAt":"2013-05-28T22:29:15Z","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 don't use the 'rebase-apply'.\n\ns/.$/; we will use rebase-merge instead./ I think.\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase--cherry.sh | 4 ++++\n>  git-rebase.sh         | 5 ++++-\n>  2 files changed, 8 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> index cbf80f9..ab1f8b7 100644\n> --- a/git-rebase--cherry.sh\n> +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\n\nStyle:\n\n\t>\"$state_dir/cherry-pick\"\n\nI am not sure if the user _cares_ that internally we use cherry-pick\nwhen s/he asks us to do a keep-empty, and I suspect \"mark as cherry\"\nincomprehensible.  I do not even know what is going on at this point\n(yet).\n\nI _suspect_ that you are using cherry-pick when --keep-empty is given,\nso it might even make sense to talk in the end-users' terms,\ni.e. call this \"$state_dir/keep-empty\" (I am not sure if calling\nthis split half \"git-rebase--keep-empty.sh\" makes sense, yet).\n\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 2754985..b7759d5 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\"/cherry\n> +\tthen\n> +\t\ttype=cherry\n>  \telse\n>  \t\ttype=merge\n>  \tfi\n> @@ -382,7 +385,7 @@ then\n>  elif test -n \"$keep_empty\"\n>  then\n>  \ttype=cherry\n> -\tstate_dir=\"$apply_dir\"\n> +\tstate_dir=\"$merge_dir\"\n>  else\n>  \ttype=am\n>  \tstate_dir=\"$apply_dir\"\n"},{"id":"218706","messageId":"7v4ndmybwl.fsf@alter.siamese.dyndns.org","threadId":"33960","inReplyTo":"1369747757-10192-4-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 3/5] rebase: fix sequence continuation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-28T22:31:22Z","receivedAt":"2013-05-28T22:31:22Z","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 are not in am mode.\n\nThat may make sense, but shouldn't this part be like so from the\nvery beginning?  In other words, this looks like an \"oops, 1/5 was\nbuggy and this is a hotfix\".\n\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase--cherry.sh | 10 ++++++----\n>  1 file changed, 6 insertions(+), 4 deletions(-)\n>\n> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> index ab1f8b7..ca78b1b 100644\n> --- a/git-rebase--cherry.sh\n> +++ b/git-rebase--cherry.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"},{"id":"218707","messageId":"7vzjvewwne.fsf@alter.siamese.dyndns.org","threadId":"33960","inReplyTo":"1369747757-10192-6-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 5/5] rebase: fix cherry-pick invocations","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-28T22:46:13Z","receivedAt":"2013-05-28T22:46:13Z","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> So that all the tests pass.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  git-rebase--cherry.sh | 17 ++++++++++++++++-\n>  1 file changed, 16 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> index ca78b1b..c3a2ac9 100644\n> --- a/git-rebase--cherry.sh\n> +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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\"So that all the tests pass\" needs a bit more explanation to say for\ncherry-pick codepath why and how two-dot range fails and why and how\nthree-dot variant with --right-only fixes it.  What are the problematic\ncases?\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"},{"id":"218708","messageId":"7vvc62wwea.fsf@alter.siamese.dyndns.org","threadId":"33960","inReplyTo":"7vzjvewwne.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 5/5] rebase: fix cherry-pick invocations","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-28T22:51:41Z","receivedAt":"2013-05-28T22:51:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> So that all the tests pass.\n>>\n>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n>> ---\n>>  git-rebase--cherry.sh | 17 ++++++++++++++++-\n>>  1 file changed, 16 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n>> index ca78b1b..c3a2ac9 100644\n>> --- a/git-rebase--cherry.sh\n>> +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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> \"So that all the tests pass\" needs a bit more explanation to say for\n> cherry-pick codepath why and how two-dot range fails and why and how\n> three-dot variant with --right-only fixes it.  What are the problematic\n> cases?\n\nYikes, sorry, this was me being slow.  Walking A...B range with\nright-only and --cherry applied will filter the duplicates, which is\nwat you want, I think, and walking A..B range will not do the\nfiltering for you.\n\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"},{"id":"218719","messageId":"51a56f90e3b41_807b33e18100220@nysa.mail","threadId":"33960","inReplyTo":"CANiSa6haWGOjpydxX-B9W1ZGAANAJ5Wi5_sLqedQwGCSTu86nA@mail.gmail.com","subject":"Re: [PATCH 0/5] rebase: improve the keep-empty","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T03:01:36Z","receivedAt":"2013-05-29T03:01:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Martin von Zweigbergk wrote:\n> I think I have some patches at home that instead teach 'git am' the\n> --keep-empty flag. Does that make sense? It's been a while since I\n> looked at it, but I'll try to take a look tonight (PST).\n\nI think it does make sense. But I still would prefer 'git rebase' to rely on\n'git cherry-pick' primariliy.\n\n-- \nFelipe Contreras\n"},{"id":"218721","messageId":"51a57014a1184_807b33e18100353@nysa.mail","threadId":"33960","inReplyTo":"7v8v2yyc04.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/5] rebase: fix 'cherry' mode storage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T03:03:48Z","receivedAt":"2013-05-29T03:03:48Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n> > We don't use the 'rebase-apply'.\n> \n> s/.$/; we will use rebase-merge instead./ I think.\n\nWe could use 'rebase-apply' or any directory, but currently we don't use any,\nand 'rebase-apply' is for 'git am'.\n\n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> >  git-rebase--cherry.sh | 4 ++++\n> >  git-rebase.sh         | 5 ++++-\n> >  2 files changed, 8 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> > index cbf80f9..ab1f8b7 100644\n> > --- a/git-rebase--cherry.sh\n> > +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\n> \n> Style:\n> \n> \t>\"$state_dir/cherry-pick\"\n\nFix that in git-rebase--interactive.sh then, where this code came from.\n\n> I am not sure if the user _cares_ that internally we use cherry-pick\n> when s/he asks us to do a keep-empty, and I suspect \"mark as cherry\"\n> incomprehensible.  I do not even know what is going on at this point\n> (yet).\n\nIt's the same we do in git-rebase--interactive.sh.\n\n> I _suspect_ that you are using cherry-pick when --keep-empty is given,\n> so it might even make sense to talk in the end-users' terms,\n> i.e. call this \"$state_dir/keep-empty\" (I am not sure if calling\n> this split half \"git-rebase--keep-empty.sh\" makes sense, yet).\n\nIf git-rebase--cherry(-pick)?.sh does the same as 'git-rebase--am.sh', we can\nreplace it, and make yet another step of replacing scripts (git am) with C code\n(git cherry-pick). I thought I explained that somewhow, maybe I didn't.\n\nIt still makes sense to fix the broken --keep-empty behavior.\n\n-- \nFelipe Contreras\n"},{"id":"218757","messageId":"51a597e95039e_7242869e1c713f5@nysa.mail","threadId":"33960","inReplyTo":"7v4ndmybwl.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/5] rebase: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:53:45Z","receivedAt":"2013-05-29T05:53:45Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n> > We are not in am mode.\n> \n> That may make sense, but shouldn't this part be like so from the\n> very beginning?  In other words, this looks like an \"oops, 1/5 was\n> buggy and this is a hotfix\".\n\nHow can 1/5 be introducing a bug? It's merely splitting the code without\nintroducing *ANY* functional changes.\n\nThe bug is already there in 'master'.\n\n-- \nFelipe Contreras\n"},{"id":"218758","messageId":"51a5984b6e642_7242869e1c714fe@nysa.mail","threadId":"33960","inReplyTo":"7vzjvewwne.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 5/5] rebase: fix cherry-pick invocations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:55:23Z","receivedAt":"2013-05-29T05:55:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n> > So that all the tests pass.\n> >\n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> >  git-rebase--cherry.sh | 17 ++++++++++++++++-\n> >  1 file changed, 16 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> > index ca78b1b..c3a2ac9 100644\n> > --- a/git-rebase--cherry.sh\n> > +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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> \"So that all the tests pass\" needs a bit more explanation to say for\n> cherry-pick codepath why and how two-dot range fails and why and how\n> three-dot variant with --right-only fixes it.  What are the problematic\n> cases?\n\nThere's too many failures to count. We are blindingly applying a series of\ncommits on top of another without checking if they are merges or if they\nalready exist in the destination branch.\n\n-- \nFelipe Contreras\n"},{"id":"218759","messageId":"51a598e6e58ff_7242869e1c715bf@nysa.mail","threadId":"33960","inReplyTo":"7vvc62wwea.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 5/5] rebase: fix cherry-pick invocations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T05:57:58Z","receivedAt":"2013-05-29T05:57:58Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Felipe Contreras <felipe.contreras@gmail.com> writes:\n> >\n> >> So that all the tests pass.\n> >>\n> >> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> >> ---\n> >>  git-rebase--cherry.sh | 17 ++++++++++++++++-\n> >>  1 file changed, 16 insertions(+), 1 deletion(-)\n> >>\n> >> diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh\n> >> index ca78b1b..c3a2ac9 100644\n> >> --- a/git-rebase--cherry.sh\n> >> +++ b/git-rebase--cherry.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\"/cherry || die \"Could not mark as cherry\"\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> > \"So that all the tests pass\" needs a bit more explanation to say for\n> > cherry-pick codepath why and how two-dot range fails and why and how\n> > three-dot variant with --right-only fixes it.  What are the problematic\n> > cases?\n> \n> Yikes, sorry, this was me being slow.  Walking A...B range with\n> right-only and --cherry applied will filter the duplicates, which is\n> wat you want, I think, and walking A..B range will not do the\n> filtering for you.\n\nThat's right.\n\n-- \nFelipe Contreras\n"}]}