From: Aleen <aleen42@xxxxxxxxxx> Signed-off-by: Aleen <aleen42@xxxxxxxxxx> --- Documentation/git-am.txt | 4 ++-- builtin/am.c | 8 ++++---- t/t4150-am.sh | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index de5d11e404c..6ed844af9c6 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -16,7 +16,7 @@ SYNOPSIS [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet] [--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>] [--quoted-cr=<action>] - [--always] + [--allow-empty] [(<mbox> | <Maildir>)...] 'git am' (--continue | --skip | --abort | --quit | --show-current-patch[=(diff|raw)]) @@ -160,7 +160,7 @@ default. You can use `--no-utf8` to override this. countermand both `commit.gpgSign` configuration variable, and earlier `--gpg-sign`. ---always:: +--allow-empty:: Apply patches of commits with detailed commit messages, even if they emit no changes. (see linkgit:git-format-patch[1]) diff --git a/builtin/am.c b/builtin/am.c index d11efc16f92..a8661098acf 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -124,7 +124,7 @@ struct am_state { int ignore_date; int allow_rerere_autoupdate; const char *sign_commit; - int always; + int allow_empty; int empty_commit; int rebasing; }; @@ -1251,7 +1251,7 @@ static int parse_mail(struct am_state *state, const char *mail) } if (is_empty_or_missing_file(am_path(state, "patch"))) { - if (state->always) { + if (state->allow_empty) { state->empty_commit = 1; } else { printf_ln(_("Patch is empty.")); @@ -2367,8 +2367,8 @@ int cmd_am(int argc, const char **argv, const char *prefix) { OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"), N_("GPG-sign commits"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" }, - OPT_BOOL(0, "always", &state.always, - N_("always apply patch event if the patch is empty")), + OPT_BOOL(0, "allow-empty", &state.allow_empty, + N_("allow to apply patches of empty commits")), OPT_HIDDEN_BOOL(0, "empty-commit", &state.empty_commit, N_("(internal use for skipping git-apply to empty commits)")), OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing, diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 364c61ba198..b47a0fa41e7 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -1158,15 +1158,15 @@ test_expect_success 'apply binary blob in partial clone' ' git -C client am ../patch ' -test_expect_success 'am a real empty patch with the --always option' ' +test_expect_success 'am a real empty patch with the --allow-empty option' ' rm -fr .git/rebase-apply && git reset --hard && - test_must_fail git am --always empty.patch 2>actual && + test_must_fail git am --allow-empty empty.patch 2>actual && echo Patch format detection failed. >expected && test_cmp expected actual ' -test_expect_success 'am a patch of empty commits without the --always option' ' +test_expect_success 'am a patch of empty commits without the --allow-empty option' ' grep "empty commit" empty-commit.patch && rm -fr .git/rebase-apply && git reset --hard && @@ -1176,12 +1176,12 @@ test_expect_success 'am a patch of empty commits without the --always option' ' test_i18ngrep "Patch is empty." err ' -test_expect_success 'am a patch of empty commits with the --always option' ' +test_expect_success 'am a patch of empty commits with the --allow-empty option' ' grep "empty commit" empty-commit.patch && rm -fr .git/rebase-apply && git reset --hard && git checkout empty-commit^ && - git am --always empty-commit.patch && + git am --allow-empty empty-commit.patch && test_path_is_missing .git/rebase-apply && git cat-file commit HEAD >actual && test_i18ngrep "empty commit" actual -- gitgitgadget