{"thread":{"id":"34806","subject":"[PATCH v6 00/28] Massive improvents to rebase and cherry-pick","startedAt":"2013-08-30T05:55:54Z","lastAt":"2013-08-30T05:56:22Z","messageCount":29,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":6,"patchTotal":28},"messages":[{"id":"226296","messageId":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":null,"subject":"[PATCH v6 00/28] Massive improvents to rebase and cherry-pick","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:54Z","receivedAt":"2013-08-30T05:55:54Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nThese are improvements to 'git rebase' by using a much improved 'git\ncherry-pick'.\n\nA new rewrite.c helper is added, and builtin/commit updated to use\nthat.\n\nA new git-rebase--cherypick mode is added, and it replaces git-rebase--am and\ngit-rebase--merge.\n\nFelipe Contreras (28):\n  cherry-pick: don't barf when there's nothing to do\n  cherry-pick: add --skip-empty option\n  revert/cherry-pick: add --quiet option\n  revert/cherry-pick: add --skip option\n  builtin: add rewrite helper\n  cherry-pick: store rewritten commits\n  cherry-pick: don't store skipped commit\n  builtin: move run_rewrite_hook() to rewrite.c\n  builtin: rewrite: add copy_rewrite_notes()\n  cherry-pick: add --action-name option\n  cherry-pick: copy notes and run hooks\n  cherry-pick: remember rerere-autoupdate\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: cherry-pick: set correct action-name\n  rebase: trivial cleanup\n  t: rebase-autostash: fix setup\n  sequencer: store progress information\n  prompt: parse cherry-pick rebase mode\n  rebase: use 'cherrypick' mode instead of 'am'\n  rebase: cherry-pick: add merge options\n  rebase: remove merge mode\n  rebase: cherry-pick: add copyright\n\n .gitignore                             |   2 +-\n Documentation/config.txt               |   9 +-\n Documentation/git-cherry-pick.txt      |  10 ++-\n Documentation/git-revert.txt           |   7 +-\n Documentation/githooks.txt             |   8 +-\n Documentation/sequencer.txt            |   3 +\n Makefile                               |   4 +-\n builtin/commit.c                       |  46 ++--------\n builtin/revert.c                       |  17 ++++\n contrib/completion/git-prompt.sh       |  16 ++--\n git-rebase--am.sh                      |  12 +--\n git-rebase--cherrypick.sh              |  66 ++++++++++++++\n git-rebase--interactive.sh             |   6 +-\n git-rebase--merge.sh                   | 151 ---------------------------------\n git-rebase.sh                          |  16 ++--\n rewrite.c                              | 122 ++++++++++++++++++++++++++\n rewrite.h                              |  20 +++++\n sequencer.c                            | 124 +++++++++++++++++++++++++--\n sequencer.h                            |   8 +-\n t/t3406-rebase-message.sh              |  14 +--\n t/t3407-rebase-abort.sh                |   2 +-\n t/t3420-rebase-autostash.sh            | 107 ++++++++++++-----------\n t/t3425-rebase-topology-merges.sh      |  15 ++--\n t/t3508-cherry-pick-many-commits.sh    |  13 +++\n t/t3510-cherry-pick-sequence.sh        |  14 ++-\n t/t5520-pull.sh                        |   2 +-\n t/t9106-git-svn-commit-diff-clobber.sh |   2 +-\n t/t9903-bash-prompt.sh                 |   2 +-\n 28 files changed, 496 insertions(+), 322 deletions(-)\n create mode 100644 git-rebase--cherrypick.sh\n delete mode 100644 git-rebase--merge.sh\n create mode 100644 rewrite.c\n create mode 100644 rewrite.h\n\n-- \n1.8.4-fc\n"},{"id":"226297","messageId":"1377842182-18724-2-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 01/28] cherry-pick: don't barf when there's nothing to do","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:55Z","receivedAt":"2013-08-30T05:55:55Z","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 sequencer.c                     | 2 +-\n t/t3510-cherry-pick-sequence.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 351548f..a962b33 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -661,7 +661,7 @@ static void prepare_revs(struct replay_opts *opts)\n \t\tdie(_(\"revision walk setup failed\"));\n \n \tif (!opts->revs->commits)\n-\t\tdie(_(\"empty commit set passed\"));\n+\t\terror(_(\"empty commit set passed\"));\n }\n \n static void read_and_refresh_cache(struct replay_opts *opts)\ndiff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh\nindex 7b7a89d..33c5512 100755\n--- a/t/t3510-cherry-pick-sequence.sh\n+++ b/t/t3510-cherry-pick-sequence.sh\n@@ -472,7 +472,7 @@ test_expect_success 'malformed instruction sheet 2' '\n \n test_expect_success 'empty commit set' '\n \tpristine_detach initial &&\n-\ttest_expect_code 128 git cherry-pick base..base\n+\tgit cherry-pick base..base\n '\n \n test_expect_success 'malformed instruction sheet 3' '\n-- \n1.8.4-fc\n"},{"id":"226299","messageId":"1377842182-18724-3-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 02/28] cherry-pick: add --skip-empty option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:56Z","receivedAt":"2013-08-30T05:55:56Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Pretty much what it says on the tin.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-cherry-pick.txt   |  3 +++\n builtin/revert.c                    |  8 ++++++++\n sequencer.c                         |  6 ++++++\n sequencer.h                         |  1 +\n t/t3508-cherry-pick-many-commits.sh | 13 +++++++++++++\n 5 files changed, 31 insertions(+)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex c205d23..fccd936 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -129,6 +129,9 @@ effect to your index in a row.\n \tredundant commits are ignored.  This option overrides that behavior and\n \tcreates an empty commit object.  Implies `--allow-empty`.\n \n+--skip-empty::\n+\tInstead of failing, skip commits that are or become empty.\n+\n --strategy=<strategy>::\n \tUse the given merge strategy.  Should only be used once.\n \tSee the MERGE STRATEGIES section in linkgit:git-merge[1]\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 1d2648b..6e7cb2a 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -120,6 +120,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\tOPT_END(),\n \t\tOPT_END(),\n \t\tOPT_END(),\n+\t\tOPT_END(),\n \t};\n \n \tif (opts->action == REPLAY_PICK) {\n@@ -129,6 +130,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\tOPT_BOOLEAN(0, \"allow-empty\", &opts->allow_empty, N_(\"preserve initially empty commits\")),\n \t\t\tOPT_BOOLEAN(0, \"allow-empty-message\", &opts->allow_empty_message, N_(\"allow commits with empty messages\")),\n \t\t\tOPT_BOOLEAN(0, \"keep-redundant-commits\", &opts->keep_redundant_commits, N_(\"keep redundant, empty commits\")),\n+\t\t\tOPT_BOOLEAN(0, \"skip-empty\", &opts->skip_empty, N_(\"skip empty commits\")),\n \t\t\tOPT_END(),\n \t\t};\n \t\tif (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))\n@@ -146,6 +148,12 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\t\t\"--abort\", rollback,\n \t\t\t\tNULL);\n \n+\tverify_opt_mutually_compatible(me,\n+\t\t\t\t\"--allow-empty\", opts->allow_empty,\n+\t\t\t\t\"--skip-empty\", opts->skip_empty,\n+\t\t\t\t\"--keep-redundant-commits\", opts->keep_redundant_commits,\n+\t\t\t\tNULL);\n+\n \t/* implies allow_empty */\n \tif (opts->keep_redundant_commits)\n \t\topts->allow_empty = 1;\ndiff --git a/sequencer.c b/sequencer.c\nindex a962b33..c387828 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -633,6 +633,12 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n \t\tgoto leave;\n \t}\n \n+\tif (opts->skip_empty && is_index_unchanged() == 1) {\n+\t\twarning(_(\"skipping %s... %s\"),\n+\t\t\tfind_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n+\t\t\tmsg.subject);\n+\t\tgoto leave;\n+\t}\n \tallow = allow_empty(opts, commit);\n \tif (allow < 0) {\n \t\tres = allow;\ndiff --git a/sequencer.h b/sequencer.h\nindex 1fc22dc..3b04844 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -34,6 +34,7 @@ struct replay_opts {\n \tint allow_empty;\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n+\tint skip_empty;\n \n \tint mainline;\n \ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex 19c99d7..3dc19c6 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -187,4 +187,17 @@ test_expect_success 'cherry-pick --stdin works' '\n \tcheck_head_differs_from fourth\n '\n \n+test_expect_success 'cherry-pick skip empty' '\n+\tgit clean -fxd &&\n+\tgit checkout -b empty fourth &&\n+\tgit commit --allow-empty -m empty &&\n+\ttest_commit ontop &&\n+\tgit checkout -f master &&\n+\tgit reset --hard fourth &&\n+\tgit cherry-pick --skip-empty fourth..empty &&\n+\techo ontop > expected &&\n+\tgit log --format=%s fourth..HEAD > actual\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.8.4-fc\n"},{"id":"226298","messageId":"1377842182-18724-4-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 03/28] revert/cherry-pick: add --quiet option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:57Z","receivedAt":"2013-08-30T05:55:57Z","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 Documentation/git-cherry-pick.txt |  6 +++++-\n Documentation/git-revert.txt      |  6 +++++-\n builtin/revert.c                  |  1 +\n sequencer.c                       | 11 +++++++----\n sequencer.h                       |  1 +\n 5 files changed, 19 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex fccd936..da0bd81 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -8,7 +8,7 @@ git-cherry-pick - Apply the changes introduced by some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...\n+'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...\n 'git cherry-pick' --continue\n 'git cherry-pick' --quit\n 'git cherry-pick' --abort\n@@ -51,6 +51,10 @@ OPTIONS\n \tfeed all <commit>... arguments to a single revision walk\n \t(see a later example that uses 'maint master..next').\n \n+-q::\n+--quiet::\n+\tQuiet, suppress feedback messages.\n+\n -e::\n --edit::\n \tWith this option, 'git cherry-pick' will let you edit the commit\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex f79c9d8..98a8e7a 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -8,7 +8,7 @@ git-revert - Revert some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...\n+'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...\n 'git revert' --continue\n 'git revert' --quit\n 'git revert' --abort\n@@ -40,6 +40,10 @@ OPTIONS\n \tdefault, see linkgit:git-rev-list[1] and its '--no-walk'\n \toption.\n \n+-q::\n+--quiet::\n+\tQuiet, suppress feedback messages.\n+\n -e::\n --edit::\n \tWith this option, 'git revert' will let you edit the commit\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 6e7cb2a..7a7fde6 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -102,6 +102,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tint contin = 0;\n \tint rollback = 0;\n \tstruct option options[] = {\n+\t\tOPT__QUIET(&opts->quiet, N_(\"suppress progress reporting\")),\n \t\tOPT_BOOLEAN(0, \"quit\", &remove_state, N_(\"end revert or cherry-pick sequence\")),\n \t\tOPT_BOOLEAN(0, \"continue\", &contin, N_(\"resume revert or cherry-pick sequence\")),\n \t\tOPT_BOOLEAN(0, \"abort\", &rollback, N_(\"cancel revert or cherry-pick sequence\")),\ndiff --git a/sequencer.c b/sequencer.c\nindex c387828..d6199e4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -395,6 +395,8 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,\n \targv_array_init(&array);\n \targv_array_push(&array, \"commit\");\n \targv_array_push(&array, \"-n\");\n+\tif (opts->quiet)\n+\t\targv_array_push(&array, \"-q\");\n \n \tif (opts->signoff)\n \t\targv_array_push(&array, \"-s\");\n@@ -634,9 +636,10 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n \t}\n \n \tif (opts->skip_empty && is_index_unchanged() == 1) {\n-\t\twarning(_(\"skipping %s... %s\"),\n-\t\t\tfind_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n-\t\t\tmsg.subject);\n+\t\tif (!opts->quiet)\n+\t\t\twarning(_(\"skipping %s... %s\"),\n+\t\t\t\tfind_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n+\t\t\t\tmsg.subject);\n \t\tgoto leave;\n \t}\n \tallow = allow_empty(opts, commit);\n@@ -666,7 +669,7 @@ static void prepare_revs(struct replay_opts *opts)\n \tif (prepare_revision_walk(opts->revs))\n \t\tdie(_(\"revision walk setup failed\"));\n \n-\tif (!opts->revs->commits)\n+\tif (!opts->revs->commits && !opts->quiet)\n \t\terror(_(\"empty commit set passed\"));\n }\n \ndiff --git a/sequencer.h b/sequencer.h\nindex 3b04844..d37c003 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -35,6 +35,7 @@ struct replay_opts {\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n \tint skip_empty;\n+\tint quiet;\n \n \tint mainline;\n \n-- \n1.8.4-fc\n"},{"id":"226301","messageId":"1377842182-18724-5-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 04/28] revert/cherry-pick: add --skip option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:58Z","receivedAt":"2013-08-30T05:55:58Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Akin to 'am --skip' and 'rebase --skip'.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-cherry-pick.txt |  1 +\n Documentation/git-revert.txt      |  1 +\n Documentation/sequencer.txt       |  3 +++\n builtin/revert.c                  |  6 ++++++\n sequencer.c                       | 24 ++++++++++++++++++++++++\n sequencer.h                       |  3 ++-\n t/t3510-cherry-pick-sequence.sh   | 12 ++++++++++++\n 7 files changed, 49 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex da0bd81..d95c63c 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -10,6 +10,7 @@ SYNOPSIS\n [verse]\n 'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...\n 'git cherry-pick' --continue\n+'git cherry-pick' --skip\n 'git cherry-pick' --quit\n 'git cherry-pick' --abort\n \ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 98a8e7a..52e146e 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -10,6 +10,7 @@ SYNOPSIS\n [verse]\n 'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...\n 'git revert' --continue\n+'git revert' --skip\n 'git revert' --quit\n 'git revert' --abort\n \ndiff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt\nindex 5747f44..df2d355 100644\n--- a/Documentation/sequencer.txt\n+++ b/Documentation/sequencer.txt\n@@ -3,6 +3,9 @@\n \t'.git/sequencer'.  Can be used to continue after resolving\n \tconflicts in a failed cherry-pick or revert.\n \n+--skip::\n+\tSkip the current commit, and then continue.\n+\n --quit::\n \tForget about the current operation in progress.  Can be used\n \tto clear the sequencer state after a failed cherry-pick or\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 7a7fde6..d3ae2c4 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -101,11 +101,13 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tint remove_state = 0;\n \tint contin = 0;\n \tint rollback = 0;\n+\tint skip = 0;\n \tstruct option options[] = {\n \t\tOPT__QUIET(&opts->quiet, N_(\"suppress progress reporting\")),\n \t\tOPT_BOOLEAN(0, \"quit\", &remove_state, N_(\"end revert or cherry-pick sequence\")),\n \t\tOPT_BOOLEAN(0, \"continue\", &contin, N_(\"resume revert or cherry-pick sequence\")),\n \t\tOPT_BOOLEAN(0, \"abort\", &rollback, N_(\"cancel revert or cherry-pick sequence\")),\n+\t\tOPT_BOOLEAN(0, \"skip\", &skip, N_(\"skip current commit in the sequence\")),\n \t\tOPT_BOOLEAN('n', \"no-commit\", &opts->no_commit, N_(\"don't automatically commit\")),\n \t\tOPT_BOOLEAN('e', \"edit\", &opts->edit, N_(\"edit the commit message\")),\n \t\tOPT_NOOP_NOARG('r', NULL),\n@@ -166,6 +168,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\topts->subcommand = REPLAY_CONTINUE;\n \telse if (rollback)\n \t\topts->subcommand = REPLAY_ROLLBACK;\n+\telse if (skip)\n+\t\topts->subcommand = REPLAY_SKIP;\n \telse\n \t\topts->subcommand = REPLAY_NONE;\n \n@@ -176,6 +180,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\tthis_operation = \"--quit\";\n \t\telse if (opts->subcommand == REPLAY_CONTINUE)\n \t\t\tthis_operation = \"--continue\";\n+\t\telse if (opts->subcommand == REPLAY_SKIP)\n+\t\t\tthis_operation = \"--skip\";\n \t\telse {\n \t\t\tassert(opts->subcommand == REPLAY_ROLLBACK);\n \t\t\tthis_operation = \"--abort\";\ndiff --git a/sequencer.c b/sequencer.c\nindex d6199e4..d0e65de 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1056,6 +1056,28 @@ static int sequencer_continue(struct replay_opts *opts)\n \treturn pick_commits(todo_list, opts);\n }\n \n+static int sequencer_skip(struct replay_opts *opts)\n+{\n+\tconst char *argv[4]; /* reset --hard HEAD + NULL */\n+\tstruct string_list merge_rr = STRING_LIST_INIT_DUP;\n+\tint ret;\n+\n+\tif (setup_rerere(&merge_rr, 0) >= 0) {\n+\t\trerere_clear(&merge_rr);\n+\t\tstring_list_clear(&merge_rr, 1);\n+\t}\n+\n+\targv[0] = \"reset\";\n+\targv[1] = \"--hard\";\n+\targv[2] = \"HEAD\";\n+\targv[3] = NULL;\n+\tret = run_command_v_opt(argv, RUN_GIT_CMD);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn sequencer_continue(opts);\n+}\n+\n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n {\n \tsetenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n@@ -1086,6 +1108,8 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n \t\treturn sequencer_rollback(opts);\n \tif (opts->subcommand == REPLAY_CONTINUE)\n \t\treturn sequencer_continue(opts);\n+\tif (opts->subcommand == REPLAY_SKIP)\n+\t\treturn sequencer_skip(opts);\n \n \tfor (i = 0; i < opts->revs->pending.nr; i++) {\n \t\tunsigned char sha1[20];\ndiff --git a/sequencer.h b/sequencer.h\nindex d37c003..74d592a 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -17,7 +17,8 @@ enum replay_subcommand {\n \tREPLAY_NONE,\n \tREPLAY_REMOVE_STATE,\n \tREPLAY_CONTINUE,\n-\tREPLAY_ROLLBACK\n+\tREPLAY_ROLLBACK,\n+\tREPLAY_SKIP\n };\n \n struct replay_opts {\ndiff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh\nindex 33c5512..c43c327 100755\n--- a/t/t3510-cherry-pick-sequence.sh\n+++ b/t/t3510-cherry-pick-sequence.sh\n@@ -511,4 +511,16 @@ test_expect_success 'commit descriptions in insn sheet are optional' '\n \ttest_line_count = 4 commits\n '\n \n+test_expect_success 'skip' '\n+\tpristine_detach conflicting &&\n+\ttest_must_fail git cherry-pick initial..picked &&\n+\n+\tgit checkout HEAD -- unrelated &&\n+\ttest_must_fail git cherry-pick --continue &&\n+\tgit cherry-pick --skip &&\n+\n+\tgit rev-list initial..HEAD >commits &&\n+\ttest_line_count = 3 commits\n+'\n+\n test_done\n-- \n1.8.4-fc\n"},{"id":"226324","messageId":"1377842182-18724-6-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 05/28] builtin: add rewrite helper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:55:59Z","receivedAt":"2013-08-30T05:55:59Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So that we can load and store rewrites, as well as other operations on a\nlist of rewritten commits.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Makefile  |  2 ++\n rewrite.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n rewrite.h | 18 ++++++++++++++++\n 3 files changed, 91 insertions(+)\n create mode 100644 rewrite.c\n create mode 100644 rewrite.h\n\ndiff --git a/Makefile b/Makefile\nindex 3588ca1..9396d57 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -716,6 +716,7 @@ LIB_H += remote.h\n LIB_H += rerere.h\n LIB_H += resolve-undo.h\n LIB_H += revision.h\n+LIB_H += rewrite.h\n LIB_H += run-command.h\n LIB_H += send-pack.h\n LIB_H += sequencer.h\n@@ -860,6 +861,7 @@ LIB_OBJS += replace_object.o\n LIB_OBJS += rerere.o\n LIB_OBJS += resolve-undo.o\n LIB_OBJS += revision.o\n+LIB_OBJS += rewrite.o\n LIB_OBJS += run-command.o\n LIB_OBJS += send-pack.o\n LIB_OBJS += sequencer.o\ndiff --git a/rewrite.c b/rewrite.c\nnew file mode 100644\nindex 0000000..2793688\n--- /dev/null\n+++ b/rewrite.c\n@@ -0,0 +1,71 @@\n+#include \"cache.h\"\n+#include \"rewrite.h\"\n+\n+void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to)\n+{\n+\tstruct rewritten_item *item;\n+\tALLOC_GROW(list->items, list->nr, list->alloc);\n+\titem = &list->items[list->nr];\n+\thashcpy(item->from, from);\n+\thashcpy(item->to, to);\n+\tlist->nr++;\n+}\n+\n+int store_rewritten(struct rewritten *list, const char *file)\n+{\n+\tstatic struct lock_file lock;\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tint fd, i, ret = 0;\n+\n+\tfd = hold_lock_file_for_update(&lock, file, LOCK_DIE_ON_ERROR);\n+\tfor (i = 0; i < list->nr; i++) {\n+\t\tstruct rewritten_item *item = &list->items[i];\n+\t\tstrbuf_addf(&buf, \"%s %s\\n\", sha1_to_hex(item->from), sha1_to_hex(item->to));\n+\t}\n+\tif (write_in_full(fd, buf.buf, buf.len) < 0) {\n+\t\terror(_(\"Could not write to %s\"), file);\n+\t\tret = 1;\n+\t\tgoto leave;\n+\t}\n+\tif (commit_lock_file(&lock) < 0) {\n+\t\terror(_(\"Error wrapping up %s.\"), file);\n+\t\tret = 1;\n+\t\tgoto leave;\n+\t}\n+leave:\n+\tstrbuf_release(&buf);\n+\treturn ret;\n+}\n+\n+void load_rewritten(struct rewritten *list, const char *file)\n+{\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tchar *p;\n+\tint fd;\n+\n+\tfd = open(file, O_RDONLY);\n+\tif (fd < 0)\n+\t\treturn;\n+\tif (strbuf_read(&buf, fd, 0) < 0) {\n+\t\tclose(fd);\n+\t\tstrbuf_release(&buf);\n+\t\treturn;\n+\t}\n+\tclose(fd);\n+\n+\tfor (p = buf.buf; *p;) {\n+\t\tunsigned char from[20];\n+\t\tunsigned char to[20];\n+\t\tchar *eol = strchrnul(p, '\\n');\n+\t\tif (eol - p != 81)\n+\t\t\t/* wrong size */\n+\t\t\tbreak;\n+\t\tif (get_sha1_hex(p, from))\n+\t\t\tbreak;\n+\t\tif (get_sha1_hex(p + 41, to))\n+\t\t\tbreak;\n+\t\tadd_rewritten(list, from, to);\n+\t\tp = *eol ? eol + 1 : eol;\n+\t}\n+\tstrbuf_release(&buf);\n+}\ndiff --git a/rewrite.h b/rewrite.h\nnew file mode 100644\nindex 0000000..09e7222\n--- /dev/null\n+++ b/rewrite.h\n@@ -0,0 +1,18 @@\n+#ifndef REWRITE_H\n+#define REWRITE_H\n+\n+struct rewritten_item {\n+\tunsigned char from[20];\n+\tunsigned char to[20];\n+};\n+\n+struct rewritten {\n+\tstruct rewritten_item *items;\n+\tunsigned int nr, alloc;\n+};\n+\n+void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to);\n+int store_rewritten(struct rewritten *list, const char *file);\n+void load_rewritten(struct rewritten *list, const char *file);\n+\n+#endif\n-- \n1.8.4-fc\n"},{"id":"226300","messageId":"1377842182-18724-7-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 06/28] cherry-pick: store rewritten commits","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:00Z","receivedAt":"2013-08-30T05:56:00Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Will be useful for the next commits.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n sequencer.c | 22 +++++++++++++++++++++-\n sequencer.h |  1 +\n 2 files changed, 22 insertions(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex d0e65de..468fa54 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -14,11 +14,13 @@\n #include \"merge-recursive.h\"\n #include \"refs.h\"\n #include \"argv-array.h\"\n+#include \"rewrite.h\"\n \n #define GIT_REFLOG_ACTION \"GIT_REFLOG_ACTION\"\n \n const char sign_off_header[] = \"Signed-off-by: \";\n static const char cherry_picked_prefix[] = \"(cherry picked from commit \";\n+static struct rewritten rewritten;\n \n static int is_rfc2822_line(const char *buf, int len)\n {\n@@ -650,6 +652,14 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n \tif (!opts->no_commit)\n \t\tres = run_git_commit(defmsg, opts, allow);\n \n+\tif (!res && opts->action == REPLAY_PICK) {\n+\t\tunsigned char to[20];\n+\n+\t\tif (read_ref(\"HEAD\", to))\n+\t\t\tgoto leave;\n+\n+\t\tadd_rewritten(&rewritten, commit->object.sha1, to);\n+\t}\n leave:\n \tfree_message(&msg);\n \tfree(defmsg);\n@@ -1012,8 +1022,11 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\n \tfor (cur = todo_list; cur; cur = cur->next) {\n \t\tsave_todo(cur, opts);\n \t\tres = do_pick_commit(cur->item, opts);\n-\t\tif (res)\n+\t\tif (res) {\n+\t\t\tif (opts->action == REPLAY_PICK)\n+\t\t\t\tstore_rewritten(&rewritten, git_path(SEQ_REWR_FILE));\n \t\t\treturn res;\n+\t\t}\n \t}\n \n \t/*\n@@ -1042,6 +1055,8 @@ static int sequencer_continue(struct replay_opts *opts)\n \t\treturn continue_single_pick();\n \tread_populate_opts(&opts);\n \tread_populate_todo(&todo_list, opts);\n+\tif (opts->action == REPLAY_PICK)\n+\t\tload_rewritten(&rewritten, git_path(SEQ_REWR_FILE));\n \n \t/* Verify that the conflict has been resolved */\n \tif (file_exists(git_path(\"CHERRY_PICK_HEAD\")) ||\n@@ -1052,6 +1067,11 @@ static int sequencer_continue(struct replay_opts *opts)\n \t}\n \tif (index_differs_from(\"HEAD\", 0))\n \t\treturn error_dirty_index(opts);\n+\tif (opts->action == REPLAY_PICK) {\n+\t\tunsigned char to[20];\n+\t\tif (!read_ref(\"HEAD\", to))\n+\t\t\tadd_rewritten(&rewritten, todo_list->item->object.sha1, to);\n+\t}\n \ttodo_list = todo_list->next;\n \treturn pick_commits(todo_list, opts);\n }\ndiff --git a/sequencer.h b/sequencer.h\nindex 74d592a..efec1b5 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -5,6 +5,7 @@\n #define SEQ_HEAD_FILE\t\"sequencer/head\"\n #define SEQ_TODO_FILE\t\"sequencer/todo\"\n #define SEQ_OPTS_FILE\t\"sequencer/opts\"\n+#define SEQ_REWR_FILE\t\"sequencer/rewritten\"\n \n #define APPEND_SIGNOFF_DEDUP (1u << 0)\n \n-- \n1.8.4-fc\n"},{"id":"226302","messageId":"1377842182-18724-8-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 07/28] cherry-pick: don't store skipped commit","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:01Z","receivedAt":"2013-08-30T05:56:01Z","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 sequencer.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 468fa54..56d791f 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1047,7 +1047,7 @@ static int continue_single_pick(void)\n \treturn run_command_v_opt(argv, RUN_GIT_CMD);\n }\n \n-static int sequencer_continue(struct replay_opts *opts)\n+static int sequencer_continue(struct replay_opts *opts, int skip)\n {\n \tstruct commit_list *todo_list = NULL;\n \n@@ -1067,7 +1067,7 @@ static int sequencer_continue(struct replay_opts *opts)\n \t}\n \tif (index_differs_from(\"HEAD\", 0))\n \t\treturn error_dirty_index(opts);\n-\tif (opts->action == REPLAY_PICK) {\n+\tif (opts->action == REPLAY_PICK && !skip) {\n \t\tunsigned char to[20];\n \t\tif (!read_ref(\"HEAD\", to))\n \t\t\tadd_rewritten(&rewritten, todo_list->item->object.sha1, to);\n@@ -1095,7 +1095,7 @@ static int sequencer_skip(struct replay_opts *opts)\n \tif (ret)\n \t\treturn ret;\n \n-\treturn sequencer_continue(opts);\n+\treturn sequencer_continue(opts, 1);\n }\n \n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n@@ -1127,7 +1127,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n \tif (opts->subcommand == REPLAY_ROLLBACK)\n \t\treturn sequencer_rollback(opts);\n \tif (opts->subcommand == REPLAY_CONTINUE)\n-\t\treturn sequencer_continue(opts);\n+\t\treturn sequencer_continue(opts, 0);\n \tif (opts->subcommand == REPLAY_SKIP)\n \t\treturn sequencer_skip(opts);\n \n-- \n1.8.4-fc\n"},{"id":"226304","messageId":"1377842182-18724-9-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 08/28] builtin: move run_rewrite_hook() to rewrite.c","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:02Z","receivedAt":"2013-08-30T05:56:02Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"And use struct rewrite.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/commit.c | 38 +++++---------------------------------\n rewrite.c        | 32 ++++++++++++++++++++++++++++++++\n rewrite.h        |  1 +\n 3 files changed, 38 insertions(+), 33 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 10acc53..7bfe9d0 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -30,6 +30,7 @@\n #include \"column.h\"\n #include \"sequencer.h\"\n #include \"notes-utils.h\"\n+#include \"rewrite.h\"\n \n static const char * const builtin_commit_usage[] = {\n \tN_(\"git commit [options] [--] <pathspec>...\"),\n@@ -1386,38 +1387,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \treturn git_status_config(k, v, s);\n }\n \n-static int run_rewrite_hook(const unsigned char *oldsha1,\n-\t\t\t    const unsigned char *newsha1)\n-{\n-\t/* oldsha1 SP newsha1 LF NUL */\n-\tstatic char buf[2*40 + 3];\n-\tstruct child_process proc;\n-\tconst char *argv[3];\n-\tint code;\n-\tsize_t n;\n-\n-\targv[0] = find_hook(\"post-rewrite\");\n-\tif (!argv[0])\n-\t\treturn 0;\n-\n-\targv[1] = \"amend\";\n-\targv[2] = NULL;\n-\n-\tmemset(&proc, 0, sizeof(proc));\n-\tproc.argv = argv;\n-\tproc.in = -1;\n-\tproc.stdout_to_stderr = 1;\n-\n-\tcode = start_command(&proc);\n-\tif (code)\n-\t\treturn code;\n-\tn = snprintf(buf, sizeof(buf), \"%s %s\\n\",\n-\t\t     sha1_to_hex(oldsha1), sha1_to_hex(newsha1));\n-\twrite_in_full(proc.in, buf, n);\n-\tclose(proc.in);\n-\treturn finish_command(&proc);\n-}\n-\n int cmd_commit(int argc, const char **argv, const char *prefix)\n {\n \tstatic struct wt_status s;\n@@ -1653,13 +1622,16 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \trun_hook(get_index_file(), \"post-commit\", NULL);\n \tif (amend && !no_post_rewrite) {\n \t\tstruct notes_rewrite_cfg *cfg;\n+\t\tstruct rewritten rewrite;\n+\t\tmemset(&rewrite, 0, sizeof(rewrite));\n \t\tcfg = init_copy_notes_for_rewrite(\"amend\");\n \t\tif (cfg) {\n \t\t\t/* we are amending, so current_head is not NULL */\n \t\t\tcopy_note_for_rewrite(cfg, current_head->object.sha1, sha1);\n \t\t\tfinish_copy_notes_for_rewrite(cfg, \"Notes added by 'git commit --amend'\");\n \t\t}\n-\t\trun_rewrite_hook(current_head->object.sha1, sha1);\n+\t\tadd_rewritten(&rewrite, current_head->object.sha1, sha1);\n+\t\trun_rewrite_hook(&rewrite, \"amend\");\n \t}\n \tif (!quiet)\n \t\tprint_summary(prefix, sha1, !current_head);\ndiff --git a/rewrite.c b/rewrite.c\nindex 2793688..c8efaa8 100644\n--- a/rewrite.c\n+++ b/rewrite.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"rewrite.h\"\n+#include \"run-command.h\"\n \n void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to)\n {\n@@ -69,3 +70,34 @@ void load_rewritten(struct rewritten *list, const char *file)\n \t}\n \tstrbuf_release(&buf);\n }\n+\n+int run_rewrite_hook(struct rewritten *list, const char *name)\n+{\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tstruct child_process proc;\n+\tconst char *argv[3];\n+\tint code, i;\n+\n+\targv[0] = find_hook(\"post-rewrite\");\n+\tif (!argv[0])\n+\t\treturn 0;\n+\n+\targv[1] = name;\n+\targv[2] = NULL;\n+\n+\tmemset(&proc, 0, sizeof(proc));\n+\tproc.argv = argv;\n+\tproc.in = -1;\n+\tproc.stdout_to_stderr = 1;\n+\n+\tcode = start_command(&proc);\n+\tif (code)\n+\t\treturn code;\n+\tfor (i = 0; i < list->nr; i++) {\n+\t\tstruct rewritten_item *item = &list->items[i];\n+\t\tstrbuf_addf(&buf, \"%s %s\\n\", sha1_to_hex(item->from), sha1_to_hex(item->to));\n+\t}\n+\twrite_in_full(proc.in, buf.buf, buf.len);\n+\tclose(proc.in);\n+\treturn finish_command(&proc);\n+}\ndiff --git a/rewrite.h b/rewrite.h\nindex 09e7222..fd00e66 100644\n--- a/rewrite.h\n+++ b/rewrite.h\n@@ -14,5 +14,6 @@ struct rewritten {\n void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to);\n int store_rewritten(struct rewritten *list, const char *file);\n void load_rewritten(struct rewritten *list, const char *file);\n+int run_rewrite_hook(struct rewritten *list, const char *name);\n \n #endif\n-- \n1.8.4-fc\n"},{"id":"226323","messageId":"1377842182-18724-10-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 09/28] builtin: rewrite: add copy_rewrite_notes()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:03Z","receivedAt":"2013-08-30T05:56:03Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"And use it on commit.c.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/commit.c |  8 +-------\n rewrite.c        | 18 ++++++++++++++++++\n rewrite.h        |  1 +\n 3 files changed, 20 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 7bfe9d0..cc589d5 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1621,16 +1621,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \trerere(0);\n \trun_hook(get_index_file(), \"post-commit\", NULL);\n \tif (amend && !no_post_rewrite) {\n-\t\tstruct notes_rewrite_cfg *cfg;\n \t\tstruct rewritten rewrite;\n \t\tmemset(&rewrite, 0, sizeof(rewrite));\n-\t\tcfg = init_copy_notes_for_rewrite(\"amend\");\n-\t\tif (cfg) {\n-\t\t\t/* we are amending, so current_head is not NULL */\n-\t\t\tcopy_note_for_rewrite(cfg, current_head->object.sha1, sha1);\n-\t\t\tfinish_copy_notes_for_rewrite(cfg, \"Notes added by 'git commit --amend'\");\n-\t\t}\n \t\tadd_rewritten(&rewrite, current_head->object.sha1, sha1);\n+\t\tcopy_rewrite_notes(&rewrite, \"amend\", \"Notes added by 'git commit --amend'\");\n \t\trun_rewrite_hook(&rewrite, \"amend\");\n \t}\n \tif (!quiet)\ndiff --git a/rewrite.c b/rewrite.c\nindex c8efaa8..4dddcd9 100644\n--- a/rewrite.c\n+++ b/rewrite.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"rewrite.h\"\n #include \"run-command.h\"\n+#include \"notes-utils.h\"\n \n void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to)\n {\n@@ -101,3 +102,20 @@ int run_rewrite_hook(struct rewritten *list, const char *name)\n \tclose(proc.in);\n \treturn finish_command(&proc);\n }\n+\n+void copy_rewrite_notes(struct rewritten *list, const char *name, const char *msg)\n+{\n+\tstruct notes_rewrite_cfg *cfg;\n+\tint i;\n+\n+\tcfg = init_copy_notes_for_rewrite(name);\n+\tif (!cfg)\n+\t\treturn;\n+\n+\tfor (i = 0; i < list->nr; i++) {\n+\t\tstruct rewritten_item *item = &list->items[i];\n+\t\tcopy_note_for_rewrite(cfg, item->from, item->to);\n+\t}\n+\n+\tfinish_copy_notes_for_rewrite(cfg, msg);\n+}\ndiff --git a/rewrite.h b/rewrite.h\nindex fd00e66..fdc7055 100644\n--- a/rewrite.h\n+++ b/rewrite.h\n@@ -15,5 +15,6 @@ void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *t\n int store_rewritten(struct rewritten *list, const char *file);\n void load_rewritten(struct rewritten *list, const char *file);\n int run_rewrite_hook(struct rewritten *list, const char *name);\n+void copy_rewrite_notes(struct rewritten *list, const char *name, const char *msg);\n \n #endif\n-- \n1.8.4-fc\n"},{"id":"226305","messageId":"1377842182-18724-11-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 10/28] cherry-pick: add --action-name option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:04Z","receivedAt":"2013-08-30T05:56:04Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So it can be used by other tools (e.g. git rebase), and the right action\nis passed to the hooks and notes rewrite stuff.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/revert.c           | 2 ++\n git-rebase--interactive.sh | 4 ++--\n sequencer.c                | 6 +++++-\n sequencer.h                | 2 ++\n 4 files changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex d3ae2c4..ca28e52 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -124,6 +124,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\tOPT_END(),\n \t\tOPT_END(),\n \t\tOPT_END(),\n+\t\tOPT_END(),\n \t};\n \n \tif (opts->action == REPLAY_PICK) {\n@@ -134,6 +135,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\tOPT_BOOLEAN(0, \"allow-empty-message\", &opts->allow_empty_message, N_(\"allow commits with empty messages\")),\n \t\t\tOPT_BOOLEAN(0, \"keep-redundant-commits\", &opts->keep_redundant_commits, N_(\"keep redundant, empty commits\")),\n \t\t\tOPT_BOOLEAN(0, \"skip-empty\", &opts->skip_empty, N_(\"skip empty commits\")),\n+\t\t\tOPT_STRING(0, \"action-name\", &opts->action_name, N_(\"name\"), N_(\"action name\")),\n \t\t\tOPT_END(),\n \t\t};\n \t\tif (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 83d6d46..e8143ae 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -251,7 +251,7 @@ pick_one () {\n \n \ttest -d \"$rewritten\" &&\n \t\tpick_one_preserving_merges \"$@\" && return\n-\toutput eval git cherry-pick \"$strategy_args\" $empty_args $ff \"$@\"\n+\toutput eval git cherry-pick \"--action-name ''\" \"$strategy_args\" $empty_args $ff \"$@\"\n }\n \n pick_one_preserving_merges () {\n@@ -361,7 +361,7 @@ pick_one_preserving_merges () {\n \t\t\techo \"$sha1 $(git rev-parse HEAD^0)\" >> \"$rewritten_list\"\n \t\t\t;;\n \t\t*)\n-\t\t\toutput eval git cherry-pick \"$strategy_args\" \"$@\" ||\n+\t\t\toutput eval git cherry-pick \"--action-name ''\" \"$strategy_args\" \"$@\" ||\n \t\t\t\tdie_with_patch $sha1 \"Could not pick $sha1\"\n \t\t\t;;\n \t\tesac\ndiff --git a/sequencer.c b/sequencer.c\nindex 56d791f..46848c4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -829,7 +829,9 @@ static int populate_opts_cb(const char *key, const char *value, void *data)\n \telse if (!strcmp(key, \"options.strategy-option\")) {\n \t\tALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);\n \t\topts->xopts[opts->xopts_nr++] = xstrdup(value);\n-\t} else\n+\t} else if (!strcmp(key, \"options.action-name\"))\n+\t\tgit_config_string(&opts->action_name, key, value);\n+\telse\n \t\treturn error(_(\"Invalid key: %s\"), key);\n \n \tif (!error_flag)\n@@ -1006,6 +1008,8 @@ static void save_opts(struct replay_opts *opts)\n \t\t\t\t\t\t\t\"options.strategy-option\",\n \t\t\t\t\t\t\topts->xopts[i], \"^$\", 0);\n \t}\n+\tif (opts->action_name)\n+\t\tgit_config_set_in_file(opts_file, \"options.action-name\", opts->action_name);\n }\n \n static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\ndiff --git a/sequencer.h b/sequencer.h\nindex efec1b5..6dfffaa 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -48,6 +48,8 @@ struct replay_opts {\n \n \t/* Only used by REPLAY_NONE */\n \tstruct rev_info *revs;\n+\n+\tconst char *action_name;\n };\n \n int sequencer_pick_revisions(struct replay_opts *opts);\n-- \n1.8.4-fc\n"},{"id":"226303","messageId":"1377842182-18724-12-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 11/28] cherry-pick: copy notes and run hooks","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:05Z","receivedAt":"2013-08-30T05:56:05Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"If no action-name is specified, nothing is done.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/config.txt   |  9 ++++-----\n Documentation/githooks.txt |  8 ++++----\n rewrite.c                  |  1 +\n sequencer.c                | 25 ++++++++++++++++++++++++-\n 4 files changed, 33 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ec57a15..7e7f89f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1691,11 +1691,10 @@ GIT_NOTES_REF) is also implicitly added to the list of refs to be\n displayed.\n \n notes.rewrite.<command>::\n-\tWhen rewriting commits with <command> (currently `amend` or\n-\t`rebase`) and this variable is set to `true`, Git\n-\tautomatically copies your notes from the original to the\n-\trewritten commit.  Defaults to `true`, but see\n-\t\"notes.rewriteRef\" below.\n+\tWhen rewriting commits with <command> (currently `amend`, `rebase`, or\n+\t`cherry-pick`) and this variable is set to `true`, Git automatically\n+\tcopies your notes from the original to the rewritten commit.  Defaults\n+\tto `true`, but see \"notes.rewriteRef\" below.\n \n notes.rewriteMode::\n \tWhen copying notes during a rewrite (see the\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d48bf4d..8cfa13b 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -352,10 +352,10 @@ post-rewrite\n ~~~~~~~~~~~~\n \n This hook is invoked by commands that rewrite commits (`git commit\n---amend`, 'git-rebase'; currently 'git-filter-branch' does 'not' call\n-it!).  Its first argument denotes the command it was invoked by:\n-currently one of `amend` or `rebase`.  Further command-dependent\n-arguments may be passed in the future.\n+--amend`, `git rebase`, `git cherry-pick`; currently `git filter-branch` does\n+'not' call it!).  Its first argument denotes the command it was invoked by\n+(e.g. `rebase`).  Further command-dependent arguments may be passed in the\n+future.\n \n The hook receives a list of the rewritten commits on stdin, in the\n format\ndiff --git a/rewrite.c b/rewrite.c\nindex 4dddcd9..4f95094 100644\n--- a/rewrite.c\n+++ b/rewrite.c\n@@ -2,6 +2,7 @@\n #include \"rewrite.h\"\n #include \"run-command.h\"\n #include \"notes-utils.h\"\n+#include \"builtin.h\"\n \n void add_rewritten(struct rewritten *list, unsigned char *from, unsigned char *to)\n {\ndiff --git a/sequencer.c b/sequencer.c\nindex 46848c4..076bb9d 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -22,6 +22,22 @@ const char sign_off_header[] = \"Signed-off-by: \";\n static const char cherry_picked_prefix[] = \"(cherry picked from commit \";\n static struct rewritten rewritten;\n \n+static void finish(struct replay_opts *opts)\n+{\n+\tconst char *name;\n+\n+\tif (opts->action != REPLAY_PICK)\n+\t\treturn;\n+\n+\tname = opts->action_name ? opts->action_name : \"cherry-pick\";\n+\n+\tif (!*name)\n+\t\treturn;\n+\n+\tcopy_rewrite_notes(&rewritten, name, \"Notes added by 'git cherry-pick'\");\n+\trun_rewrite_hook(&rewritten, name);\n+}\n+\n static int is_rfc2822_line(const char *buf, int len)\n {\n \tint i;\n@@ -1033,6 +1049,8 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\n \t\t}\n \t}\n \n+\tfinish(opts);\n+\n \t/*\n \t * Sequence of picks finished successfully; cleanup by\n \t * removing the .git/sequencer directory\n@@ -1104,8 +1122,13 @@ static int sequencer_skip(struct replay_opts *opts)\n \n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n {\n+\tint ret;\n \tsetenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n-\treturn do_pick_commit(cmit, opts);\n+\tret = do_pick_commit(cmit, opts);\n+\tif (ret)\n+\t\treturn ret;\n+\tfinish(opts);\n+\treturn 0;\n }\n \n int sequencer_pick_revisions(struct replay_opts *opts)\n-- \n1.8.4-fc\n"},{"id":"226306","messageId":"1377842182-18724-13-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 12/28] cherry-pick: remember rerere-autoupdate","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:06Z","receivedAt":"2013-08-30T05:56:06Z","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 sequencer.c | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 076bb9d..453e4a4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -847,6 +847,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data)\n \t\topts->xopts[opts->xopts_nr++] = xstrdup(value);\n \t} else if (!strcmp(key, \"options.action-name\"))\n \t\tgit_config_string(&opts->action_name, key, value);\n+\telse if (!strcmp(key, \"options.allow-rerere-auto\"))\n+\t\topts->allow_rerere_auto = git_config_int(key, value);\n \telse\n \t\treturn error(_(\"Invalid key: %s\"), key);\n \n@@ -1026,6 +1028,12 @@ static void save_opts(struct replay_opts *opts)\n \t}\n \tif (opts->action_name)\n \t\tgit_config_set_in_file(opts_file, \"options.action-name\", opts->action_name);\n+\tif (opts->allow_rerere_auto) {\n+\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\tstrbuf_addf(&buf, \"%d\", opts->allow_rerere_auto);\n+\t\tgit_config_set_in_file(opts_file, \"options.allow-rerere-auto\", buf.buf);\n+\t\tstrbuf_release(&buf);\n+\t}\n }\n \n static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\n-- \n1.8.4-fc\n"},{"id":"226307","messageId":"1377842182-18724-14-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 13/28] rebase: split the cherry-pick stuff","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:07Z","receivedAt":"2013-08-30T05:56:07Z","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\nNo functional changes.\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 | 30 ++++++++++++++++++++++++++++++\n git-rebase.sh             |  4 ++++\n 5 files changed, 37 insertions(+), 10 deletions(-)\n create mode 100644 git-rebase--cherrypick.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 6b1fd1b..3514737 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -114,6 +114,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 9396d57..2d6521e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -473,6 +473,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 34e3102..aae6a85 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 \trm -f \"$GIT_DIR/rebased-patches\"\n \n \tgit format-patch -k --stdout --full-index --ignore-if-in-upstream \\\n@@ -63,7 +55,6 @@ else\n \tret=$?\n \n \trm -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..2c16995\n--- /dev/null\n+++ b/git-rebase--cherrypick.sh\n@@ -0,0 +1,30 @@\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+\treturn\n+\t;;\n+skip)\n+\tgit am --skip --resolvemsg=\"$resolvemsg\" &&\n+\tmove_to_original_branch\n+\treturn\n+\t;;\n+esac\n+\n+test -n \"$rebase_root\" && root_flag=--root\n+\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+\treturn $ret\n+fi\n+\n+move_to_original_branch\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 8d7659a..2310638 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -412,6 +412,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.4-fc\n"},{"id":"226308","messageId":"1377842182-18724-15-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 14/28] rebase: cherry-pick: fix mode storage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:08Z","receivedAt":"2013-08-30T05:56:08Z","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 | 5 ++++-\n git-rebase.sh             | 5 ++++-\n 2 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex 2c16995..e142cfb 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -18,12 +18,15 @@ esac\n \n test -n \"$rebase_root\" && root_flag=--root\n \n+mkdir -p \"$state_dir\" || die \"Could not create temporary $state_dir\"\n+: > \"$state_dir\"/cherrypick || die \"Could not mark as cherrypick\"\n+\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+\twrite_basic_state\n \treturn $ret\n fi\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 2310638..b28addc 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -204,6 +204,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@@ -415,7 +418,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.4-fc\n"},{"id":"226309","messageId":"1377842182-18724-16-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 15/28] rebase: cherry-pick: fix sequence continuation","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:09Z","receivedAt":"2013-08-30T05:56:09Z","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 | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex e142cfb..d8d32fe 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -5,12 +5,12 @@\n \n case \"$action\" in\n continue)\n-\tgit am --resolved --resolvemsg=\"$resolvemsg\" &&\n+\tgit cherry-pick --continue &&\n \tmove_to_original_branch\n \treturn\n \t;;\n skip)\n-\tgit am --skip --resolvemsg=\"$resolvemsg\" &&\n+\tgit cherry-pick --skip &&\n \tmove_to_original_branch\n \treturn\n \t;;\n-- \n1.8.4-fc\n"},{"id":"226310","messageId":"1377842182-18724-17-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 16/28] rebase: cherry-pick: fix abort of cherry mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:10Z","receivedAt":"2013-08-30T05:56:10Z","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 b28addc..db2ea8d 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -368,6 +368,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.4-fc\n"},{"id":"226311","messageId":"1377842182-18724-18-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 17/28] rebase: cherry-pick: fix command invocations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:11Z","receivedAt":"2013-08-30T05:56:11Z","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 d8d32fe..e9ecccc 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -21,7 +21,22 @@ test -n \"$rebase_root\" && root_flag=--root\n mkdir -p \"$state_dir\" || die \"Could not create temporary $state_dir\"\n : > \"$state_dir\"/cherrypick || die \"Could not mark as cherrypick\"\n \n-git cherry-pick --allow-empty \"$revisions\"\n+if test -n \"$rebase_root\"\n+then\n+\trevisions=\"$onto...$orig_head\"\n+else\n+\trevisions=\"$upstream...$orig_head\"\n+fi\n+\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 $extra \"$revisions\"\n ret=$?\n \n if test 0 != $ret\n-- \n1.8.4-fc\n"},{"id":"226313","messageId":"1377842182-18724-19-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 18/28] rebase: cherry-pick: fix status messages","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:12Z","receivedAt":"2013-08-30T05:56:12Z","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 e9ecccc..be17ec4 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.4-fc\n"},{"id":"226312","messageId":"1377842182-18724-20-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 19/28] rebase: cherry-pick: automatically commit stage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:13Z","receivedAt":"2013-08-30T05:56:13Z","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 be17ec4..241cda7 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 \treturn\n-- \n1.8.4-fc\n"},{"id":"226316","messageId":"1377842182-18724-21-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 20/28] rebase: cherry-pick: set correct action-name","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:14Z","receivedAt":"2013-08-30T05:56:14Z","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 | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex 241cda7..d36b0dc 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -45,7 +45,7 @@ else\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 $extra \"$revisions\"\n+git cherry-pick --no-merges --right-only --topo-order --do-walk --action-name rebase $extra \"$revisions\"\n ret=$?\n \n if test 0 != $ret\n-- \n1.8.4-fc\n"},{"id":"226320","messageId":"1377842182-18724-22-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 21/28] rebase: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:15Z","receivedAt":"2013-08-30T05:56:15Z","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--am.sh | 1 +\n git-rebase.sh     | 1 -\n 2 files changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex aae6a85..d6a434c 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -51,6 +51,7 @@ ret=0\n \t\treturn $?\n \tfi\n \n+\ttest -n \"$GIT_QUIET\" && git_am_opt=\"$git_am_opt -q\"\n \tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n \tret=$?\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex db2ea8d..ebe87a3 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -284,7 +284,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-- \n1.8.4-fc\n"},{"id":"226314","messageId":"1377842182-18724-23-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 22/28] t: rebase-autostash: fix setup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:16Z","receivedAt":"2013-08-30T05:56: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 t/t3420-rebase-autostash.sh | 105 ++++++++++++++++++++++----------------------\n 1 file changed, 52 insertions(+), 53 deletions(-)\n\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex 90eb264..c179262 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -33,54 +33,56 @@ test_expect_success setup '\n \tgit commit -m \"related commit\"\n '\n \n+setup_tmp () {\n+\tgit clone . tmp &&\n+\tcd tmp &&\n+\tgit fetch -u origin \"refs/heads/*:refs/heads/*\" &&\n+\ttest_config rebase.autostash true &&\n+\tgit checkout -b rebased-feature-branch feature-branch\n+}\n+\n testrebase() {\n \ttype=$1\n \tdotest=$2\n \n \ttest_expect_success \"rebase$type: dirty worktree, non-conflicting rebase\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >>file3 &&\n \t\tgit rebase$type unrelated-onto-branch &&\n \t\tgrep unrelated file4 &&\n-\t\tgrep dirty file3 &&\n-\t\tgit checkout feature-branch\n+\t\tgrep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: dirty index, non-conflicting rebase\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >>file3 &&\n \t\tgit add file3 &&\n \t\tgit rebase$type unrelated-onto-branch &&\n \t\tgrep unrelated file4 &&\n-\t\tgrep dirty file3 &&\n-\t\tgit checkout feature-branch\n+\t\tgrep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: conflicting rebase\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >>file3 &&\n \t\ttest_must_fail git rebase$type related-onto-branch &&\n \t\ttest_path_is_file $dotest/autostash &&\n-\t\t! grep dirty file3 &&\n-\t\trm -rf $dotest &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout feature-branch\n+\t\t! grep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: --continue\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >>file3 &&\n \t\ttest_must_fail git rebase$type related-onto-branch &&\n \t\ttest_path_is_file $dotest/autostash &&\n@@ -89,45 +91,43 @@ testrebase() {\n \t\tgit add file2 &&\n \t\tgit rebase --continue &&\n \t\ttest_path_is_missing $dotest/autostash &&\n-\t\tgrep dirty file3 &&\n-\t\tgit checkout feature-branch\n+\t\tgrep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: --skip\" '\n-\t\ttest_config rebase.autostash true &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\techo dirty >>file3 &&\n \t\ttest_must_fail git rebase$type related-onto-branch &&\n \t\ttest_path_is_file $dotest/autostash &&\n \t\t! grep dirty file3 &&\n \t\tgit rebase --skip &&\n \t\ttest_path_is_missing $dotest/autostash &&\n-\t\tgrep dirty file3 &&\n-\t\tgit checkout feature-branch\n+\t\tgrep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: --abort\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >>file3 &&\n \t\ttest_must_fail git rebase$type related-onto-branch &&\n \t\ttest_path_is_file $dotest/autostash &&\n \t\t! grep dirty file3 &&\n \t\tgit rebase --abort &&\n \t\ttest_path_is_missing $dotest/autostash &&\n-\t\tgrep dirty file3 &&\n-\t\tgit checkout feature-branch\n+\t\tgrep dirty file3\n+\t\t)\n \t'\n \n \ttest_expect_success \"rebase$type: non-conflicting rebase, conflicting stash\" '\n-\t\ttest_config rebase.autostash true &&\n-\t\tgit reset --hard &&\n-\t\tgit checkout -b rebased-feature-branch feature-branch &&\n-\t\ttest_when_finished git branch -D rebased-feature-branch &&\n+\t\ttest_when_finished \"rm -rf tmp\" &&\n+\t\t(\n+\t\tsetup_tmp &&\n \t\techo dirty >file4 &&\n \t\tgit add file4 &&\n \t\tgit rebase$type unrelated-onto-branch &&\n@@ -138,29 +138,28 @@ testrebase() {\n \t\tgit checkout feature-branch &&\n \t\tgit stash pop &&\n \t\tgrep dirty file4\n+\t\t)\n \t'\n }\n \n test_expect_success \"rebase: fast-forward rebase\" '\n-\ttest_config rebase.autostash true &&\n-\tgit reset --hard &&\n-\tgit checkout -b behind-feature-branch feature-branch~1 &&\n-\ttest_when_finished git branch -D behind-feature-branch &&\n+\ttest_when_finished \"rm -rf tmp\" &&\n+\t(\n+\tsetup_tmp &&\n \techo dirty >>file1 &&\n \tgit rebase feature-branch &&\n-\tgrep dirty file1 &&\n-\tgit checkout feature-branch\n+\tgrep dirty file1\n+\t)\n '\n \n test_expect_success \"rebase: noop rebase\" '\n-\ttest_config rebase.autostash true &&\n-\tgit reset --hard &&\n-\tgit checkout -b same-feature-branch feature-branch &&\n-\ttest_when_finished git branch -D same-feature-branch &&\n+\ttest_when_finished \"rm -rf tmp\" &&\n+\t(\n+\tsetup_tmp &&\n \techo dirty >>file1 &&\n \tgit rebase feature-branch &&\n-\tgrep dirty file1 &&\n-\tgit checkout feature-branch\n+\tgrep dirty file1\n+\t)\n '\n \n testrebase \"\" .git/rebase-apply\n-- \n1.8.4-fc\n"},{"id":"226315","messageId":"1377842182-18724-24-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 23/28] sequencer: store progress information","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:17Z","receivedAt":"2013-08-30T05:56:17Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So that it can be used by shell prompts.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n sequencer.c | 24 ++++++++++++++++++++++--\n 1 file changed, 22 insertions(+), 2 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 453e4a4..c855dd4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -21,6 +21,7 @@\n const char sign_off_header[] = \"Signed-off-by: \";\n static const char cherry_picked_prefix[] = \"(cherry picked from commit \";\n static struct rewritten rewritten;\n+static int total;\n \n static void finish(struct replay_opts *opts)\n {\n@@ -877,8 +878,10 @@ static void walk_revs_populate_todo(struct commit_list **todo_list,\n \tprepare_revs(opts);\n \n \tnext = todo_list;\n-\twhile ((commit = get_revision(opts->revs)))\n+\twhile ((commit = get_revision(opts->revs))) {\n \t\tnext = commit_list_append(commit, next);\n+\t\ttotal++;\n+\t}\n }\n \n static int create_seq_dir(void)\n@@ -1036,6 +1039,21 @@ static void save_opts(struct replay_opts *opts)\n \t}\n }\n \n+static void save_info(int total, int step)\n+{\n+\tFILE *f;\n+\tf = fopen(git_path(\"sequencer/total\"), \"w\");\n+\tif (f) {\n+\t\tfprintf(f, \"%i\\n\", total);\n+\t\tfclose(f);\n+\t}\n+\tf = fopen(git_path(\"sequencer/step\"), \"w\");\n+\tif (f) {\n+\t\tfprintf(f, \"%i\\n\", step);\n+\t\tfclose(f);\n+\t}\n+}\n+\n static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\n {\n \tstruct commit_list *cur;\n@@ -1051,8 +1069,10 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)\n \t\tsave_todo(cur, opts);\n \t\tres = do_pick_commit(cur->item, opts);\n \t\tif (res) {\n-\t\t\tif (opts->action == REPLAY_PICK)\n+\t\t\tif (opts->action == REPLAY_PICK) {\n \t\t\t\tstore_rewritten(&rewritten, git_path(SEQ_REWR_FILE));\n+\t\t\t\tsave_info(total, rewritten.nr + 1);\n+\t\t\t}\n \t\t\treturn res;\n \t\t}\n \t}\n-- \n1.8.4-fc\n"},{"id":"226319","messageId":"1377842182-18724-25-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 24/28] prompt: parse cherry-pick rebase mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:18Z","receivedAt":"2013-08-30T05:56:18Z","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 contrib/completion/git-prompt.sh | 16 +++++++++++-----\n 1 file changed, 11 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex a81ef5a..a7bde16 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -313,12 +313,18 @@ __git_ps1 ()\n \tlocal total=\"\"\n \tif [ -d \"$g/rebase-merge\" ]; then\n \t\tread b 2>/dev/null <\"$g/rebase-merge/head-name\"\n-\t\tread step 2>/dev/null <\"$g/rebase-merge/msgnum\"\n-\t\tread total 2>/dev/null <\"$g/rebase-merge/end\"\n-\t\tif [ -f \"$g/rebase-merge/interactive\" ]; then\n-\t\t\tr=\"|REBASE-i\"\n+\t\tif [ -f \"$g/rebase-merge/cherrypick\" ]; then\n+\t\t\tread total 2>/dev/null <\"$g/sequencer/total\"\n+\t\t\tread step 2>/dev/null <\"$g/sequencer/step\"\n+\t\t\tr=\"|REBASE\"\n \t\telse\n-\t\t\tr=\"|REBASE-m\"\n+\t\t\tread step 2>/dev/null <\"$g/rebase-merge/msgnum\"\n+\t\t\tread total 2>/dev/null <\"$g/rebase-merge/end\"\n+\t\t\tif [ -f \"$g/rebase-merge/interactive\" ]; then\n+\t\t\t\tr=\"|REBASE-i\"\n+\t\t\telse\n+\t\t\t\tr=\"|REBASE-m\"\n+\t\t\tfi\n \t\tfi\n \telse\n \t\tif [ -d \"$g/rebase-apply\" ]; then\n-- \n1.8.4-fc\n"},{"id":"226318","messageId":"1377842182-18724-26-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 25/28] rebase: use 'cherrypick' mode instead of 'am'","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:19Z","receivedAt":"2013-08-30T05:56:19Z","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 git-rebase.sh                          | 8 ++++----\n t/t3407-rebase-abort.sh                | 2 +-\n t/t3420-rebase-autostash.sh            | 2 +-\n t/t3425-rebase-topology-merges.sh      | 6 +++---\n t/t5520-pull.sh                        | 2 +-\n t/t9106-git-svn-commit-diff-clobber.sh | 2 +-\n 6 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex ebe87a3..f0291df 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -415,13 +415,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/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex c179262..58bf705 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -162,7 +162,7 @@ test_expect_success \"rebase: noop rebase\" '\n \t)\n '\n \n-testrebase \"\" .git/rebase-apply\n+testrebase \"\" .git/rebase-merge\n testrebase \" --merge\" .git/rebase-merge\n testrebase \" --interactive\" .git/rebase-merge\n \ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 1d195fb..99b4535 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -71,7 +71,7 @@ test_run_rebase () {\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 'n o e' ''\n test_run_rebase success 'e n o' -m\n test_run_rebase success 'n o e' -i\n \n@@ -88,7 +88,7 @@ test_run_rebase () {\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 n o e' ''\n test_run_rebase success 'd e n o' -m\n test_run_rebase success 'd n o e' -i\n \n@@ -105,7 +105,7 @@ test_run_rebase () {\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 n o e' ''\n test_run_rebase success 'd e n o' -m\n test_run_rebase success 'd n o e' -i\n \ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ed4d9c8..751b50d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -273,7 +273,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.4-fc\n"},{"id":"226317","messageId":"1377842182-18724-27-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 26/28] rebase: cherry-pick: add merge options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:20Z","receivedAt":"2013-08-30T05:56:20Z","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 | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex d36b0dc..bda7cfc 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -45,6 +45,15 @@ else\n fi\n test -n \"$GIT_QUIET\" && extra=\"$extra -q\"\n test -z \"$force_rebase\" && extra=\"$extra --ff\"\n+test -n \"$strategy\" && extra=\"$extra --strategy=$strategy\"\n+for x in \"$strategy_opts\"\n+do\n+\ttest -z \"$x\" && continue\n+\tx=$(eval \"echo $x\")\n+\textra=\"$extra -X${x#--}\"\n+done\n+test -n \"$allow_rerere_autoupdate\" && extra=\"$extra $allow_rerere_autoupdate\"\n+\n git cherry-pick --no-merges --right-only --topo-order --do-walk --action-name rebase $extra \"$revisions\"\n ret=$?\n \n-- \n1.8.4-fc\n"},{"id":"226321","messageId":"1377842182-18724-28-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 27/28] rebase: remove merge mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:21Z","receivedAt":"2013-08-30T05:56:21Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"The cherrypick mode does the job.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n .gitignore                        |   1 -\n Makefile                          |   1 -\n git-rebase--interactive.sh        |   2 +-\n git-rebase--merge.sh              | 151 --------------------------------------\n git-rebase.sh                     |  13 +---\n t/t3406-rebase-message.sh         |  14 +---\n t/t3425-rebase-topology-merges.sh |   9 +--\n t/t9903-bash-prompt.sh            |   2 +-\n 8 files changed, 7 insertions(+), 186 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 3514737..7b64376 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -116,7 +116,6 @@\n /git-rebase--am\n /git-rebase--cherrypick\n /git-rebase--interactive\n-/git-rebase--merge\n /git-receive-pack\n /git-reflog\n /git-relink\ndiff --git a/Makefile b/Makefile\nindex 2d6521e..f73e060 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -475,7 +475,6 @@ 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\n SCRIPT_LIB += git-sh-i18n\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex e8143ae..58aad45 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -81,7 +81,7 @@ rewritten_list=\"$state_dir\"/rewritten-list\n rewritten_pending=\"$state_dir\"/rewritten-pending\n \n strategy_args=\n-if test -n \"$do_merge\"\n+if test -n \"$strategy\"\n then\n \tstrategy_args=${strategy:+--strategy=$strategy}\n \teval '\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\ndeleted file mode 100644\nindex 16d1817..0000000\n--- a/git-rebase--merge.sh\n+++ /dev/null\n@@ -1,151 +0,0 @@\n-#!/bin/sh\n-#\n-# Copyright (c) 2010 Junio C Hamano.\n-#\n-\n-prec=4\n-\n-read_state () {\n-\tonto_name=$(cat \"$state_dir\"/onto_name) &&\n-\tend=$(cat \"$state_dir\"/end) &&\n-\tmsgnum=$(cat \"$state_dir\"/msgnum)\n-}\n-\n-continue_merge () {\n-\ttest -d \"$state_dir\" || die \"$state_dir directory does not exist\"\n-\n-\tunmerged=$(git ls-files -u)\n-\tif test -n \"$unmerged\"\n-\tthen\n-\t\techo \"You still have unmerged paths in your index\"\n-\t\techo \"did you forget to use git add?\"\n-\t\tdie \"$resolvemsg\"\n-\tfi\n-\n-\tcmt=`cat \"$state_dir/current\"`\n-\tif ! git diff-index --quiet --ignore-submodules HEAD --\n-\tthen\n-\t\tif ! git commit --no-verify -C \"$cmt\"\n-\t\tthen\n-\t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n-\t\t\techo \"directly, but instead do one of the following: \"\n-\t\t\tdie \"$resolvemsg\"\n-\t\tfi\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Committed: %0${prec}d \" $msgnum\n-\t\tfi\n-\t\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\telse\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Already applied: %0${prec}d \" $msgnum\n-\t\tfi\n-\tfi\n-\ttest -z \"$GIT_QUIET\" &&\n-\tGIT_PAGER='' git log --format=%s -1 \"$cmt\"\n-\n-\t# onto the next patch:\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-}\n-\n-call_merge () {\n-\tcmt=\"$(cat \"$state_dir/cmt.$1\")\"\n-\techo \"$cmt\" > \"$state_dir/current\"\n-\thd=$(git rev-parse --verify HEAD)\n-\tcmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)\n-\tmsgnum=$(cat \"$state_dir/msgnum\")\n-\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n-\teval GITHEAD_$hd='$onto_name'\n-\texport GITHEAD_$cmt GITHEAD_$hd\n-\tif test -n \"$GIT_QUIET\"\n-\tthen\n-\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n-\tfi\n-\ttest -z \"$strategy\" && strategy=recursive\n-\teval 'git-merge-$strategy' $strategy_opts '\"$cmt^\" -- \"$hd\" \"$cmt\"'\n-\trv=$?\n-\tcase \"$rv\" in\n-\t0)\n-\t\tunset GITHEAD_$cmt GITHEAD_$hd\n-\t\treturn\n-\t\t;;\n-\t1)\n-\t\tgit rerere $allow_rerere_autoupdate\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t2)\n-\t\techo \"Strategy: $strategy failed, try another\" 1>&2\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t*)\n-\t\tdie \"Unknown exit code ($rv) from command:\" \\\n-\t\t\t\"git-merge-$strategy $cmt^ -- HEAD $cmt\"\n-\t\t;;\n-\tesac\n-}\n-\n-finish_rb_merge () {\n-\tmove_to_original_branch\n-\tif test -s \"$state_dir\"/rewritten\n-\tthen\n-\t\tgit notes copy --for-rewrite=rebase <\"$state_dir\"/rewritten\n-\t\tif test -x \"$GIT_DIR\"/hooks/post-rewrite\n-\t\tthen\n-\t\t\t\"$GIT_DIR\"/hooks/post-rewrite rebase <\"$state_dir\"/rewritten\n-\t\tfi\n-\tfi\n-\tsay All done.\n-}\n-\n-case \"$action\" in\n-continue)\n-\tread_state\n-\tcontinue_merge\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-skip)\n-\tread_state\n-\tgit rerere clear\n-\tmsgnum=$(($msgnum + 1))\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-esac\n-\n-mkdir -p \"$state_dir\"\n-echo \"$onto_name\" > \"$state_dir/onto_name\"\n-write_basic_state\n-\n-msgnum=0\n-for cmt in `git rev-list --reverse --no-merges \"$revisions\"`\n-do\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n-done\n-\n-echo 1 >\"$state_dir/msgnum\"\n-echo $msgnum >\"$state_dir/end\"\n-\n-end=$msgnum\n-msgnum=1\n-\n-while test \"$msgnum\" -le \"$end\"\n-do\n-\tcall_merge \"$msgnum\"\n-\tcontinue_merge\n-done\n-\n-finish_rb_merge\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex f0291df..7390c59 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -59,7 +59,6 @@ unset onto\n cmd=\n strategy=\n strategy_opts=\n-do_merge=\n merge_dir=\"$GIT_DIR\"/rebase-merge\n apply_dir=\"$GIT_DIR\"/rebase-apply\n verbose=\n@@ -204,11 +203,8 @@ 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+\t\ttype=cherrypick\n \tfi\n \tstate_dir=\"$merge_dir\"\n fi\n@@ -255,18 +251,15 @@ do\n \t\tautosquash=\n \t\t;;\n \t-M|-m)\n-\t\tdo_merge=t\n \t\t;;\n \t-X)\n \t\tshift\n \t\tstrategy_opts=\"$strategy_opts $(git rev-parse --sq-quote \"--$1\")\"\n-\t\tdo_merge=t\n \t\ttest -z \"$strategy\" && strategy=recursive\n \t\t;;\n \t-s)\n \t\tshift\n \t\tstrategy=\"$1\"\n-\t\tdo_merge=t\n \t\t;;\n \t-n)\n \t\tdiffstat=\n@@ -411,10 +404,6 @@ if test -n \"$interactive_rebase\"\n then\n \ttype=interactive\n \tstate_dir=\"$merge_dir\"\n-elif test -n \"$do_merge\"\n-then\n-\ttype=merge\n-\tstate_dir=\"$merge_dir\"\n elif test -n \"$git_am_opt\"\n then\n \ttype=am\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex 0392e36..730e503 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -17,20 +17,8 @@ test_expect_success 'setup' '\n \tgit tag start\n '\n \n-cat >expect <<\\EOF\n-Already applied: 0001 A\n-Already applied: 0002 B\n-Committed: 0003 Z\n-EOF\n-\n-test_expect_success 'rebase -m' '\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 test_expect_success 'rebase against master twice' '\n+\tgit rebase master &&\n \tgit rebase master >out &&\n \ttest_i18ngrep \"Current branch topic is up to date\" out\n '\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 99b4535..9cd3480 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -70,9 +70,8 @@ test_run_rebase () {\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 'n o e' ''\n-test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -m\n test_run_rebase success 'n o e' -i\n \n test_run_rebase () {\n@@ -87,9 +86,8 @@ test_run_rebase () {\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 n o e' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_run_rebase () {\n@@ -104,9 +102,8 @@ test_run_rebase () {\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 n o e' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -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\" \"\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 3c3e4e8..32170bb 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -158,7 +158,7 @@ test_expect_success 'prompt - interactive rebase' '\n '\n \n test_expect_success 'prompt - rebase merge' '\n-\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n+\tprintf \" (b2|REBASE 1/3)\" > expected &&\n \tgit checkout b2 &&\n \ttest_when_finished \"git checkout master\" &&\n \ttest_must_fail git rebase --merge b1 b2 &&\n-- \n1.8.4-fc\n"},{"id":"226322","messageId":"1377842182-18724-29-git-send-email-felipe.contreras@gmail.com","threadId":"34806","inReplyTo":"1377842182-18724-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 28/28] rebase: cherry-pick: add copyright","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T05:56:22Z","receivedAt":"2013-08-30T05:56:22Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Probably enough changes to warrant that.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-rebase--cherrypick.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase--cherrypick.sh b/git-rebase--cherrypick.sh\nindex bda7cfc..da949aa 100644\n--- a/git-rebase--cherrypick.sh\n+++ b/git-rebase--cherrypick.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n #\n-# Copyright (c) 2010 Junio C Hamano.\n+# Copyright (c) 2013 Felipe Contreras\n #\n \n GIT_CHERRY_PICK_HELP=\"$resolvemsg\"\n-- \n1.8.4-fc\n"}]}