diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-12-22 22:48:11 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-12-22 22:48:11 -0800 |
| commit | 62a3a27b915c5f2a70796af15678cce1079d200a (patch) | |
| tree | 001177f82a93de8fa831e7134c4ddcfbeb030a24 /apply.c | |
| parent | 553641555140a5aa4bab542246a401ea174364b7 (diff) | |
| parent | 324eb77ee76277be99bdc54ef0b74ff30f5f567b (diff) | |
| download | git-62a3a27b915c5f2a70796af15678cce1079d200a.tar.gz | |
Merge branch 'jz/apply-quiet-and-allow-empty'
"git apply" has been taught to ignore a message without a patch
with the "--allow-empty" option. It also learned to honor the
"--quiet" option given from the command line.
* jz/apply-quiet-and-allow-empty:
git-apply: add --allow-empty flag
git-apply: add --quiet flag
Diffstat (limited to 'apply.c')
| -rw-r--r-- | apply.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4752,8 +4752,10 @@ static int apply_patch(struct apply_state *state, } if (!list && !skipped_patch) { - error(_("unrecognized input")); - res = -128; + if (!state->allow_empty) { + error(_("No valid patches in input (allow with \"--allow-empty\")")); + res = -128; + } goto end; } @@ -5071,7 +5073,7 @@ int apply_parse_options(int argc, const char **argv, N_("leave the rejected hunks in corresponding *.rej files")), OPT_BOOL(0, "allow-overlap", &state->allow_overlap, N_("allow overlapping hunks")), - OPT__VERBOSE(&state->apply_verbosity, N_("be verbose")), + OPT__VERBOSITY(&state->apply_verbosity), OPT_BIT(0, "inaccurate-eof", options, N_("tolerate incorrectly detected missing new-line at the end of file"), APPLY_OPT_INACCURATE_EOF), @@ -5081,6 +5083,8 @@ int apply_parse_options(int argc, const char **argv, OPT_CALLBACK(0, "directory", state, N_("root"), N_("prepend <root> to all filenames"), apply_option_parse_directory), + OPT_BOOL(0, "allow-empty", &state->allow_empty, + N_("don't return error for empty patches")), OPT_END() }; |
