diff options
author | Pratik Karki <predatoramigo@gmail.com> | 2018-09-04 15:00:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-11 14:12:45 +0900 |
commit | 9b3a448b4eee25050dc1e1c14c886e27e2985819 (patch) | |
tree | 391be8d9fbe458d45ede4f19f5df2742616ddbee | |
parent | builtin rebase: support `--exec` (diff) | |
download | tgif-9b3a448b4eee25050dc1e1c14c886e27e2985819.tar.xz |
builtin rebase: support `--allow-empty-message` option
This commit introduces the `--allow-empty-message` option to
`builtin/rebase.c`. The motivation behind this option is: if there are
empty messages (which is not allowed in Git by default, but can be
imported from different version control systems), the rebase will fail.
Using `--allow-empty-message` overrides that behaviour which will allow
the commits having empty messages to continue in rebase operation.
Note: a very recent change made this the default in the shell scripted
`git rebase`, therefore the builtin rebase does the same.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/rebase.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index 2c73cc8a61..730aefb7a9 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -94,6 +94,7 @@ struct rebase_options { char *gpg_sign_opt; int autostash; char *cmd; + int allow_empty_message; }; static int is_interactive(struct rebase_options *opts) @@ -348,6 +349,8 @@ static int run_specific_rebase(struct rebase_options *opts) add_var(&script_snippet, "autosquash", opts->autosquash ? "t" : ""); add_var(&script_snippet, "gpg_sign_opt", opts->gpg_sign_opt); add_var(&script_snippet, "cmd", opts->cmd); + add_var(&script_snippet, "allow_empty_message", + opts->allow_empty_message ? "--allow-empty-message" : ""); switch (opts->type) { case REBASE_AM: @@ -598,6 +601,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) .flags = REBASE_NO_QUIET, .git_am_opt = STRBUF_INIT, .allow_rerere_autoupdate = -1, + .allow_empty_message = 1, }; const char *branch_name; int ret, flags, total_argc, in_progress = 0; @@ -698,6 +702,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) OPT_STRING_LIST('x', "exec", &exec, N_("exec"), N_("add exec lines after each commit of the " "editable list")), + OPT_BOOL(0, "allow-empty-message", + &options.allow_empty_message, + N_("allow rebasing commits with empty messages")), OPT_END(), }; |