From patchwork Thu Feb 9 15:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13134821 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD349C636D6 for ; Thu, 9 Feb 2023 15:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbjBIPpe (ORCPT ); Thu, 9 Feb 2023 10:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230174AbjBIPpa (ORCPT ); Thu, 9 Feb 2023 10:45:30 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1626B6565B for ; Thu, 9 Feb 2023 07:44:55 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id a5so984804ilk.6 for ; Thu, 09 Feb 2023 07:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9qj6iV8Jk+40tsJDKvnzqGxJ5AjMLS0+V/A65FOA41c=; b=j4Y84wSbh9PvTOAC0l2EFa3sFSkOhLHyiw1CHJF+oT7ulItQxcKk6x3+0FuAYDvQF9 iSKcHdyihsAfUXQgttv6JfeCR5BMLjd/MyqXLubevvFmDQbBfKKgnVqKXv94O9hUmOMT Jbqb0EfByjWF1g830NGCjVOKwT7ZwONhNtG2WHUWXNeDoC0IWxqti82oE8W7KfbqkPdm 1bLfIhyXKMe2wC2ow9ry/npJos4p60ygXLctMcZKjY5Ijozz+7oqu6G/avpt24Df1t1D wI9YMHlD7Wtr8hbT50v3Q+m2TR3tGJ2UaPRGZjLPNp8klp3CcKmqd/XDi6nQEdES5rzA l4WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9qj6iV8Jk+40tsJDKvnzqGxJ5AjMLS0+V/A65FOA41c=; b=cvvLb+5B8Lvs90vt/DoaqZkMRdSUe6g4VkOGSenDwmP85ogzj0rPJ4ItHQX2U+F/Dx hIFLKS1XwwVErTPQLJDA1hfRW9S7DtcHE7Gh8PqUa1I2n1SmAo3hrO82sUueC6rREP38 Z9HbqFZph19aXOGNN3d2aL/myCe684oWMofjRtVACiN0HkL7plxFGE81+5B1BWOTizRE WYoIzZazny9Pl732bXZSdutDVTBL7SbleW2RcTvKBLtK3bJkjbqvMT4TR3u7moi2R019 EIFfLkPzVcykPyTUwGPBNVEfkbyMrnP0q06QaZUJ+iWKinD8mhgfPOrqfGMjLtJpUGvM rPgQ== X-Gm-Message-State: AO0yUKX753tCTTwduzOFl2lXM/xFjDNJcwfpxQGJ+8pvOGs6UHyvif9Q mbUgOabV5PoNW20LK+eoa0lr5SAVuO1OYw== X-Google-Smtp-Source: AK7set8D187XBZppZQKqddUDcEqFObeu1jASa0MvTFOT+TIxIh6vdrI2vGYVJ6BoSrIexcj8kivRXA== X-Received: by 2002:a92:c241:0:b0:310:fa45:ac78 with SMTP id k1-20020a92c241000000b00310fa45ac78mr8609744ilo.29.1675957485646; Thu, 09 Feb 2023 07:44:45 -0800 (PST) Received: from localhost.localdomain (bras-base-london142cw-grc-20-69-158-191-243.dsl.bell.ca. [69.158.191.243]) by smtp.googlemail.com with ESMTPSA id a1-20020a92d581000000b0030c0dce44b1sm563570iln.15.2023.02.09.07.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 07:44:45 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v5 1/3] t4113: modernize test script Date: Thu, 9 Feb 2023 10:44:15 -0500 Message-Id: <20230209154417.10763-2-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230209154417.10763-1-cheskaqiqi@gmail.com> References: <20230206211823.8651-1-cheskaqiqi@gmail.com> <20230209154417.10763-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Test scripts in file in this script are written in old style, where the test_expect_success command and test title are written on separate lines. Change the old style to modern style. for example : -test_expect_success setup \ - 'git update-index --add file' - +test_expect_success setup ' + git update-index --add file +' Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 66fa51591e..41526ca805 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -24,14 +24,14 @@ echo 'a' >file echo 'b' >>file echo 'c' >>file -test_expect_success setup \ - 'git update-index --add file' - +test_expect_success setup ' + git update-index --add file +' # test -test_expect_success 'apply at the end' \ - 'test_must_fail git apply --index test-patch' - +test_expect_success 'apply at the end' ' + test_must_fail git apply --index test-patch +' cat >test-patch <<\EOF diff a/file b/file --- a/file @@ -47,7 +47,7 @@ b c' git update-index file -test_expect_success 'apply at the beginning' \ - 'test_must_fail git apply --index test-patch' - +test_expect_success 'apply at the beginning' ' + test_must_fail git apply --index test-patch +' test_done From patchwork Thu Feb 9 15:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13134822 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BD79C61DA4 for ; Thu, 9 Feb 2023 15:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231464AbjBIPpg (ORCPT ); Thu, 9 Feb 2023 10:45:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231414AbjBIPpd (ORCPT ); Thu, 9 Feb 2023 10:45:33 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CAC60E7E for ; Thu, 9 Feb 2023 07:44:59 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id b9so814958ila.0 for ; Thu, 09 Feb 2023 07:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DhNQlDKUjRXmK5rcweYMF5p62ggFuazYB7/5iE0iZ7Q=; b=BJkEH5n5k790MtGUzEKmdhJ8XRFrtihp6GX1Pu2yQ6wDmHFeD2mD0iRh/zmyjbzYrk cW/61Na6EoJcz4UTFafneRrf9TBBfd/F4RsGqPmAONAjPMzTTaBviZ9mbiraIeBN7+vY pGAUiZrTYDkU9tT7feohQm5HdMnFa+3Ciex4lBismb61yJnCrxed9d4jnGn8WehCNeSK SJOYCaazCuhliXH5lQgVStrlCmQoa2um7hiA7TEGiLVVYeSSrBcdlTGPXYAZckcDFeMf bNmbgaD8RBoMTptBc7IEiu37EgareMwnBWaJQwQeMLzTYQ5anpOyy0RZA6W0fweI1nYx wKXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DhNQlDKUjRXmK5rcweYMF5p62ggFuazYB7/5iE0iZ7Q=; b=hlAIP5prj0YkJj6MXduTFwI80ENraTrmuWLgz8TuTNks6/gkJn83yD2HSqQNHbNvzM 08VYIfV96PpeoYoxlQcQ2OIkQt+16+Z9o+dXQmOO4/ly1TaidGj1MmlqMTYcE5gAkQOJ VX0mLDq4h1Dx9186GR0lhDyUYsSSt917dMvdnNaSdvQOzBw/aVAJ5lDcv1AW484ZCHqy gmF2PRYLbgcnMR/IDng3KVu5pLO/qZ8DfaPj/TEuXLZR2kxxzW8NGFD8Kj45XKwCoQaf rfM+Arpy9pRVaPn/6k83wn/i0gkCbJlWpP70tSBVlZga5U1kKwoKfDrvjGlOpy02RZT1 FxWA== X-Gm-Message-State: AO0yUKWdQwDJxW4lzAfUesZre0tlnO2WIeucz7SN27bcbLT/CzQrSjKk WYaicJPT92FWN4Cc239sy7cN2Tv0zCnIvw== X-Google-Smtp-Source: AK7set994EbY7HFzmbHjFHZr7+D+ydrZ9yOrJC2614MaLILBWtXqAIF6rJu079W3S+JF/uGUx8Z/wA== X-Received: by 2002:a92:7b04:0:b0:313:d7fc:4c09 with SMTP id w4-20020a927b04000000b00313d7fc4c09mr9156130ilc.18.1675957488290; Thu, 09 Feb 2023 07:44:48 -0800 (PST) Received: from localhost.localdomain (bras-base-london142cw-grc-20-69-158-191-243.dsl.bell.ca. [69.158.191.243]) by smtp.googlemail.com with ESMTPSA id a1-20020a92d581000000b0030c0dce44b1sm563570iln.15.2023.02.09.07.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 07:44:47 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v5 2/3] t4113: indent with tab Date: Thu, 9 Feb 2023 10:44:16 -0500 Message-Id: <20230209154417.10763-3-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230209154417.10763-1-cheskaqiqi@gmail.com> References: <20230206211823.8651-1-cheskaqiqi@gmail.com> <20230209154417.10763-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As Documentation/CodingGuidelines says, the shell scripts are to use tabs for indentation, but this script uses 4-column indent with space. Fix it in use tabs for indentation. Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 41526ca805..a470c9ce7b 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -25,12 +25,12 @@ echo 'b' >>file echo 'c' >>file test_expect_success setup ' - git update-index --add file + git update-index --add file ' # test test_expect_success 'apply at the end' ' - test_must_fail git apply --index test-patch + test_must_fail git apply --index test-patch ' cat >test-patch <<\EOF diff a/file b/file From patchwork Thu Feb 9 15:44:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13134823 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B98AAC636D7 for ; Thu, 9 Feb 2023 15:45:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231549AbjBIPpi (ORCPT ); Thu, 9 Feb 2023 10:45:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbjBIPpd (ORCPT ); Thu, 9 Feb 2023 10:45:33 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C84B2194E for ; Thu, 9 Feb 2023 07:45:00 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id z2so996572ilq.2 for ; Thu, 09 Feb 2023 07:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wmpb4/gPoCwA7dUNv68wjFxO2bFg6bKJXC5BEAhEk3A=; b=Y32+r3ZO/XzthB9Fo1OPZM2bAwWoBbonh50h1cuLyPE/08X7TSvUa1ZmApOud22XCy mEwCfjredlS7Ox8lp1edwg3kk7+GIAv793t4s9fqWzTs+MZ+01zyaXPoukG04dzk8PrP oSkSAIgpBYgKDj+LSZK6jQpVwMhdKt2yn1ArI4Py2uOwqRDxJ46/eWiEu+wMLnzQ30kK t5tau4qjk/MVZzrsi7+nW+BgwkiBvqZIUKJHsUVso4NYxvllgAKEY9mT2uGvbMdP0KPo OFrSDWviZXsY2NlsxQ4WI7FOb1I2EwavaksZMhPf/sMdxeo5ju3lpIfdxaiNRl2GRg/e N1Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wmpb4/gPoCwA7dUNv68wjFxO2bFg6bKJXC5BEAhEk3A=; b=4HDeL7nEhDD/++TDG0m1t7SgVQRgKyvn+g//FKvaQrzlav7kcT+P7+kAU6gzxt48XK ba/Fp8HTHjgXdXSjujJV2b5sFl8QGOE+XejKEutidpyRmQFVbk94PqfuPdwBhxaJwYUO zwAZa/4CdlqMI2eCRPxm5D1qNjR1DHd4d0J2g74vahygjCY5+BHYZRxxY2UWitByiify yEcaRMyDtBuP7Z0sSXLEkrxVIKaBkHUlzysT/SF6jUGfePbTBZ0kZVqULvSHi9w84mDG 0Xz+Gf4wKqlPUME0jjFSZg6ypCFf6mwISw26dAoL8cv/yEaWxIYvrEtQvz39zAJGf+2s MKWQ== X-Gm-Message-State: AO0yUKX6mRgemKcYUl9YUaHxejD5jSyCndbcOkgb8Cg0CUrmprUafope 7KxXRYmAAax92wU/WUBw6j9q18lDmoaJbw== X-Google-Smtp-Source: AK7set9riyKV4Py62KQ0Zzz+Lr8dc0s26oJ3JK0wolYbz1MsTKriASWe1YW9jGri8yN+bt25+WBsfg== X-Received: by 2002:a05:6e02:1bab:b0:310:b34e:23d7 with SMTP id n11-20020a056e021bab00b00310b34e23d7mr12224712ili.21.1675957490453; Thu, 09 Feb 2023 07:44:50 -0800 (PST) Received: from localhost.localdomain (bras-base-london142cw-grc-20-69-158-191-243.dsl.bell.ca. [69.158.191.243]) by smtp.googlemail.com with ESMTPSA id a1-20020a92d581000000b0030c0dce44b1sm563570iln.15.2023.02.09.07.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 07:44:50 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v5 3/3] t4113: put executable lines to test_expect_success Date: Thu, 9 Feb 2023 10:44:17 -0500 Message-Id: <20230209154417.10763-4-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230209154417.10763-1-cheskaqiqi@gmail.com> References: <20230206211823.8651-1-cheskaqiqi@gmail.com> <20230209154417.10763-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As t/README says, put all code inside test_expect_success and other assertions. This script is written in old style,where there are some executable lines outside test_expect_success. Put the executable lines inside the test_expect_success. As t/README says,use "<<-" instead of "<<" to strip leading TABs used for indentation. Change the "<<" to "<<-" for example: -cat >test-patch <<\EOF -diff a/file b/file test_expect_success 'apply at the beginning' ' + cat >test-patch <<-\EOF + diff a/file b/file + --- a/file As t/README says,chain test assertions.Chain this test assertions with &&. For example: -cat >test-patch <<\EOF -diff --git a/file b/file + cat >test-patch <<-\EOF && + diff --git a/file b/file This script is written in old style,where there are something like echo x >file && echo y >>file && echo z >>file Change it to this stlye : { echo x && echo y && echo z } >file In order to escape for executable lines inside the test_expect_success. Change ' in executable lines to '\'' in order to escape. Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 61 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index a470c9ce7b..c70429bd07 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -8,46 +8,45 @@ test_description='git apply trying to add an ending line. ' . ./test-lib.sh -# setup - -cat >test-patch <<\EOF -diff --git a/file b/file ---- a/file -+++ b/file -@@ -1,2 +1,3 @@ - a - b -+c -EOF - -echo 'a' >file -echo 'b' >>file -echo 'c' >>file - test_expect_success setup ' + cat >test-patch <<-\EOF && + diff --git a/file b/file + --- a/file + +++ b/file + @@ -1,2 +1,3 @@ + a + b + +c + EOF + + { + echo '\''a'\'' && + echo '\''b'\'' && + echo '\''c'\'' + } >file && git update-index --add file ' -# test test_expect_success 'apply at the end' ' test_must_fail git apply --index test-patch ' -cat >test-patch <<\EOF -diff a/file b/file ---- a/file -+++ b/file -@@ -1,2 +1,3 @@ -+a - b - c -EOF - -echo >file 'a -b -c' -git update-index file test_expect_success 'apply at the beginning' ' + cat >test-patch <<-\EOF && + diff a/file b/file + --- a/file + +++ b/file + @@ -1,2 +1,3 @@ + +a + b + c + EOF + + echo >file '\''a + b + c'\'' && + git update-index file && test_must_fail git apply --index test-patch ' + test_done