From patchwork Fri Nov 12 06:53:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5b6Q5rKb5paHIChBbGVlbik=?= X-Patchwork-Id: 12616199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B500C433F5 for ; Fri, 12 Nov 2021 06:54:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31B0F60F6E for ; Fri, 12 Nov 2021 06:54:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbhKLG47 (ORCPT ); Fri, 12 Nov 2021 01:56:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232346AbhKLG4x (ORCPT ); Fri, 12 Nov 2021 01:56:53 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DD62C061767 for ; Thu, 11 Nov 2021 22:54:03 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id y196so6898729wmc.3 for ; Thu, 11 Nov 2021 22:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=cfbT9ufNRXyCEL7/2xLe33IdbpOB+2TX+jIohA/9SKA=; b=lq3/qGSeMGgE3psQIwEPpaeGGv4hK7RDdxpUburJ/kiEXJ4pgAeckN306CaeQ52ciM xkne0G8GVD19V0Npl1tf9YWGvBrTvtoz6rjuMKhPOnT+b1jbbUzArwrhhkU1QUfk8tZd j4yl+SxTUdFHvoeenX/vSrrGRRMpVf+HrlYnyC+Wf/b6YbFiFf9BgWZPo+YoZiTEbzpL yh1doxdgZrafX0RX9QVeOQpaxp5S/nx/AjTr4JW5DDCQsNDmKvDK3SU1Rkg9GBFo84Sv eVMgXVEQEfsTnnt/nDckbG5ncOKdmFc3lnAtPJirRhvrWmuaJS1N8jhUjgNA3QJRtRVx quJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=cfbT9ufNRXyCEL7/2xLe33IdbpOB+2TX+jIohA/9SKA=; b=W+5xauHKSBmgI4NTjhRNphn68+MfO8voMAV1ZMxeaQmP0knE2ie7nHxQC998djZnaE huvOKaAOZ/NpR63Q4JVVOHodLG1T+QsIdx5d56nX6Wy0rhqAUQ+WQpcqT06M616bDulO 4Zjsdhm7qgs71ddxSl+BE49BEK90KbGmJeea2RnM/2jUeUlJYPT03GUJ2S7TbyM7uLsb djdYkuO8V5HRm2oqkVPYhOfIvt5Y2ExkyyqyAAzRpUMglVP9WMgzOKW1ZgE3/K8vSNpS NWRgIpGFBUE2jA1ZxsBoQDUJqq1yRiFIJdIRbQ05gNob7YIa9ghp3SmVvaGcDvvu37fo MzWA== X-Gm-Message-State: AOAM531WLPgGfzV8x65ADYal5sdeLaRD//SOksHY8CDctPGfW8thYZ5c K8MOMFCPD25oZyRHJUFjoBFZ+KuEBXo= X-Google-Smtp-Source: ABdhPJx9wNnSABblg7kVRrdxRTj87G2D5kJ1CjZ+gvaG2u5+PxJE99R3fmDYcYM9peAX2jf9eUrH4A== X-Received: by 2002:a05:600c:2f17:: with SMTP id r23mr32626880wmn.93.1636700041813; Thu, 11 Nov 2021 22:54:01 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id be3sm707344wmb.1.2021.11.11.22.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 22:54:01 -0800 (PST) Message-Id: <71e6989375c9b8dd00151481e0bb19c991e673f3.1636700040.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 12 Nov 2021 06:53:57 +0000 Subject: [PATCH v2 1/4] doc: git-format-patch: specify the option --always Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?UmVuw6k=?= Scharfe , Aleen , Aleen Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Aleen From: Aleen Signed-off-by: Aleen --- Documentation/git-format-patch.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index 113eabc107c..a9f2bf94182 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -30,6 +30,7 @@ SYNOPSIS [--range-diff= [--creation-factor=]] [--filename-max-length=] [--progress] + [--always] [] [ | ] @@ -388,6 +389,10 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. --progress:: Show progress reports on stderr as patches are generated. +--always:: + Patch commits with detailed commit messages, + even if they emit no changes. (see linkgit:git-diff-tree[1]) + CONFIGURATION ------------- You can specify extra mail header lines to be added to each message, From patchwork Fri Nov 12 06:53:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5b6Q5rKb5paHIChBbGVlbik=?= X-Patchwork-Id: 12616201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC58DC433EF for ; Fri, 12 Nov 2021 06:54:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B97C660FE3 for ; Fri, 12 Nov 2021 06:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232874AbhKLG5A (ORCPT ); Fri, 12 Nov 2021 01:57:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232688AbhKLG4y (ORCPT ); Fri, 12 Nov 2021 01:56:54 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D72C061766 for ; Thu, 11 Nov 2021 22:54:04 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id d3so13797959wrh.8 for ; Thu, 11 Nov 2021 22:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Tlc6JV/TrjB9ixoMdbb5f6Bp7yE84mZMopQIM9ZFbuQ=; b=PgjFVFaMpvFZrRfgHT0yVnOWq2c2kZ94eEiItDqfgC9PVND0jukZkUdlIi7lN9XrTB hAVRYDZfUOcXxMENUaZvgdR3SmfYr74Zka3u61zbi1yXTu1c3HGHgPrg3pq/ExWFlZzz vFZuKz4gYHFZxYKF/GJIAMTNBCmabkzKCWo4ihE5t6s3eeEdk5/3eNUKBYcHjfETrLG6 p4UmlOQY7W2j1xXVVJyzRhb/hnm3rA7D5DwySVGbj4yIBAVG9l0aeCNIC9MyAeXrqqO0 zQEvMr+gKH6JqQ3dEKipxwGUEXBk6iGDAzj1kgeGQlbD2yYLyYvHjb4PMXyCA1I0VBwq UtuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Tlc6JV/TrjB9ixoMdbb5f6Bp7yE84mZMopQIM9ZFbuQ=; b=t1LPJSXFgosteaqVpSfI48BF5qxz99tSqOr+/T1OVbErppJKb+e9ybjFSHm5QZXdEZ 0edD959ImEbSmPMCTxo4EP7J9uue+GvPQU5pgPDmeHlVZKpjmvbbSK+EJaZVFttMNfo4 VitzD/RjOLKxA/MsTPVH4yBobzaUi5UYOkaTH6XKlcWNhmCV+fWitoydEBoay/9gvLyC YjxYJuBs27X3OZLlDF0vlIVA0oUwiGN1bw7MAr0YE6Wvf6ekemECcglV8kN6n3HboXoE wU9Gjl1a/nghyV2kyoIfetx6YR4vHxhXsT6VIdmymMg1ZvcTOryIz8U91dOzAJ5OFJDl 8EnQ== X-Gm-Message-State: AOAM532ZOE3rHF7uHqdbQIYnLX3eqG8EO4qaZRa3t9XckqVt/VYWRAcZ ZUFU4dnQKOJ1EGPapIFj40UbiipNLNI= X-Google-Smtp-Source: ABdhPJwJ/Efgj/hhlfOtZcdhuRClk4A5CgeKGflYuCtb86V/ZcDv9QYnKyHa7mo3WrE2uiy3YjbOTw== X-Received: by 2002:adf:eb81:: with SMTP id t1mr15976271wrn.133.1636700042718; Thu, 11 Nov 2021 22:54:02 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n1sm5363350wmq.6.2021.11.11.22.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 22:54:02 -0800 (PST) Message-Id: <59b1417da3754add11e72692ec11c09e486269e4.1636700040.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 12 Nov 2021 06:53:58 +0000 Subject: [PATCH v2 2/4] am: support --always option to am empty commits Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?UmVuw6k=?= Scharfe , Aleen , Aleen Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Aleen From: Aleen Signed-off-by: Aleen --- Documentation/git-am.txt | 5 +++++ builtin/am.c | 18 ++++++++++++++++-- t/t4150-am.sh | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 0a4a984dfde..de5d11e404c 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -16,6 +16,7 @@ SYNOPSIS [--exclude=] [--include=] [--reject] [-q | --quiet] [--[no-]scissors] [-S[]] [--patch-format=] [--quoted-cr=] + [--always] [( | )...] 'git am' (--continue | --skip | --abort | --quit | --show-current-patch[=(diff|raw)]) @@ -159,6 +160,10 @@ default. You can use `--no-utf8` to override this. countermand both `commit.gpgSign` configuration variable, and earlier `--gpg-sign`. +--always:: + Apply patches of commits with detailed commit messages, + even if they emit no changes. (see linkgit:git-format-patch[1]) + --continue:: -r:: --resolved:: diff --git a/builtin/am.c b/builtin/am.c index 8677ea2348a..d11efc16f92 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -124,6 +124,8 @@ struct am_state { int ignore_date; int allow_rerere_autoupdate; const char *sign_commit; + int always; + int empty_commit; int rebasing; }; @@ -1249,8 +1251,12 @@ static int parse_mail(struct am_state *state, const char *mail) } if (is_empty_or_missing_file(am_path(state, "patch"))) { - printf_ln(_("Patch is empty.")); - die_user_resolve(state); + if (state->always) { + state->empty_commit = 1; + } else { + printf_ln(_("Patch is empty.")); + die_user_resolve(state); + } } strbuf_addstr(&msg, "\n\n"); @@ -1792,6 +1798,9 @@ static void am_run(struct am_state *state, int resume) if (state->interactive && do_interactive(state)) goto next; + if (state->empty_commit) + goto commit; + if (run_applypatch_msg_hook(state)) exit(1); @@ -1827,6 +1836,7 @@ static void am_run(struct am_state *state, int resume) die_user_resolve(state); } +commit: do_commit(state); next: @@ -2357,6 +2367,10 @@ 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_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, N_("(internal use for git-rebase)")), OPT_END() diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 2aaaa0d7ded..5b3617857a8 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -196,6 +196,12 @@ test_expect_success setup ' git format-patch -M --stdout lorem^ >rename-add.patch && + git checkout -b empty-commit && + git commit -m "empty commit" --allow-empty && + + git format-patch --stdout empty-commit^ >empty.patch && + git format-patch --always --stdout empty-commit^ >empty-commit.patch && + # reset time sane_unset test_tick && test_tick @@ -1152,4 +1158,23 @@ 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' ' + rm -fr .git/rebase-apply && + git reset --hard && + test_must_fail git am --always empty.patch 2>actual && + echo Patch format detection failed. >expected && + test_cmp expected actual +' + +test_expect_success 'am a patch with empty commits' ' + grep "empty commit" empty-commit.patch && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout empty-commit^ && + git am --always empty-commit.patch && + test_path_is_missing .git/rebase-apply && + git cat-file commit HEAD >actual && + test_i18ngrep "empty commit" actual +' + test_done From patchwork Fri Nov 12 06:53:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5b6Q5rKb5paHIChBbGVlbik=?= X-Patchwork-Id: 12616203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D54C433F5 for ; Fri, 12 Nov 2021 06:54:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C60EA60FE3 for ; Fri, 12 Nov 2021 06:54:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232897AbhKLG5C (ORCPT ); Fri, 12 Nov 2021 01:57:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232731AbhKLG4z (ORCPT ); Fri, 12 Nov 2021 01:56:55 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3385C061767 for ; Thu, 11 Nov 2021 22:54:04 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso6179769wms.3 for ; Thu, 11 Nov 2021 22:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=OP+4cfNwQy4XWJeio2/6BsZxkX2KWh+xphdHeyg0U+E=; b=buDk/0AxEgiEZ734/BycBP1VSXHUbNZDOzTvBG01N2BSx1pFaUXmBm5laCIkEMjacA VNCr4eCUsG9PAW5cABm7gkq0FznLDwc4k+uERDbBSla5r7ZDvE9mplnxRpTNUTLHDHE6 BRKpXImxrmR2KtOLmNmiQ8NJKAC/DLvL3lylKGWcnf1GDMGmDort9r4k6E/sVQ/+Wnf7 zNu6ueXO/Oz85JqeGEMEddcTjRENkcbZLmonWzc+6sHBF6B3kscmf1xkDvWo8zXhDudQ U6grjGtRGN2JejN6dAKw4tS9arLVNIqvFmoIOhzAJmMJgkX6t+VFbku0XyIgyP/x+puJ RQLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=OP+4cfNwQy4XWJeio2/6BsZxkX2KWh+xphdHeyg0U+E=; b=1tMT+IaWK/Skq5OPBJDwbpvcZLp7GnaitkAhKRUJVRed7vxGf+EVtfvE3TBT22Z9VX IgPAuLUco1OITMyL3qwDNhLVXl3yUvIkvY3Hlp/uIDF/TnCQEUgBm+yF4UUdhUTmjUbr AYeNWBgQQVUfuuGOPsoNkjYm9S2emwwGFHF1NPeeGAPA3whmLAqAKsedN+wfsYewdqwp 9BtwfK4PtdTgwAJ3pbdi2oXmnyCilJqcECcdHx3YgfNim7dg/jodBwsJWfLz4S0Hpacp WLOCeWdCM0oPQjzHnFesRFYh2hNtSgG70UtqKB0EqvKahmIBrDaiDHpDtffCqbdRekfS Uwnw== X-Gm-Message-State: AOAM5325k3BgSrJ5SFmo4QaA3tYsalgFP1slwyX1Ei4bIyamDEjtWSlz p59wZpWOOidOgvjTddmH5BNQvf8m9Mc= X-Google-Smtp-Source: ABdhPJxwH/UOvQweOWUSt8X7LOVF3F5bGyiusRsgyURggGEtgz6YcTS4sLMk4MgbMbLv3HHOPD7z1Q== X-Received: by 2002:a7b:cd90:: with SMTP id y16mr15083330wmj.84.1636700043391; Thu, 11 Nov 2021 22:54:03 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o4sm13545608wmq.31.2021.11.11.22.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 22:54:03 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 12 Nov 2021 06:53:59 +0000 Subject: [PATCH v2 3/4] test: am: add the case when not passing the --always option Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?UmVuw6k=?= Scharfe , Aleen , Aleen Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Aleen From: Aleen Signed-off-by: Aleen --- t/t4150-am.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 5b3617857a8..364c61ba198 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -1166,7 +1166,17 @@ test_expect_success 'am a real empty patch with the --always option' ' test_cmp expected actual ' -test_expect_success 'am a patch with empty commits' ' +test_expect_success 'am a patch of empty commits without the --always option' ' + grep "empty commit" empty-commit.patch && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout empty-commit^ && + test_must_fail git am empty-commit.patch >err && + test_path_is_dir .git/rebase-apply && + test_i18ngrep "Patch is empty." err +' + +test_expect_success 'am a patch of empty commits with the --always option' ' grep "empty commit" empty-commit.patch && rm -fr .git/rebase-apply && git reset --hard && From patchwork Fri Nov 12 06:54:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5b6Q5rKb5paHIChBbGVlbik=?= X-Patchwork-Id: 12616205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9584C433F5 for ; Fri, 12 Nov 2021 06:54:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 855F560FE3 for ; Fri, 12 Nov 2021 06:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232879AbhKLG5E (ORCPT ); Fri, 12 Nov 2021 01:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232791AbhKLG44 (ORCPT ); Fri, 12 Nov 2021 01:56:56 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEBBAC0613F5 for ; Thu, 11 Nov 2021 22:54:05 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id y84-20020a1c7d57000000b00330cb84834fso9089286wmc.2 for ; Thu, 11 Nov 2021 22:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=foRYNwh7qj6kg7jEHazvILh2AmScyat3xJCorUxOhsY=; b=ZJ2nZSFnKWQQUr+VhwxFUt9PJnbNaf3SRHdA6kEoBHHxdwWVUZ7mfPgEvpFiG1pdTu +tinHeWtwqmuWswsv9o6FtvE3/EBpkQr7eETzBmVaERidkdJthE1W3KsJumnwDMfmCRm zPuBS2P2uBn4THJXqm/pQOpliaNGPgl4BU2eCKh5IPmnXUltKD70y7sgFHXD1YYOzOtd t/559crbapw0aNZNNz9M9sqxN8gs4sEyJDafo7z7pYAqKpya5K2/48QwLh/25oEqc3Ah EV7HZeTaEauAIv3J260AmP3zsR1CjEI3ZWzEz52Ot5LFtM74eeCgMQX1dQGLBbSonzFJ 6QGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=foRYNwh7qj6kg7jEHazvILh2AmScyat3xJCorUxOhsY=; b=4OPJ5IQMwNg3Tse9OlCRqq2DPE5nbiM8tCwU44CWgjdnjMsG/HljHw4nXv7ZpxPxGE LIVjNW8jFb1KWSSH0GGJeMkHvFP7jRgCCtkxo2fKSu2C6hooeZbFnYblwNOeGHbAnulZ hMa1FA5jdLiOL+WJqDBs7UrQsLIVsaeRNbemxYRoDNCM1A+Qt1IOhgySr5m6FMEPX9pN NnXdwhZYDV/XZW9UkHyuR+RoqqluDGFVaDbh/PUUrDb+n2WbNb8fC5M89aaP179Bz9/l 9vNA9JZnt2G7+a/XcHwPdksDj52cF0oD/k0eJPPFz5qxdj5rt2HH4prdFZW60pT9jO3e wniQ== X-Gm-Message-State: AOAM532MBpttmX8zouy0c80Sqal/bCxo6JEuI+jRk5z4R1CAvuPQbQba 2BLJtmXG20ytf9Lz+lXQA7eGvF5/IAs= X-Google-Smtp-Source: ABdhPJweYeqvRNlmVbOy4oRJl96tQ/pAYx+iqrJs6gj3NqYEtpNs0qPkY2a5XsPrtbsgiBF9WAdv+g== X-Received: by 2002:a7b:c005:: with SMTP id c5mr14410165wmb.150.1636700044138; Thu, 11 Nov 2021 22:54:04 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s13sm11374482wmc.47.2021.11.11.22.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 22:54:03 -0800 (PST) Message-Id: <45e9720f40bbf71ceea72ac464e3343f9b47a04f.1636700040.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 12 Nov 2021 06:54:00 +0000 Subject: [PATCH v2 4/4] chore: am: rename the --always option to --allow-empty Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?UmVuw6k=?= Scharfe , Aleen , Aleen Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Aleen From: Aleen Signed-off-by: Aleen --- 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=] [--include=] [--reject] [-q | --quiet] [--[no-]scissors] [-S[]] [--patch-format=] [--quoted-cr=] - [--always] + [--allow-empty] [( | )...] '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