diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-03 15:53:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-03 15:53:37 -0700 |
commit | 831287d37c059d71a20c3c164bc743217114d94e (patch) | |
tree | afe1ac07d7898100ea4bdb3dd9282899596fe609 | |
parent | 12d858aeb45f6eae3eaecb49ccb6f61affca54cd (diff) | |
parent | 4bee958479bed1d3a8f20a75f33422ee49939dbf (diff) | |
download | git-831287d37c059d71a20c3c164bc743217114d94e.tar.gz |
Merge branch 'cw/cherry-pick-allow-empty-message'
"git cherry-pick" by default stops when it sees a commit without any
log message. The "--allow-empty-message" option can be used to
silently proceed.
* cw/cherry-pick-allow-empty-message:
cherry-pick: add --allow-empty-message option
-rw-r--r-- | Documentation/git-cherry-pick.txt | 5 | ||||
-rw-r--r-- | builtin/revert.c | 2 | ||||
-rw-r--r-- | sequencer.c | 3 | ||||
-rw-r--r-- | sequencer.h | 1 | ||||
-rwxr-xr-x | t/t3505-cherry-pick-empty.sh | 5 |
5 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index 0e170a51ca..c205d2363e 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -118,6 +118,11 @@ effect to your index in a row. previous commit are dropped. To force the inclusion of those commits use `--keep-redundant-commits`. +--allow-empty-message:: + By default, cherry-picking a commit with an empty message will fail. + This option overrides that behaviour, allowing commits with empty + messages to be cherry picked. + --keep-redundant-commits:: If a commit being cherry picked duplicates a commit already in the current history, it will become empty. By default these diff --git a/builtin/revert.c b/builtin/revert.c index 82d1bf844b..5652f23844 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -117,6 +117,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts->action == REPLAY_PICK) { @@ -124,6 +125,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN('x', NULL, &opts->record_origin, "append commit name"), OPT_BOOLEAN(0, "ff", &opts->allow_ff, "allow fast-forward"), OPT_BOOLEAN(0, "allow-empty", &opts->allow_empty, "preserve initially empty commits"), + OPT_BOOLEAN(0, "allow-empty-message", &opts->allow_empty_message, "allow commits with empty messages"), OPT_BOOLEAN(0, "keep-redundant-commits", &opts->keep_redundant_commits, "keep redundant, empty commits"), OPT_END(), }; diff --git a/sequencer.c b/sequencer.c index bf078f274b..1ea5293f6e 100644 --- a/sequencer.c +++ b/sequencer.c @@ -311,6 +311,9 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, if (allow_empty) argv_array_push(&array, "--allow-empty"); + if (opts->allow_empty_message) + argv_array_push(&array, "--allow-empty-message"); + rc = run_command_v_opt(array.argv, RUN_GIT_CMD); argv_array_clear(&array); return rc; diff --git a/sequencer.h b/sequencer.h index aa5f17cc30..d8494201e0 100644 --- a/sequencer.h +++ b/sequencer.h @@ -30,6 +30,7 @@ struct replay_opts { int allow_ff; int allow_rerere_auto; int allow_empty; + int allow_empty_message; int keep_redundant_commits; int mainline; diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh index 5a1340cee6..a0c6e30d80 100755 --- a/t/t3505-cherry-pick-empty.sh +++ b/t/t3505-cherry-pick-empty.sh @@ -53,6 +53,11 @@ test_expect_success 'index lockfile was removed' ' ' +test_expect_success 'cherry-pick a commit with an empty message with --allow-empty-message' ' + git checkout -f master && + git cherry-pick --allow-empty-message empty-branch +' + test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' ' git checkout master && echo fourth >>file2 && |