From patchwork Wed Apr 17 03:32:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13632844 Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 187FD3B290 for ; Wed, 17 Apr 2024 03:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324774; cv=none; b=kD+jPPqAUxb6yEutYdsf7mUyOwMNKts9FvuoZ/LhcTJ3iHiEfoLetAbnxP6I5EriIggvXqlM3oQn4NBrkBVHrYxooIMp5YylZNeSEIZWEA/FPZq7zx9GDoIdd4UBCKy2NYAhx3RLAP3NiQYw6+6ZOtnSYXs8AsrWkcuLKFlxlfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324774; c=relaxed/simple; bh=Xdtsv0dzjNtePWXVcfvl0JSzgg7TJc3PM0ecZSAZDG0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aXElE6L4DZu0rx/nzXv8TiZOAG3eOU7CKFMp3wSfK9XlAApN42p6GNKCHjzCGcdb+K6rtXCcmbSW3640oGcfuRRwm9iRWtP1Hx8p3rpFChgfOtFKMZKTFV/yuN2niSOdyVV1iisE6HtZK0yOXN3MydwL9M1f0zqI2SPx8fToO+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=RWB3McLj; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="RWB3McLj" From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1713324769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0M6dx4A25saI7CR8lTlaEgybcMSJRsrL/eWIPcfs0L0=; b=RWB3McLjWUmO+ODx7TmpMSqZmlz34kL6dGL1jI11db1D6xuzVgNPvIitXoa623zIzGCFOT XPInJGmgLk17MPcXmpP7+WT8fBLdzTPmpGso0E3VXInjfEcqANXczcFOPmoYfHDHNUd1wk 2Ez5gOlLtzfmR+1dXAtRPf7QvnhFcUpGr4Jvwh1VOvpWwit5xef5qcA9dVmPKDBKrfRfEf 7U/pxiQz0v325OvqLIwAtc3qYaMG43qJu5WGZB1S14f9icEJzIJwFD9BTil8SfnmbPzrpS jgIQSCUh1WlaA2S+L34MLzVbmaWM4IIzCQHv9qHwO2mbMKu5E+4olBD+MoDqoA== To: git@vger.kernel.org Subject: [PATCH 1/4] format-patch docs: avoid use of parentheses to improve readability Date: Wed, 17 Apr 2024 05:32:41 +0200 Message-Id: <25b90d065744c01da3f37b6966fd97d699931f6b.1713324598.git.dsimic@manjaro.org> In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org In general, using the parentheses disrupts the flow and reduces readability, so they should be avoided whenever possible. The improved sentence is a clear example, in which the adjustment is obvious and simple. Signed-off-by: Dragan Simic --- Documentation/git-format-patch.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index 728bb3821c17..a5019ab46926 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -239,8 +239,8 @@ the patches (with a value of e.g. "PATCH my-project"). variable, or 64 if unconfigured. --rfc:: - Prepends "RFC" to the subject prefix (producing "RFC PATCH" by - default). RFC means "Request For Comments"; use this when sending + Prepends "RFC" to the subject prefix, producing "RFC PATCH" by + default. RFC means "Request For Comments"; use this when sending an experimental patch for discussion rather than application. -v :: From patchwork Wed Apr 17 03:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13632845 Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58785D2F5 for ; Wed, 17 Apr 2024 03:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; cv=none; b=KXOcJNbl+krH/PZY6vr57agCab+if73/TigvL/9wiZAQ36N28jljfjBFp889dLS9T4ho94n4B7pLQFmHC9DSoEXjFcetmCRVy4OFy2SjZRNUQ4imYCA31hidBt+LTZqnGVlHHKzPQH9UILbaZp3pCSBx9dB9/q1CirbLDRVKyAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; c=relaxed/simple; bh=w3vZjU2ZukjzPVe/3mE+1zklHfqbFye7FOK63NG+LN8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ee5CbImu91DFCnMCAD5QvegKSqr3RykMJr7SBpGVwaWXaZd6zrz53T/TFHKHivHpxa/QGdm5tGpO+9z0+LRB+eo6078PC2u95mtY0TOZwKQhm4xKxE8SVxmXnGr8/R0MbwU6xjHUGM9Q6VTJR9vOfPg0Xtv6+CEhXUzzdoHg0Uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=HJVHgt0F; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="HJVHgt0F" From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1713324770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hPtvoofQRoHM1orP9jvIwV7p5cXi991cC80IQiCf8w8=; b=HJVHgt0F3CPMBVTg7OghLBa238Qirep/HzGznPD1zmtltXoUmpAynfwC594WTfWD0lTFkc xkIPxk9QqOIOkH81HiqLmgdp3AZR7gsPks7FnzY6JVibdxf9wvueHevMR0W/iGVDyDlOs7 kXwphWN0xm8wmNoDDFCcoimxVGon4AY7e6hrnhbi3O3hO429AnHHiiz3KgTPjBhGX3HADf 6Qqw2N6f8KqrwnMThRUlImjkj9GNp15vTpNB3/njWsjujzzdaAZahaQRvQ8cmsAlyzfnxn D+l/hPAjL4m0R6DtnHl7x8aTvzOsV26XUVhJ33BAPw0OHbeDPY7MYfc5TgsQtw== To: git@vger.kernel.org Subject: [PATCH 2/4] format-patch: fix a bug in option exclusivity and add a test to t4014 Date: Wed, 17 Apr 2024 05:32:42 +0200 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org Fix a bug that allows --rfc and -k options to be specified together when executing "git format-patch". This bug was introduced back in the commit e0d7db7423a9 ("format-patch: --rfc honors what --subject-prefix sets"), about eight months ago, but it has remained undetected so far, presumably because of no associated test coverage. Add a new test to the t4014 that covers the mutual exclusivity of the --rfc and -k command-line options for "git format-patch", for future coverage. Signed-off-by: Dragan Simic --- builtin/log.c | 5 ++++- t/t4014-format-patch.sh | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/builtin/log.c b/builtin/log.c index c0a8bb95e983..e5a238f1cf2c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -2050,8 +2050,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (cover_from_description_arg) cover_from_description_mode = parse_cover_from_description(cover_from_description_arg); - if (rfc) + /* Also mark the subject prefix as modified, for later checks */ + if (rfc) { strbuf_insertstr(&sprefix, 0, "RFC "); + subject_prefix = 1; + } if (reroll_count) { strbuf_addf(&sprefix, " v%s", reroll_count); diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index e37a1411ee24..e22c4ac34e6e 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1397,6 +1397,10 @@ test_expect_success '--rfc is argument order independent' ' test_cmp expect actual ' +test_expect_success '--rfc and -k cannot be used together' ' + test_must_fail git format-patch -1 --stdout --rfc -k >patch +' + test_expect_success '--from=ident notices bogus ident' ' test_must_fail git format-patch -1 --stdout --from=foo >patch ' From patchwork Wed Apr 17 03:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13632848 Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 818CD3FB81 for ; Wed, 17 Apr 2024 03:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; cv=none; b=HrfJ/pndlm0VMdhr5cZgAUABJtMjSaQE9qnhtT8c3+b0zxJ25wYTsIwGJEjT4sOcOr2ngk8AW+u1tRoG4lpSH+OquhO5dtl+HCccgnhR3C5E06eJG8u/hcim/sZEQbE3z5vDvBByufECVN4UipeBGq0ENWhGjiuHb7/2NH4OxrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; c=relaxed/simple; bh=D+ZTaGu/OSlj1pHzfZWhw/icIF9JPEY61yeCrTRsoZ8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rfc5tNNgmlqIb2Xhd8aiOCeuNgivX+T6ophcs6ttExQUTTGChSXl/kzPoqPpuyY+3rqb6ZZTlCLwI9luGQbmq9XQsfN/VPM2F1Myph19s+97xIh3jaH7vBma8TOPSrMFtinJGgzE1e6kqaTZVkxZIqxHQHec4mRXMkXPpWQNs74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=DNYi/1m8; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="DNYi/1m8" From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1713324770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yKq06gosPMYZP92hXh8eMP6Hi6XBf9aru8sCn+QYz3M=; b=DNYi/1m8osen45I5km6LRKUZ2Uj1mvpQOnVPLQlKVAjwaEcaG6bcC1yZ4GO3zld6nMl91R 0d/8ZX5WW60LCuL6mP3udiZcwLLSF6JYH1jY1XTacCIsmymXDJNWQAoO4+PEUIgXOwTRBf q6J4NMY6Gzi7DRPWVHmZSyvdpXYMGZko3ZPWSAEOsOY2aT0mTKjZhpgSpNpBtTR3wWot88 /UF672Pvn3sr6Zv3xBaewpOV/rYjxtjyy5n5mpCoI3bFJU23RWNYAOnXfBBf0RkzwOlcZq UvpH/zKM92qLECvJD3wI4SowUUJSWIGSB0kpvLFvVqXASKg9ZpExvZW08xS61w== To: git@vger.kernel.org Subject: [PATCH 3/4] format-patch: new --resend option for adding "RESEND" to patch subjects Date: Wed, 17 Apr 2024 05:32:43 +0200 Message-Id: <1d9c6ce3df714211889453c245485d46b43edff6.1713324598.git.dsimic@manjaro.org> In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org Add --resend as the new command-line option for "git format-patch" that adds "RESEND" as a (sub)suffix to the patch subject prefix, eventually producing "[PATCH RESEND]" as the default patch subject prefix. "[PATCH RESEND]" is a patch subject prefix commonly used on mailing lists for patches resent to a mailing list after they had attracted no attention for some time, usually for a couple of weeks. As such, this subject prefix deserves adding --resend as a new shorthand option to "git format-patch". Of course, add the description of the new --resend command-line option to the documentation for "git format-patch". Signed-off-by: Dragan Simic --- Documentation/git-format-patch.txt | 5 +++++ builtin/log.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index a5019ab46926..8e63b62620ed 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -243,6 +243,11 @@ the patches (with a value of e.g. "PATCH my-project"). default. RFC means "Request For Comments"; use this when sending an experimental patch for discussion rather than application. +--resend:: + Appends "RESEND" to the subject prefix, producing "PATCH RESEND" + by default. Use this when sending again a patch that had resulted + in attracting no discussion for a while. + -v :: --reroll-count=:: Mark the series as the -th iteration of the topic. The diff --git a/builtin/log.c b/builtin/log.c index e5a238f1cf2c..28f31659bcde 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1908,7 +1908,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) struct strbuf rdiff_title = STRBUF_INIT; struct strbuf sprefix = STRBUF_INIT; int creation_factor = -1; - int rfc = 0; + int rfc = 0, resend = 0; const struct option builtin_format_patch_options[] = { OPT_CALLBACK_F('n', "numbered", &numbered, NULL, @@ -1933,6 +1933,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) OPT_INTEGER(0, "filename-max-length", &fmt_patch_name_max, N_("max length of output filename")), OPT_BOOL(0, "rfc", &rfc, N_("use [RFC PATCH] instead of [PATCH]")), + OPT_BOOL(0, "resend", &resend, N_("use [PATCH RESEND] instead of [PATCH]")), OPT_STRING(0, "cover-from-description", &cover_from_description_arg, N_("cover-from-description-mode"), N_("generate parts of a cover letter based on a branch's description")), @@ -2055,6 +2056,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) strbuf_insertstr(&sprefix, 0, "RFC "); subject_prefix = 1; } + if (resend) { + strbuf_addstr(&sprefix, " RESEND"); + subject_prefix = 1; + } if (reroll_count) { strbuf_addf(&sprefix, " v%s", reroll_count); @@ -2111,7 +2116,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (numbered && keep_subject) die(_("options '%s' and '%s' cannot be used together"), "-n", "-k"); if (keep_subject && subject_prefix) - die(_("options '%s' and '%s' cannot be used together"), "--subject-prefix/--rfc", "-k"); + die(_("options '%s' and '%s' cannot be used together"), "--subject-prefix/--rfc/--resend", "-k"); + if (rfc && resend) + die(_("options '%s' and '%s' cannot be used together"), "--rfc", "--resend"); rev.preserve_subject = keep_subject; argc = setup_revisions(argc, argv, &rev, &s_r_opt); From patchwork Wed Apr 17 03:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13632847 Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B071538DD6 for ; Wed, 17 Apr 2024 03:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; cv=none; b=g07s6lt/YK9Tfq/L8vE3mDHypyLjl6Y66LEooebUKd7kmEDZygdWafykaCVC1+1P+AADPUWZ6SyF+e26llqnrv9ylNckGFJXlM1tAZH5PdSCAnDcQ8w0U6HYP5/e3cis7mxd07cIpy/Fhl1s4qssRZzPYa/htuZ3WYOmFnYeXDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324775; c=relaxed/simple; bh=9iLZ6YHCjcGNiR+WPRJduspqZWVp3UuLFBY3pn9knEY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XJLXQFfrHyGYcb9RuX4th0cQldU2aKIA2EzHfSDfLNruCyF/Amv+WqZZpCZlsNHhMLZioahUARDhBIi41lO8KzTH8G4foo4588z7+nK3IoGlGoaLtmn4BmLmkAwiyQ72zVN5981OICbHPzhWogHwyXocYwGqD9Q62VbkMKOJud4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=XA9jpjbJ; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="XA9jpjbJ" From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1713324770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yCwA0kxeJerDmuha2KFidN3EHfXB54Mr0Z/cEsoDbj4=; b=XA9jpjbJJ6xSGMTMjSbbOlfKn1kGYz4B6OI9sCHDYMiXwuKfcb3BxNYlA3liW63n1ZJVjR zpA8bQX1KJi9z7ti9KkJC+9wkaxwxNHo/ZPD59OXPaNb2n9CumpQE4x2C1UWxBxzdOrMST 8i7wlHLuE8nR7CSNnn8JwZp09YvcjAWoUKg+VQM/UAwpYXxR1smswOiEtWq2CYnAE9Oom4 UifKVzFW2zznIDbgFvFeN2O5KQkdZlRTVM9HjPoxpeK1TmVAWkXETKB9KIOG/9xp5/yltu BwkYhU7DNf+7xyCwUcDmorwV1vuoeW8nTXfzKinTdoosmXIazo1Iqa8U6aNN8A== To: git@vger.kernel.org Subject: [PATCH 4/4] t4014: add tests to cover --resend option and its exclusivity Date: Wed, 17 Apr 2024 05:32:44 +0200 Message-Id: <42865d6c6694b9e6b745c328d717ed244dc25a1a.1713324598.git.dsimic@manjaro.org> In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org Add a few new tests to the t4014 that cover the --resend command-line option for "git format-patch", which include the tests for its exclusivity with the already existing -k and --rfc command-line options. Signed-off-by: Dragan Simic --- t/t4014-format-patch.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index e22c4ac34e6e..bcf7b633e78f 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1401,6 +1401,43 @@ test_expect_success '--rfc and -k cannot be used together' ' test_must_fail git format-patch -1 --stdout --rfc -k >patch ' +test_expect_success '--resend' ' + cat >expect <<-\EOF && + Subject: [PATCH RESEND 1/1] header with . in it + EOF + git format-patch -n -1 --stdout --resend >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend does not overwrite prefix' ' + cat >expect <<-\EOF && + Subject: [PATCH RFC RESEND 1/1] header with . in it + EOF + git -c format.subjectPrefix="PATCH RFC" \ + format-patch -n -1 --stdout --resend >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend is argument order independent' ' + cat >expect <<-\EOF && + Subject: [PATCH RFC RESEND 1/1] header with . in it + EOF + git format-patch -n -1 --stdout --resend \ + --subject-prefix="PATCH RFC" >patch && + grep "^Subject:" patch >actual && + test_cmp expect actual +' + +test_expect_success '--resend and -k cannot be used together' ' + test_must_fail git format-patch -1 --stdout --resend -k >patch +' + +test_expect_success '--rfc and --resend cannot be used together' ' + test_must_fail git format-patch -1 --stdout --rfc --resend >patch +' + test_expect_success '--from=ident notices bogus ident' ' test_must_fail git format-patch -1 --stdout --from=foo >patch '