summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorLibravatar Neil Horman <nhorman@tuxdriver.com>2012-04-11 16:21:53 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-04-11 13:46:08 -0700
commitdf478b744cee9821eb2abbe2202d262b87a34289 (patch)
tree63bbd30c18322c3ebfba2d53dac483a67b3bbb21 /sequencer.c
parentGit 1.7.10 (diff)
downloadtgif-df478b744cee9821eb2abbe2202d262b87a34289.tar.xz
git-cherry-pick: add allow-empty option
git cherry-pick fails when picking a non-ff commit that is empty. The advice given with the failure is that a git-commit --allow-empty should be issued to explicitly add the empty commit during the cherry pick. This option allows a user to specify before hand that they want to keep the empty commit. This eliminates the need to issue both a cherry pick and a commit operation. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index a37846a594..71929ba8cd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -260,8 +260,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
*/
static int run_git_commit(const char *defmsg, struct replay_opts *opts)
{
- /* 6 is max possible length of our args array including NULL */
- const char *args[6];
+ /* 7 is max possible length of our args array including NULL */
+ const char *args[7];
int i = 0;
args[i++] = "commit";
@@ -272,6 +272,9 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts)
args[i++] = "-F";
args[i++] = defmsg;
}
+ if (opts->allow_empty)
+ args[i++] = "--allow-empty";
+
args[i] = NULL;
return run_command_v_opt(args, RUN_GIT_CMD);