{"thread":{"id":"36487","subject":"[PATCH v7 00/12] Improvements to cherry-pick","startedAt":"2014-04-24T02:44:39Z","lastAt":"2014-04-24T23:37:44Z","messageCount":23,"participants":["Felipe Contreras","Eric Sunshine","Ramkumar Ramachandra"],"isPatch":true,"patchVersion":7,"patchTotal":12},"messages":[{"id":"239513","messageId":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":null,"subject":"[PATCH v7 00/12] Improvements to cherry-pick","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:39Z","receivedAt":"2014-04-24T02:44:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nIn the process of revamping 'git rebase' I found many areas of improvments in\n`git cherry-pick`, here are the patches to improve the situation.\n\nThese were prettuch sent before already, but this time I dropped the second\npart of the series to improve 'git rebase'.\n\n\nFelipe Contreras (12):\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  cherry-pick: remember rerere-autoupdate\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\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                            |   2 +\n builtin/commit.c                    |  46 ++------------\n builtin/revert.c                    |  11 ++++\n git-rebase--interactive.sh          |   4 +-\n rewrite.c                           | 121 ++++++++++++++++++++++++++++++++++++\n rewrite.h                           |  20 ++++++\n sequencer.c                         | 105 ++++++++++++++++++++++++++++---\n sequencer.h                         |   8 ++-\n t/t3504-cherry-pick-rerere.sh       |  39 ++++++++++++\n t/t3508-cherry-pick-many-commits.sh |  13 ++++\n t/t3510-cherry-pick-sequence.sh     |  14 ++++-\n t/t3512-revert-cherry-notes.sh      |  18 ++++++\n t/t5407-post-rewrite-hook.sh        |  16 +++++\n 18 files changed, 392 insertions(+), 62 deletions(-)\n create mode 100644 rewrite.c\n create mode 100644 rewrite.h\n create mode 100755 t/t3512-revert-cherry-notes.sh\n\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239514","messageId":"1398307491-21314-2-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 01/12] cherry-pick: don't barf when there's nothing to do","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:40Z","receivedAt":"2014-04-24T02:44:40Z","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 90cac7b..c94942a 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -662,7 +662,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.9.2+fc1.2.gfbaae8c\n"},{"id":"239516","messageId":"1398307491-21314-3-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 02/12] cherry-pick: add --skip-empty option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:41Z","receivedAt":"2014-04-24T02:44:41Z","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                    |  2 ++\n sequencer.c                         |  6 ++++++\n sequencer.h                         |  1 +\n t/t3508-cherry-pick-many-commits.sh | 13 +++++++++++++\n 5 files changed, 25 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 87659c9..9946ecd 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -95,6 +95,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@@ -104,6 +105,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\tOPT_BOOL(0, \"allow-empty\", &opts->allow_empty, N_(\"preserve initially empty commits\")),\n \t\t\tOPT_BOOL(0, \"allow-empty-message\", &opts->allow_empty_message, N_(\"allow commits with empty messages\")),\n \t\t\tOPT_BOOL(0, \"keep-redundant-commits\", &opts->keep_redundant_commits, N_(\"keep redundant, empty commits\")),\n+\t\t\tOPT_BOOL(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))\ndiff --git a/sequencer.c b/sequencer.c\nindex c94942a..951f51d 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -634,6 +634,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..0cdf07e 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.9.2+fc1.2.gfbaae8c\n"},{"id":"239524","messageId":"1398307491-21314-4-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 03/12] revert/cherry-pick: add --quiet option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:42Z","receivedAt":"2014-04-24T02:44:42Z","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 2de67a5..2b51136 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 9946ecd..c8149ca 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -77,6 +77,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tconst char *me = action_name(opts);\n \tint cmd = 0;\n \tstruct option options[] = {\n+\t\tOPT__QUIET(&opts->quiet, N_(\"suppress progress reporting\")),\n \t\tOPT_CMDMODE(0, \"quit\", &cmd, N_(\"end revert or cherry-pick sequence\"), 'q'),\n \t\tOPT_CMDMODE(0, \"continue\", &cmd, N_(\"resume revert or cherry-pick sequence\"), 'c'),\n \t\tOPT_CMDMODE(0, \"abort\", &cmd, N_(\"cancel revert or cherry-pick sequence\"), 'a'),\ndiff --git a/sequencer.c b/sequencer.c\nindex 951f51d..e8239ac 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -396,6 +396,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@@ -635,9 +637,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@@ -667,7 +670,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.9.2+fc1.2.gfbaae8c\n"},{"id":"239515","messageId":"1398307491-21314-5-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 04/12] revert/cherry-pick: add --skip option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:43Z","receivedAt":"2014-04-24T02:44:43Z","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 2b51136..14bd299 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 c8149ca..54fba63 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -76,11 +76,13 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tconst char * const * usage_str = revert_or_cherry_pick_usage(opts);\n \tconst char *me = action_name(opts);\n \tint cmd = 0;\n+\n \tstruct option options[] = {\n \t\tOPT__QUIET(&opts->quiet, N_(\"suppress progress reporting\")),\n \t\tOPT_CMDMODE(0, \"quit\", &cmd, N_(\"end revert or cherry-pick sequence\"), 'q'),\n \t\tOPT_CMDMODE(0, \"continue\", &cmd, N_(\"resume revert or cherry-pick sequence\"), 'c'),\n \t\tOPT_CMDMODE(0, \"abort\", &cmd, N_(\"cancel revert or cherry-pick sequence\"), 'a'),\n+\t\tOPT_CMDMODE(0, \"skip\", &cmd, N_(\"skip current commit in the sequence\"), 's'),\n \t\tOPT_BOOL('n', \"no-commit\", &opts->no_commit, N_(\"don't automatically commit\")),\n \t\tOPT_BOOL('e', \"edit\", &opts->edit, N_(\"edit the commit message\")),\n \t\tOPT_NOOP_NOARG('r', NULL),\n@@ -128,6 +130,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\topts->subcommand = REPLAY_CONTINUE;\n \telse if (cmd == 'a')\n \t\topts->subcommand = REPLAY_ROLLBACK;\n+\telse if (cmd == 's')\n+\t\topts->subcommand = REPLAY_SKIP;\n \telse\n \t\topts->subcommand = REPLAY_NONE;\n \n@@ -138,6 +142,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 e8239ac..c01ad08 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1057,6 +1057,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@@ -1087,6 +1109,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.9.2+fc1.2.gfbaae8c\n"},{"id":"239517","messageId":"1398307491-21314-6-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 05/12] cherry-pick: remember rerere-autoupdate","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:44Z","receivedAt":"2014-04-24T02:44:44Z","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                   | 10 +++++++++-\n t/t3504-cherry-pick-rerere.sh | 39 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 48 insertions(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex c01ad08..a258627 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -820,7 +820,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.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 \tif (!error_flag)\n@@ -997,6 +999,12 @@ 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->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)\ndiff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh\nindex e6a6481..274b2cc 100755\n--- a/t/t3504-cherry-pick-rerere.sh\n+++ b/t/t3504-cherry-pick-rerere.sh\n@@ -42,4 +42,43 @@ test_expect_success 'cherry-pick conflict without rerere' '\n \ttest_must_fail test_cmp expect foo\n '\n \n+test_expect_success 'cherry-pick --rerere-autoupdate' '\n+\ttest_when_finished \"rm -rf rerere\" &&\n+\t(\n+\tgit init rerere &&\n+\tcd rerere &&\n+\ttest_config rerere.enabled true &&\n+\techo one > content-a && git add content-a &&\n+\techo one > content-b && git add content-b &&\n+\tgit commit -m one &&\n+\tgit checkout -b conflict master &&\n+\techo conflict-a > content-a &&\n+\tgit commit -a -m conflict-a &&\n+\techo conflict-b > content-b &&\n+\tgit commit -a -m conflict-b &&\n+\tgit checkout master &&\n+\techo two > content-a &&\n+\techo two > content-b &&\n+\tgit commit -a -m two &&\n+\tgit checkout -b test &&\n+\ttest_must_fail git cherry-pick master..conflict &&\n+\techo resolved-a > content-a &&\n+\tgit add content-a &&\n+\ttest_must_fail git cherry-pick --continue &&\n+\techo resolved-b > content-b &&\n+\tgit add content-b &&\n+\tgit cherry-pick --continue &&\n+\tgit reset --hard master\n+\tgit log --oneline --all --decorate --graph &&\n+\ttest_must_fail git cherry-pick --rerere-autoupdate master..conflict &&\n+\tgit log --oneline --all --decorate --graph &&\n+\techo resolved-a > expected &&\n+\ttest_cmp expected content-a\n+\ttest_must_fail git cherry-pick --continue &&\n+\techo resolved-b > expected &&\n+\ttest_cmp expected content-b &&\n+\tgit cherry-pick --continue\n+\t)\n+'\n+\n test_done\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239519","messageId":"1398307491-21314-7-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 06/12] builtin: add rewrite helper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:45Z","receivedAt":"2014-04-24T02:44:45Z","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 33aa15b..d315b71 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -710,6 +710,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@@ -855,6 +856,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..436d54a\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 + 1, 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.9.2+fc1.2.gfbaae8c\n"},{"id":"239525","messageId":"1398307491-21314-8-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 07/12] cherry-pick: store rewritten commits","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:46Z","receivedAt":"2014-04-24T02:44:46Z","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 a258627..426fddd 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@@ -651,6 +653,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@@ -1021,8 +1031,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@@ -1051,6 +1064,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@@ -1061,6 +1076,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.9.2+fc1.2.gfbaae8c\n"},{"id":"239518","messageId":"1398307491-21314-9-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 08/12] cherry-pick: don't store skipped commit","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:47Z","receivedAt":"2014-04-24T02:44:47Z","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 426fddd..fc0dd04 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1056,7 +1056,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@@ -1076,7 +1076,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@@ -1104,7 +1104,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@@ -1136,7 +1136,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.9.2+fc1.2.gfbaae8c\n"},{"id":"239521","messageId":"1398307491-21314-10-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 09/12] builtin: move run_rewrite_hook() to rewrite.c","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:48Z","receivedAt":"2014-04-24T02:44:48Z","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 7d711ea..ea42f22 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -31,6 +31,7 @@\n #include \"sequencer.h\"\n #include \"notes-utils.h\"\n #include \"mailmap.h\"\n+#include \"rewrite.h\"\n \n static const char * const builtin_commit_usage[] = {\n \tN_(\"git commit [options] [--] <pathspec>...\"),\n@@ -1411,38 +1412,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 run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...)\n {\n \tconst char *hook_env[3] =  { NULL };\n@@ -1693,13 +1662,16 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \trun_commit_hook(use_editor, 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 436d54a..56617ce 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.9.2+fc1.2.gfbaae8c\n"},{"id":"239520","messageId":"1398307491-21314-11-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 10/12] builtin: rewrite: add copy_rewrite_notes()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:49Z","receivedAt":"2014-04-24T02:44:49Z","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 ea42f22..b5287d6 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1661,16 +1661,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \trerere(0);\n \trun_commit_hook(use_editor, 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 56617ce..59b8be7 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.9.2+fc1.2.gfbaae8c\n"},{"id":"239522","messageId":"1398307491-21314-12-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 11/12] cherry-pick: add --action-name option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:50Z","receivedAt":"2014-04-24T02:44:50Z","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 sequencer.c      | 4 ++++\n sequencer.h      | 2 ++\n 3 files changed, 8 insertions(+)\n\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 54fba63..a24b689 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -99,6 +99,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@@ -109,6 +110,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\t\tOPT_BOOL(0, \"allow-empty-message\", &opts->allow_empty_message, N_(\"allow commits with empty messages\")),\n \t\t\tOPT_BOOL(0, \"keep-redundant-commits\", &opts->keep_redundant_commits, N_(\"keep redundant, empty commits\")),\n \t\t\tOPT_BOOL(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/sequencer.c b/sequencer.c\nindex fc0dd04..ed59d75 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -832,6 +832,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.allow-rerere-auto\"))\n \t\topts->allow_rerere_auto = git_config_int(key, value);\n+\telse 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@@ -1015,6 +1017,8 @@ static void save_opts(struct replay_opts *opts)\n \t\tgit_config_set_in_file(opts_file, \"options.allow-rerere-auto\", buf.buf);\n \t\tstrbuf_release(&buf);\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.9.2+fc1.2.gfbaae8c\n"},{"id":"239523","messageId":"1398307491-21314-13-git-send-email-felipe.contreras@gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v7 12/12] cherry-pick: copy notes and run hooks","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T02:44:51Z","receivedAt":"2014-04-24T02:44:51Z","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 git-rebase--interactive.sh     |  4 ++--\n sequencer.c                    | 28 +++++++++++++++++++++++++++-\n t/t3512-revert-cherry-notes.sh | 18 ++++++++++++++++++\n t/t5407-post-rewrite-hook.sh   | 16 ++++++++++++++++\n 6 files changed, 71 insertions(+), 12 deletions(-)\n create mode 100755 t/t3512-revert-cherry-notes.sh\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c26a7c8..c328d33 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1752,11 +1752,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 d954bf6..2402e7d 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/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 43631b4..fd085e1 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -248,7 +248,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@@ -359,7 +359,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 ed59d75..2eb6ce8 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -22,6 +22,25 @@ 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+\tstruct strbuf msg = STRBUF_INIT;\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+\tstrbuf_addf(&msg, \"Notes added by 'git %s'\", name);\n+\tcopy_rewrite_notes(&rewritten, name, msg.buf);\n+\trun_rewrite_hook(&rewritten, name);\n+\tstrbuf_release(&msg);\n+}\n+\n static int is_rfc2822_line(const char *buf, int len)\n {\n \tint i;\n@@ -1042,6 +1061,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@@ -1113,8 +1134,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)\ndiff --git a/t/t3512-revert-cherry-notes.sh b/t/t3512-revert-cherry-notes.sh\nnew file mode 100755\nindex 0000000..9e9e611\n--- /dev/null\n+++ b/t/t3512-revert-cherry-notes.sh\n@@ -0,0 +1,18 @@\n+#!/bin/sh\n+\n+test_description='test cherry-pick and revert notes'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'notes are rewritten' '\n+\ttest_config notes.rewrite.cherry-pick true &&\n+\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n+\ttest_commit n1 &&\n+\ttest_commit n2 &&\n+\tgit notes add -m \"a note\" n2 &&\n+\tgit checkout n1 &&\n+\tgit cherry-pick n2 &&\n+\tgit notes show HEAD\n+'\n+\n+test_done\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex ea2e0d4..53d7ade 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -53,6 +53,22 @@ test_expect_success 'git commit --amend --no-post-rewrite' '\n \ttest ! -f post-rewrite.data\n '\n \n+test_expect_success 'git cherry-pick' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\tgit checkout A &&\n+\ttest_must_fail git cherry-pick B..D &&\n+\techo C > foo &&\n+\tgit add foo &&\n+\tgit cherry-pick --continue &&\n+\techo cherry-pick >expected.args &&\n+\tcat >expected.data <<EOF &&\n+$(git rev-parse C) $(git rev-parse HEAD^)\n+$(git rev-parse D) $(git rev-parse HEAD)\n+EOF\n+\tverify_hook_input\n+'\n+\n test_expect_success 'git rebase' '\n \tgit reset --hard D &&\n \tclear_hook_input &&\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239543","messageId":"CAPig+cSYsfsg8+2FruQqwVanDHmfQKgCi1NkXhpduJhVD1o6PQ@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-6-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 05/12] cherry-pick: remember rerere-autoupdate","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-04-24T08:21:32Z","receivedAt":"2014-04-24T08:21:32Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Apr 23, 2014 at 10:44 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n> diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh\n> index e6a6481..274b2cc 100755\n> --- a/t/t3504-cherry-pick-rerere.sh\n> +++ b/t/t3504-cherry-pick-rerere.sh\n> @@ -42,4 +42,43 @@ test_expect_success 'cherry-pick conflict without rerere' '\n>         test_must_fail test_cmp expect foo\n>  '\n>\n> +test_expect_success 'cherry-pick --rerere-autoupdate' '\n> +       test_when_finished \"rm -rf rerere\" &&\n> +       (\n> +       git init rerere &&\n> +       cd rerere &&\n> +       test_config rerere.enabled true &&\n> +       echo one > content-a && git add content-a &&\n> +       echo one > content-b && git add content-b &&\n> +       git commit -m one &&\n> +       git checkout -b conflict master &&\n> +       echo conflict-a > content-a &&\n> +       git commit -a -m conflict-a &&\n> +       echo conflict-b > content-b &&\n> +       git commit -a -m conflict-b &&\n> +       git checkout master &&\n> +       echo two > content-a &&\n> +       echo two > content-b &&\n> +       git commit -a -m two &&\n> +       git checkout -b test &&\n> +       test_must_fail git cherry-pick master..conflict &&\n> +       echo resolved-a > content-a &&\n> +       git add content-a &&\n> +       test_must_fail git cherry-pick --continue &&\n> +       echo resolved-b > content-b &&\n> +       git add content-b &&\n> +       git cherry-pick --continue &&\n> +       git reset --hard master\n\nBroken &&-chain.\n\n> +       git log --oneline --all --decorate --graph &&\n> +       test_must_fail git cherry-pick --rerere-autoupdate master..conflict &&\n> +       git log --oneline --all --decorate --graph &&\n> +       echo resolved-a > expected &&\n> +       test_cmp expected content-a\n\nDitto.\n\n> +       test_must_fail git cherry-pick --continue &&\n> +       echo resolved-b > expected &&\n> +       test_cmp expected content-b &&\n> +       git cherry-pick --continue\n> +       )\n> +'\n> +\n>  test_done\n> --\n> 1.9.2+fc1.2.gfbaae8c\n"},{"id":"239615","messageId":"CALkWK0nETYdWpTYrNGE+au-b=jAXKy3FX6YOGo5s=v_UbnYtPA@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-4-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 03/12] revert/cherry-pick: add --quiet option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-04-24T22:48:55Z","receivedAt":"2014-04-24T22:48:55Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> @@ -635,9 +637,10 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n>         }\n>\n>         if (opts->skip_empty && is_index_unchanged() == 1) {\n> -               warning(_(\"skipping %s... %s\"),\n> -                       find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n> -                       msg.subject);\n> +               if (!opts->quiet)\n> +                       warning(_(\"skipping %s... %s\"),\n> +                               find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n> +                               msg.subject);\n\nPersonally, I don't see much value in inventing a new option for\nsuppressing one message.\n"},{"id":"239616","messageId":"CALkWK0krxvsGY=n4rXfo3SsHPpimqh4LMjxCjsy=YcNQ5b_p9Q@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-5-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 04/12] revert/cherry-pick: add --skip option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-04-24T22:50:38Z","receivedAt":"2014-04-24T22:50:38Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> Akin to 'am --skip' and 'rebase --skip'.\n\nI don't recall why my original sequencer series didn't include this\noption. Perhaps Jonathan remembers?\n"},{"id":"239617","messageId":"CALkWK0nqd3_-1BvUTbS+K=6PRgJON7sdEHE0EJcADLhDb73nqw@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-7-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 06/12] builtin: add rewrite helper","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-04-24T22:57:12Z","receivedAt":"2014-04-24T22:57:12Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> So that we can load and store rewrites, as well as other operations on a\n> list of rewritten commits.\n\nPlease elaborate. Explain why this code shouldn't go in sequencer.c.\n"},{"id":"239618","messageId":"CALkWK0k3OTsvaqxrpJzhGNwSHg8tZ2tuhiO8Rd-AsHLp6WOL9A@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-13-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 12/12] cherry-pick: copy notes and run hooks","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-04-24T23:04:34Z","receivedAt":"2014-04-24T23:04:34Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> If no action-name is specified, nothing is done.\n\nWhy? Is it because git-rebase implements its own notes-copy-on-rewrite logic?\n\nOtherwise, I agree with the goal of making notes.rewrite.<command>\nwork for cherry-pick.\n"},{"id":"239619","messageId":"CALkWK0=AywuFd1xaO3iXudhmnN1Sx2RDvhzmxLBjdaYD4OUB8w@mail.gmail.com","threadId":"36487","inReplyTo":"1398307491-21314-13-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v7 12/12] cherry-pick: copy notes and run hooks","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-04-24T23:06:01Z","receivedAt":"2014-04-24T23:06:01Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Felipe Contreras wrote:\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 43631b4..fd085e1 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -248,7 +248,7 @@ pick_one () {\n>\n>         test -d \"$rewritten\" &&\n>                 pick_one_preserving_merges \"$@\" && return\n> -       output eval git cherry-pick \"$strategy_args\" $empty_args $ff \"$@\"\n> +       output eval git cherry-pick \"--action-name ''\" \"$strategy_args\" $empty_args $ff \"$@\"\n\nPassing an empty action-name looks quite ugly. Is there a better way\nto achieve this?\n"},{"id":"239622","messageId":"53599f34e416f_523614ed2ec21@nysa.notmuch","threadId":"36487","inReplyTo":"CALkWK0nETYdWpTYrNGE+au-b=jAXKy3FX6YOGo5s=v_UbnYtPA@mail.gmail.com","subject":"Re: [PATCH v7 03/12] revert/cherry-pick: add --quiet option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T23:33:08Z","receivedAt":"2014-04-24T23:33:08Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Ramkumar Ramachandra wrote:\n> Felipe Contreras wrote:\n> > @@ -635,9 +637,10 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n> >         }\n> >\n> >         if (opts->skip_empty && is_index_unchanged() == 1) {\n> > -               warning(_(\"skipping %s... %s\"),\n> > -                       find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n> > -                       msg.subject);\n> > +               if (!opts->quiet)\n> > +                       warning(_(\"skipping %s... %s\"),\n> > +                               find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),\n> > +                               msg.subject);\n> \n> Personally, I don't see much value in inventing a new option for\n> suppressing one message.\n\nIt's not one message; it's two messages from cherry-pick itself, and all the\nmessages from `git commit`. Didn't we alread discuss this?\n\n-- \nFelipe Contreras\n"},{"id":"239621","messageId":"53599f6e32146_523614ed2ec8e@nysa.notmuch","threadId":"36487","inReplyTo":"CALkWK0nqd3_-1BvUTbS+K=6PRgJON7sdEHE0EJcADLhDb73nqw@mail.gmail.com","subject":"Re: [PATCH v7 06/12] builtin: add rewrite helper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T23:34:06Z","receivedAt":"2014-04-24T23:34:06Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Ramkumar Ramachandra wrote:\n> Felipe Contreras wrote:\n> > So that we can load and store rewrites, as well as other operations on a\n> > list of rewritten commits.\n> \n> Please elaborate. Explain why this code shouldn't go in sequencer.c.\n\nIsn't it obvious? Because sequencer.c wouldn't be the only user.\n\n-- \nFelipe Contreras\n"},{"id":"239623","messageId":"53599fb99b418_523614ed2ec3d@nysa.notmuch","threadId":"36487","inReplyTo":"CALkWK0k3OTsvaqxrpJzhGNwSHg8tZ2tuhiO8Rd-AsHLp6WOL9A@mail.gmail.com","subject":"Re: [PATCH v7 12/12] cherry-pick: copy notes and run hooks","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T23:35:21Z","receivedAt":"2014-04-24T23:35:21Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Ramkumar Ramachandra wrote:\n> Felipe Contreras wrote:\n> > If no action-name is specified, nothing is done.\n> \n> Why? Is it because git-rebase implements its own notes-copy-on-rewrite logic?\n\nYes, and `git rebase` uses `git cherry-pick`.\n\n-- \nFelipe Contreras\n"},{"id":"239624","messageId":"5359a048691f5_523614ed2ecd3@nysa.notmuch","threadId":"36487","inReplyTo":"CALkWK0=AywuFd1xaO3iXudhmnN1Sx2RDvhzmxLBjdaYD4OUB8w@mail.gmail.com","subject":"Re: [PATCH v7 12/12] cherry-pick: copy notes and run hooks","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-24T23:37:44Z","receivedAt":"2014-04-24T23:37:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Ramkumar Ramachandra wrote:\n> Felipe Contreras wrote:\n> > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> > index 43631b4..fd085e1 100644\n> > --- a/git-rebase--interactive.sh\n> > +++ b/git-rebase--interactive.sh\n> > @@ -248,7 +248,7 @@ pick_one () {\n> >\n> >         test -d \"$rewritten\" &&\n> >                 pick_one_preserving_merges \"$@\" && return\n> > -       output eval git cherry-pick \"$strategy_args\" $empty_args $ff \"$@\"\n> > +       output eval git cherry-pick \"--action-name ''\" \"$strategy_args\" $empty_args $ff \"$@\"\n> \n> Passing an empty action-name looks quite ugly. Is there a better way\n> to achieve this?\n\nI want `git cherry-pick` to be able to do two things:\n\n1) Omit the whole notes and hooks code\n2) Specify a name other than \"cherry-pick\" to use for those\n\nThe --action-name argument achieves both.\n\n-- \nFelipe Contreras\n"}]}