From patchwork Fri Sep 21 23:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10611217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B123515A6 for ; Fri, 21 Sep 2018 23:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1A052DEA8 for ; Fri, 21 Sep 2018 23:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963082DEAE; Fri, 21 Sep 2018 23:58:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAF3A2DEA8 for ; Fri, 21 Sep 2018 23:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391591AbeIVFuF (ORCPT ); Sat, 22 Sep 2018 01:50:05 -0400 Received: from mail-io1-f73.google.com ([209.85.166.73]:52214 "EHLO mail-io1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725756AbeIVFuF (ORCPT ); Sat, 22 Sep 2018 01:50:05 -0400 Received: by mail-io1-f73.google.com with SMTP id w23-v6so25937714iob.18 for ; Fri, 21 Sep 2018 16:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=dp/gQb+cOETqqpUIphj8PxMrSxutV/Se0SEeg9C7ReU=; b=cGLSiX6dfoGyEITfHH2hGflTpsV54abZ3BwAUJk+SE8G40wua7noEG1dzk616DM85K iUZBrgvcfOpdiBxJ83ZoNdbqfuCQuIYT9QOLdtT33Nrex6kR+Ogyxh04o9D3K+PK8zSH MgmpV/iUi8fS6roMwIF37soUntog+Jf+zmJCMlkV44pS1o1rtqrqF8tSuJOrUcsv3l9t Djf1dkSNvYzE7/n3FqOwyAYO8+TrjV7V74HqLZqWa+6Ve+oyLor9o9j8+iajPihbvR4L 4/xNFBR5YOpfeKp4DGGmYv1HXKO2toR8G+iD1DruLYKiBJHC11WJN5Zgjo2CKno+ErSE ISMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=dp/gQb+cOETqqpUIphj8PxMrSxutV/Se0SEeg9C7ReU=; b=ftnZ63sl2wla3xgRIgN5YIe1WLEWmULAv9Q5C6Qt9vN+hYSIL4obMVOseNcPwwJJyF XfJwT0OvOe5HNhSOxKShVtQJhfJTUzK0/aIMTeJl92/NgdVfRcP7FsGGVlQWAkqqQm+1 V1rzrvn6/8mriIfuS+2iLUQWhFdJHK4kZsIrEfin9KmXBeoR9AKxcNE6iB+HOLYcQ5dF 5LeUvnfJm2E5UvdG3Ql+r99Z2K+43AlDr+865Ugu0v4NXGIImRDjPlkdLA1s9WVG3enO oBstDgN52Rppddnj8djgTGY2yyUIaGJ//nlezzIAj/9do9IVAsJmNlq2P/CB++bGgqMD OUEQ== X-Gm-Message-State: APzg51BxNBCrGUXOrR5eo7e31yvlm5tnSO3K/W8SB1B19DzImDmGKiil 1zPWyU8GpwKXVxq3h+7W23I0g++61DmSWaZLQ/IEw1fmqvO/OYmEguLZ5VMUGl4v8HsJaBIV3SZ X3G/sMQ7IGDOddr8dN4IqOd9qHvEDE59Fue41IzfoI8wS1J2wyjq3yysJcsCj X-Google-Smtp-Source: ANB0VdYWC8NWt95IwUld9SkZ76G7r/+b4kRCcFvsSZr+3HvS9imD8dMYsx0zbotEzm/EG+AxOsLtyhuPonhU X-Received: by 2002:a24:328e:: with SMTP id j136-v6mr8225ita.26.1537574332030; Fri, 21 Sep 2018 16:58:52 -0700 (PDT) Date: Fri, 21 Sep 2018 16:58:31 -0700 In-Reply-To: <20180921235833.99045-1-sbeller@google.com> Message-Id: <20180921235833.99045-2-sbeller@google.com> Mime-Version: 1.0 References: <20180921235833.99045-1-sbeller@google.com> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH 1/3] t7001: reformat to newer style From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The old formatting style is a real hindrance of getting people up to speed contributing as they use existing code as an example and follow that style. So let's get rid of the old style and reformat it in our current style. Reported-by: Derrick Stolee Reported-by: Jeff Hostetler Signed-off-by: Stefan Beller --- t/t7001-mv.sh | 268 +++++++++++++++++++++++++------------------------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 36b50d0b4c1..2251d24735c 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -3,74 +3,74 @@ test_description='git mv in subdirs' . ./test-lib.sh -test_expect_success \ - 'prepare reference tree' \ - 'mkdir path0 path1 && - cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && - git add path0/COPYING && - git commit -m add -a' +test_expect_success 'prepare reference tree' ' + mkdir path0 path1 && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && + git add path0/COPYING && + git commit -m add -a +' -test_expect_success \ - 'moving the file out of subdirectory' \ - 'cd path0 && git mv COPYING ../path1/COPYING' +test_expect_success 'moving the file out of subdirectory' ' + cd path0 && git mv COPYING ../path1/COPYING +' # in path0 currently -test_expect_success \ - 'commiting the change' \ - 'cd .. && git commit -m move-out -a' +test_expect_success 'commiting the change' ' + cd .. && git commit -m move-out -a +' -test_expect_success \ - 'checking the commit' \ - 'git diff-tree -r -M --name-status HEAD^ HEAD >actual && - grep "^R100..*path0/COPYING..*path1/COPYING" actual' +test_expect_success 'checking the commit' ' + git diff-tree -r -M --name-status HEAD^ HEAD >actual && + grep "^R100..*path0/COPYING..*path1/COPYING" actual +' -test_expect_success \ - 'moving the file back into subdirectory' \ - 'cd path0 && git mv ../path1/COPYING COPYING' +test_expect_success 'moving the file back into subdirectory' ' + cd path0 && git mv ../path1/COPYING COPYING +' # in path0 currently -test_expect_success \ - 'commiting the change' \ - 'cd .. && git commit -m move-in -a' - -test_expect_success \ - 'checking the commit' \ - 'git diff-tree -r -M --name-status HEAD^ HEAD >actual && - grep "^R100..*path1/COPYING..*path0/COPYING" actual' - -test_expect_success \ - 'mv --dry-run does not move file' \ - 'git mv -n path0/COPYING MOVED && - test -f path0/COPYING && - test ! -f MOVED' - -test_expect_success \ - 'checking -k on non-existing file' \ - 'git mv -k idontexist path0' - -test_expect_success \ - 'checking -k on untracked file' \ - 'touch untracked1 && - git mv -k untracked1 path0 && - test -f untracked1 && - test ! -f path0/untracked1' - -test_expect_success \ - 'checking -k on multiple untracked files' \ - 'touch untracked2 && - git mv -k untracked1 untracked2 path0 && - test -f untracked1 && - test -f untracked2 && - test ! -f path0/untracked1 && - test ! -f path0/untracked2' - -test_expect_success \ - 'checking -f on untracked file with existing target' \ - 'touch path0/untracked1 && - test_must_fail git mv -f untracked1 path0 && - test ! -f .git/index.lock && - test -f untracked1 && - test -f path0/untracked1' +test_expect_success 'commiting the change' ' + cd .. && git commit -m move-in -a +' + +test_expect_success 'checking the commit' ' + git diff-tree -r -M --name-status HEAD^ HEAD >actual && + grep "^R100..*path1/COPYING..*path0/COPYING" actual +' + +test_expect_success 'mv --dry-run does not move file' ' + git mv -n path0/COPYING MOVED && + test -f path0/COPYING && + test ! -f MOVED +' + +test_expect_success 'checking -k on non-existing file' ' + git mv -k idontexist path0 +' + +test_expect_success 'checking -k on untracked file' ' + touch untracked1 && + git mv -k untracked1 path0 && + test -f untracked1 && + test ! -f path0/untracked1 +' + +test_expect_success 'checking -k on multiple untracked files' ' + touch untracked2 && + git mv -k untracked1 untracked2 path0 && + test -f untracked1 && + test -f untracked2 && + test ! -f path0/untracked1 && + test ! -f path0/untracked2 +' + +test_expect_success 'checking -f on untracked file with existing target' ' + touch path0/untracked1 && + test_must_fail git mv -f untracked1 path0 && + test ! -f .git/index.lock && + test -f untracked1 && + test -f path0/untracked1 +' # clean up the mess in case bad things happen rm -f idontexist untracked1 untracked2 \ @@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \ .git/index.lock rmdir path1 -test_expect_success \ - 'moving to absent target with trailing slash' \ - 'test_must_fail git mv path0/COPYING no-such-dir/ && - test_must_fail git mv path0/COPYING no-such-dir// && - git mv path0/ no-such-dir/ && - test_path_is_dir no-such-dir' - -test_expect_success \ - 'clean up' \ - 'git reset --hard' - -test_expect_success \ - 'moving to existing untracked target with trailing slash' \ - 'mkdir path1 && - git mv path0/ path1/ && - test_path_is_dir path1/path0/' - -test_expect_success \ - 'moving to existing tracked target with trailing slash' \ - 'mkdir path2 && - >path2/file && git add path2/file && - git mv path1/path0/ path2/ && - test_path_is_dir path2/path0/' - -test_expect_success \ - 'clean up' \ - 'git reset --hard' - -test_expect_success \ - 'adding another file' \ - 'cp "$TEST_DIRECTORY"/../README.md path0/README && - git add path0/README && - git commit -m add2 -a' - -test_expect_success \ - 'moving whole subdirectory' \ - 'git mv path0 path2' - -test_expect_success \ - 'commiting the change' \ - 'git commit -m dir-move -a' - -test_expect_success \ - 'checking the commit' \ - 'git diff-tree -r -M --name-status HEAD^ HEAD >actual && - grep "^R100..*path0/COPYING..*path2/COPYING" actual && - grep "^R100..*path0/README..*path2/README" actual' - -test_expect_success \ - 'succeed when source is a prefix of destination' \ - 'git mv path2/COPYING path2/COPYING-renamed' - -test_expect_success \ - 'moving whole subdirectory into subdirectory' \ - 'git mv path2 path1' - -test_expect_success \ - 'commiting the change' \ - 'git commit -m dir-move -a' - -test_expect_success \ - 'checking the commit' \ - 'git diff-tree -r -M --name-status HEAD^ HEAD >actual && - grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual && - grep "^R100..*path2/README..*path1/path2/README" actual' - -test_expect_success \ - 'do not move directory over existing directory' \ - 'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0' - -test_expect_success \ - 'move into "."' \ - 'git mv path1/path2/ .' +test_expect_success 'moving to absent target with trailing slash' ' + test_must_fail git mv path0/COPYING no-such-dir/ && + test_must_fail git mv path0/COPYING no-such-dir// && + git mv path0/ no-such-dir/ && + test_path_is_dir no-such-dir +' + +test_expect_success 'clean up' ' + git reset --hard +' + +test_expect_success 'moving to existing untracked target with trailing slash' ' + mkdir path1 && + git mv path0/ path1/ && + test_path_is_dir path1/path0/ +' + +test_expect_success 'moving to existing tracked target with trailing slash' ' + mkdir path2 && + >path2/file && git add path2/file && + git mv path1/path0/ path2/ && + test_path_is_dir path2/path0/ +' + +test_expect_success 'clean up' ' + git reset --hard +' + +test_expect_success 'adding another file' ' + cp "$TEST_DIRECTORY"/../README.md path0/README && + git add path0/README && + git commit -m add2 -a +' + +test_expect_success 'moving whole subdirectory' ' + git mv path0 path2 +' + +test_expect_success 'commiting the change' ' + git commit -m dir-move -a +' + +test_expect_success 'checking the commit' ' + git diff-tree -r -M --name-status HEAD^ HEAD >actual && + grep "^R100..*path0/COPYING..*path2/COPYING" actual && + grep "^R100..*path0/README..*path2/README" actual +' + +test_expect_success 'succeed when source is a prefix of destination' ' + git mv path2/COPYING path2/COPYING-renamed +' + +test_expect_success 'moving whole subdirectory into subdirectory' ' + git mv path2 path1 +' + +test_expect_success 'commiting the change' ' + git commit -m dir-move -a +' + +test_expect_success 'checking the commit' ' + git diff-tree -r -M --name-status HEAD^ HEAD >actual && + grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual && + grep "^R100..*path2/README..*path1/path2/README" actual +' + +test_expect_success 'do not move directory over existing directory' ' + mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0 +' + +test_expect_success 'move into "."' ' + git mv path1/path2/ . +' test_expect_success "Michael Cassar's test case" ' rm -fr .git papers partA && From patchwork Fri Sep 21 23:58:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10611219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1C8515E8 for ; Fri, 21 Sep 2018 23:59:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C21842DEA8 for ; Fri, 21 Sep 2018 23:59:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B62F52DEAE; Fri, 21 Sep 2018 23:59:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9F352DEA8 for ; Fri, 21 Sep 2018 23:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391633AbeIVFuO (ORCPT ); Sat, 22 Sep 2018 01:50:14 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:55700 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725756AbeIVFuO (ORCPT ); Sat, 22 Sep 2018 01:50:14 -0400 Received: by mail-qk1-f201.google.com with SMTP id z18-v6so14409757qki.22 for ; Fri, 21 Sep 2018 16:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=YI6hWQXG0v7rFU8i2z0qKkYCjrGtzwDLxzlk5N7gKHk=; b=pP1R9eAoTOoVYw5KmVY5zS1BlLFjh78nH3dGavunmHVJMEc5YFLlkOBKFZUKtj8X2G KYiY3BjMO3A3GhYqQvchhpQSkesjEPtHkV1sszjgzGhmxkm/3fQ69JF4T/CU7qJaNiXn IRv6ltm9vHnItDSjvxfdXX1/i4HWo2mExLj02+y++PuQi/HNzgKgYWiaL7eqy4Xiba0P k6/de6YeBRPehlEcVbL9QkTnkv0yRdIj8y8JiJlPep7TNQmnvz4GrX9UnflNKwcTqMqO vgjxSr0Y74Q7C1//CvQmJJnOO/T+h/SRn346L4exF5JxjYoy93M7zpuRYHYxbSxH8aJi Lziw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=YI6hWQXG0v7rFU8i2z0qKkYCjrGtzwDLxzlk5N7gKHk=; b=GPOKuNQffsX0KI35Sw2GJjPPy2iwdr1wNALmMfkDbGq4xrQ5mLwryLv+BdmzNpnT+L wZSnq+fCyseGCTu1rIfxdt4WqmeXsHsRLrz1BDk0OyBhsO13HetrMujq5Olgpzf+OC1r sCrroqoYdxIA1y8+PSAqbp1NG7Ul+zGjWslEqGt/rsGlgkKCfKdZqZzqRDzXYcxfUlZI vJ/Ouzpn1gOsJ6xanUXa6d8Grrd3J6ahyfv0FtW8ZCRs7RufZzTmnDCVA9cxz4GhTSiZ A3ycmVKN37uBWvtxP+cX60E8UG4iglBj+jEVWat6EQDQBniQcgD18Vxsi2sYvIdfYE/B p9SA== X-Gm-Message-State: ABuFfojueHbUlTQEQMtYuUNCzYd4dCfYJDeNVE6p4VFd5hla//dV4SLO XdbOEhdgyewY49OcPH7UdixtJVROvsPAI1e08co98xyth8r+bE/tVp1le9resuoI6PGIGH5LSvc PmM3K2Xso8y+idzyoLETho+5JD+UloF+f4fzlYSPZ8Hr61ToOstJ1SlBnz1Ks X-Google-Smtp-Source: ANB0VdZTURK3/7lXrvsEwUj9/FQ8Aace4W5N/Byzhq/n/6PbiRrRuKOHBWujm0YAyi6pG1jykZxogY4a3Hud X-Received: by 2002:aed:38e6:: with SMTP id k93-v6mr28037qte.46.1537574340300; Fri, 21 Sep 2018 16:59:00 -0700 (PDT) Date: Fri, 21 Sep 2018 16:58:32 -0700 In-Reply-To: <20180921235833.99045-1-sbeller@google.com> Message-Id: <20180921235833.99045-3-sbeller@google.com> Mime-Version: 1.0 References: <20180921235833.99045-1-sbeller@google.com> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH 2/3] t7004: reformat style From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Stefan Beller --- t/t7004-tag.sh | 149 +++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 93 deletions(-) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 0b01862c23a..03a96b7f79e 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -144,26 +144,25 @@ test_expect_success 'listing a tag using a matching pattern should succeed' \ test_expect_success 'listing a tag with --ignore-case' \ 'test $(git tag -l --ignore-case MYTAG) = mytag' -test_expect_success \ - 'listing a tag using a matching pattern should output that tag' \ - 'test $(git tag -l mytag) = mytag' +test_expect_success 'listing a tag using a matching pattern should output that tag' ' + test $(git tag -l mytag) = mytag +' -test_expect_success \ - 'listing tags using a non-matching pattern should succeed' \ - 'git tag -l xxx' +test_expect_success 'listing tags using a non-matching pattern should succeed' ' + git tag -l xxx +' -test_expect_success \ - 'listing tags using a non-matching pattern should output nothing' \ - 'test $(git tag -l xxx | wc -l) -eq 0' +test_expect_success 'listing tags using a non-matching pattern should output nothing' ' + test $(git tag -l xxx | wc -l) -eq 0 +' # special cases for creating tags: -test_expect_success \ - 'trying to create a tag with the name of one existing should fail' \ - 'test_must_fail git tag mytag' +test_expect_success 'trying to create a tag with the name of one existing should fail' ' + test_must_fail git tag mytag +' -test_expect_success \ - 'trying to create a tag with a non-valid name should fail' ' +test_expect_success 'trying to create a tag with a non-valid name should fail' ' test $(git tag -l | wc -l) -eq 1 && test_must_fail git tag "" && test_must_fail git tag .othertag && @@ -201,15 +200,13 @@ cat >expect < actual && test_cmp expect actual && git tag -d && git tag -l > actual && test_cmp expect actual ' -test_expect_success \ - 'deleting two existing tags in one command should succeed' ' +test_expect_success 'deleting two existing tags in one command should succeed' ' tag_exists mytag && tag_exists myhead && git tag -d mytag myhead && @@ -217,15 +214,13 @@ test_expect_success \ ! tag_exists myhead ' -test_expect_success \ - 'creating a tag with the name of another deleted one should succeed' ' +test_expect_success 'creating a tag with the name of another deleted one should succeed' ' ! tag_exists mytag && git tag mytag && tag_exists mytag ' -test_expect_success \ - 'trying to delete two tags, existing and not, should fail in the 2nd' ' +test_expect_success 'trying to delete two tags, existing and not, should fail in the 2nd' ' tag_exists mytag && ! tag_exists myhead && test_must_fail git tag -d mytag anothertag && @@ -270,8 +265,7 @@ a1 aa1 cba EOF -test_expect_success \ - 'listing tags with substring as pattern must print those matching' ' +test_expect_success 'listing tags with substring as pattern must print those matching' ' rm *a* && git tag -l "*a*" > current && test_cmp expect current @@ -281,8 +275,7 @@ cat >expect < actual && test_cmp expect actual ' @@ -291,8 +284,7 @@ cat >expect < actual && test_cmp expect actual ' @@ -300,8 +292,7 @@ test_expect_success \ cat >expect < actual && test_cmp expect actual ' @@ -309,8 +300,7 @@ test_expect_success \ cat >expect < actual && test_cmp expect actual ' @@ -319,14 +309,12 @@ cat >expect < actual && test_cmp expect actual ' -test_expect_success \ - 'listing tags using v.* should print nothing because none have v.' ' +test_expect_success 'listing tags using v.* should print nothing because none have v.' ' git tag -l "v.*" > actual && test_must_be_empty actual ' @@ -337,8 +325,7 @@ v1.0 v1.0.1 v1.1.3 EOF -test_expect_success \ - 'listing tags using v* should print only those having v' ' +test_expect_success 'listing tags using v* should print only those having v' ' git tag -l "v*" > actual && test_cmp expect actual ' @@ -404,8 +391,7 @@ EOF # creating and verifying lightweight tags: -test_expect_success \ - 'a non-annotated tag created without parameters should point to HEAD' ' +test_expect_success 'a non-annotated tag created without parameters should point to HEAD' ' git tag non-annotated-tag && test $(git cat-file -t non-annotated-tag) = commit && test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD) @@ -414,13 +400,13 @@ test_expect_success \ test_expect_success 'trying to verify an unknown tag should fail' \ 'test_must_fail git tag -v unknown-tag' -test_expect_success \ - 'trying to verify a non-annotated and non-signed tag should fail' \ - 'test_must_fail git tag -v non-annotated-tag' +test_expect_success 'trying to verify a non-annotated and non-signed tag should fail' ' + test_must_fail git tag -v non-annotated-tag +' -test_expect_success \ - 'trying to verify many non-annotated or unknown tags, should fail' \ - 'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2' +test_expect_success 'trying to verify many non-annotated or unknown tags, should fail' ' + test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2 +' # creating annotated tags: @@ -444,8 +430,7 @@ time=$test_tick get_tag_header annotated-tag $commit commit $time >expect echo "A message" >>expect -test_expect_success \ - 'creating an annotated tag with -m message should succeed' ' +test_expect_success 'creating an annotated tag with -m message should succeed' ' git tag -m "A message" annotated-tag && get_tag_msg annotated-tag >actual && test_cmp expect actual @@ -459,8 +444,7 @@ test_expect_success 'set up editor' ' mv "$1-" "$1" EOF ' -test_expect_success \ - 'creating an annotated tag with -m message --edit should succeed' ' +test_expect_success 'creating an annotated tag with -m message --edit should succeed' ' GIT_EDITOR=./fakeeditor git tag -m "A message" --edit annotated-tag-edit && get_tag_msg annotated-tag-edit >actual && test_cmp expect actual @@ -472,8 +456,7 @@ in a file. EOF get_tag_header file-annotated-tag $commit commit $time >expect cat msgfile >>expect -test_expect_success \ - 'creating an annotated tag with -F messagefile should succeed' ' +test_expect_success 'creating an annotated tag with -F messagefile should succeed' ' git tag -F msgfile file-annotated-tag && get_tag_msg file-annotated-tag >actual && test_cmp expect actual @@ -487,8 +470,7 @@ test_expect_success 'set up editor' ' mv "$1-" "$1" EOF ' -test_expect_success \ - 'creating an annotated tag with -F messagefile --edit should succeed' ' +test_expect_success 'creating an annotated tag with -F messagefile --edit should succeed' ' GIT_EDITOR=./fakeeditor git tag -F msgfile --edit file-annotated-tag-edit && get_tag_msg file-annotated-tag-edit >actual && test_cmp expect actual @@ -506,16 +488,14 @@ test_expect_success 'creating an annotated tag with -F - should succeed' ' test_cmp expect actual ' -test_expect_success \ - 'trying to create a tag with a non-existing -F file should fail' ' +test_expect_success 'trying to create a tag with a non-existing -F file should fail' ' ! test -f nonexistingfile && ! tag_exists notag && test_must_fail git tag -F nonexistingfile notag && ! tag_exists notag ' -test_expect_success \ - 'trying to create tags giving both -m or -F options should fail' ' +test_expect_success 'trying to create tags giving both -m or -F options should fail' ' echo "message file 1" >msgfile1 && echo "message file 2" >msgfile2 && ! tag_exists msgtag && @@ -524,15 +504,14 @@ test_expect_success \ test_must_fail git tag -F msgfile1 -m "message 1" msgtag && ! tag_exists msgtag && test_must_fail git tag -m "message 1" -F msgfile1 \ - -m "message 2" msgtag && + -m "message 2" msgtag && ! tag_exists msgtag ' # blank and empty messages: get_tag_header empty-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with an empty -m message should succeed' ' +test_expect_success 'creating a tag with an empty -m message should succeed' ' git tag -m "" empty-annotated-tag && get_tag_msg empty-annotated-tag >actual && test_cmp expect actual @@ -540,8 +519,7 @@ test_expect_success \ >emptyfile get_tag_header emptyfile-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with an empty -F messagefile should succeed' ' +test_expect_success 'creating a tag with an empty -F messagefile should succeed' ' git tag -F emptyfile emptyfile-annotated-tag && get_tag_msg emptyfile-annotated-tag >actual && test_cmp expect actual @@ -561,16 +539,14 @@ Trailing spaces Trailing blank lines EOF -test_expect_success \ - 'extra blanks in the message for an annotated tag should be removed' ' +test_expect_success 'extra blanks in the message for an annotated tag should be removed' ' git tag -F blanksfile blanks-annotated-tag && get_tag_msg blanks-annotated-tag >actual && test_cmp expect actual ' get_tag_header blank-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with blank -m message with spaces should succeed' ' +test_expect_success 'creating a tag with blank -m message with spaces should succeed' ' git tag -m " " blank-annotated-tag && get_tag_msg blank-annotated-tag >actual && test_cmp expect actual @@ -580,8 +556,7 @@ echo ' ' >blankfile echo '' >>blankfile echo ' ' >>blankfile get_tag_header blankfile-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with blank -F messagefile with spaces should succeed' ' +test_expect_success 'creating a tag with blank -F messagefile with spaces should succeed' ' git tag -F blankfile blankfile-annotated-tag && get_tag_msg blankfile-annotated-tag >actual && test_cmp expect actual @@ -589,8 +564,7 @@ test_expect_success \ printf ' ' >blanknonlfile get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with -F file of spaces and no newline should succeed' ' +test_expect_success 'creating a tag with -F file of spaces and no newline should succeed' ' git tag -F blanknonlfile blanknonlfile-annotated-tag && get_tag_msg blanknonlfile-annotated-tag >actual && test_cmp expect actual @@ -624,16 +598,14 @@ Another line. Last line. EOF -test_expect_success \ - 'creating a tag using a -F messagefile with #comments should succeed' ' +test_expect_success 'creating a tag using a -F messagefile with #comments should succeed' ' git tag -F commentsfile comments-annotated-tag && get_tag_msg comments-annotated-tag >actual && test_cmp expect actual ' get_tag_header comment-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with a #comment in the -m message should succeed' ' +test_expect_success 'creating a tag with a #comment in the -m message should succeed' ' git tag -m "#comment" comment-annotated-tag && get_tag_msg comment-annotated-tag >actual && test_cmp expect actual @@ -643,8 +615,7 @@ echo '#comment' >commentfile echo '' >>commentfile echo '####' >>commentfile get_tag_header commentfile-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with #comments in the -F messagefile should succeed' ' +test_expect_success 'creating a tag with #comments in the -F messagefile should succeed' ' git tag -F commentfile commentfile-annotated-tag && get_tag_msg commentfile-annotated-tag >actual && test_cmp expect actual @@ -652,8 +623,7 @@ test_expect_success \ printf '#comment' >commentnonlfile get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect -test_expect_success \ - 'creating a tag with a file of #comment and no newline should succeed' ' +test_expect_success 'creating a tag with a file of #comment and no newline should succeed' ' git tag -F commentnonlfile commentnonlfile-annotated-tag && get_tag_msg commentnonlfile-annotated-tag >actual && test_cmp expect actual @@ -661,8 +631,7 @@ test_expect_success \ # listing messages for annotated non-signed tags: -test_expect_success \ - 'listing the one-line message of a non-signed tag should succeed' ' +test_expect_success 'listing the one-line message of a non-signed tag should succeed' ' git tag -m "A msg" tag-one-line && echo "tag-one-line" >expect && @@ -701,8 +670,7 @@ test_expect_success 'The -n 100 invocation means -n --list 100, not -n100' ' test_cmp expect actual ' -test_expect_success \ - 'listing the zero-lines message of a non-signed tag should succeed' ' +test_expect_success 'listing the zero-lines message of a non-signed tag should succeed' ' git tag -m "" tag-zero-lines && echo "tag-zero-lines" >expect && @@ -729,8 +697,7 @@ test_expect_success \ echo 'tag line one' >annotagmsg echo 'tag line two' >>annotagmsg echo 'tag line three' >>annotagmsg -test_expect_success \ - 'listing many message lines of a non-signed tag should succeed' ' +test_expect_success 'listing many message lines of a non-signed tag should succeed' ' git tag -F annotagmsg tag-lines && echo "tag-lines" >expect && @@ -1372,13 +1339,11 @@ test_expect_success GPG \ 'verify signed tag fails when public key is not present' \ 'test_must_fail git tag -v signed-tag' -test_expect_success \ - 'git tag -a fails if tag annotation is empty' ' +test_expect_success 'git tag -a fails if tag annotation is empty' ' ! (GIT_EDITOR=cat git tag -a initial-comment) ' -test_expect_success \ - 'message in editor has initial comment' ' +test_expect_success 'message in editor has initial comment' ' ! (GIT_EDITOR=cat git tag -a initial-comment > actual) ' @@ -1389,8 +1354,7 @@ test_expect_success 'message in editor has initial comment: first line' ' test_i18ncmp first.expect first.actual ' -test_expect_success \ - 'message in editor has initial comment: remainder' ' +test_expect_success 'message in editor has initial comment: remainder' ' # remove commented lines from the remainder -- should be empty sed -e 1d -e "/^#/d" rest.actual && test_must_be_empty rest.actual @@ -1398,8 +1362,7 @@ test_expect_success \ get_tag_header reuse $commit commit $time >expect echo "An annotation to be reused" >> expect -test_expect_success \ - 'overwriting an annoted tag should use its previous body' ' +test_expect_success 'overwriting an annoted tag should use its previous body' ' git tag -a -m "An annotation to be reused" reuse && GIT_EDITOR=true git tag -f -a reuse && get_tag_msg reuse >actual && From patchwork Fri Sep 21 23:58:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10611221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15DA015E8 for ; Fri, 21 Sep 2018 23:59:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 061A92DEA8 for ; Fri, 21 Sep 2018 23:59:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE4DF2DEAE; Fri, 21 Sep 2018 23:59:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A6652DEA8 for ; Fri, 21 Sep 2018 23:59:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391641AbeIVFuX (ORCPT ); Sat, 22 Sep 2018 01:50:23 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:48117 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725756AbeIVFuX (ORCPT ); Sat, 22 Sep 2018 01:50:23 -0400 Received: by mail-qk1-f202.google.com with SMTP id u195-v6so14741677qka.14 for ; Fri, 21 Sep 2018 16:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=jZKkAGz2INWqdD6E1auo1nbOQOB/JsdJ+G3fxcI67kM=; b=OEslp3/C3s8OaUerNdxRRu5k07YOIZ1SgcYYQ9vpkDBrM08toFCpJu+4xLym/4g7Na 54gcoctMWoB+RM+LPw+eDrWuKeveODwHhcX1K+1eKcs2LJACjO8INH06wOL0Zopo3QFG tmFDybFcrftLHlakR7+dqdIQCJ0x7UL20UTLqgADkLY4AIbp1dCvCl26QU9n4G8hPYro usAvcpVTpQzoRNFL6gZOaGxTk1tWt17ckONWuNLe/E/LRZocXrHlRnW1HtapyrZXUKGV QuXqlZwlnFz7RI0kE5qxhETz6q3pCIxw3XXbwNjwRbXdVgwXNQt6o49K+08G0b0YlxDU 7PuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=jZKkAGz2INWqdD6E1auo1nbOQOB/JsdJ+G3fxcI67kM=; b=WJUNExzbSwP+e4Fviu3gJJkMYz2LD3GmYj5Zp8fgdloYoWcMsZctuxBhAo3XvrkQU3 b9CQ0FKKsYAOlwRVcEuE70R8atoL8tjBNSqmLfI61Ga3Tvso6HmpldTnQNxEj5j+c4uF vEEeTRdbxgwehCZhsNcbJfqgaYsSW9YmUXcQ3rjeeqs13zbbUwAosDPlHVNu0If5H5An bo5iYbg0cV0GDMg1mUNq0K10L5OllhMFiI1atLgWxCY9z0I7iaI03/vcYhdFjtxsUA6m m/7EFu16QW6LeYL/FaLnSnJ6IeOowTcyCjWJJt89JkjhOduj7sxMCt138qKT4DPlXVxX d1cA== X-Gm-Message-State: APzg51AAqjWcfFH+gswnM2R1IA32frm1kQporyUDZexhDN2UWCTHkVlI ildtpPpVwmFRWokhTVj8Zh67C4GAACXnGwK+acAN1ZVZooPWqXrkN+jfnnDbbjQh4cvMhfcXsLI 7M0KjYQ7+5KWVjhaKsLohpxp2TsS00RkpFLJ24x43RgCNxYTbh0rhpLmwrbGS X-Google-Smtp-Source: ACcGV60L8fN6sSzUTDxYFLKMGwZNy9uPEMukzlIxdcgv2ef2zI9RWa40uB67fmmuB5OxK05Ikvgvjx4FvEJ5 X-Received: by 2002:aed:3cd8:: with SMTP id e24-v6mr17779qtf.55.1537574348862; Fri, 21 Sep 2018 16:59:08 -0700 (PDT) Date: Fri, 21 Sep 2018 16:58:33 -0700 In-Reply-To: <20180921235833.99045-1-sbeller@google.com> Message-Id: <20180921235833.99045-4-sbeller@google.com> Mime-Version: 1.0 References: <20180921235833.99045-1-sbeller@google.com> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH 3/3] t0030: reformat style From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Stefan Beller --- t/t0030-stripspace.sh | 525 ++++++++++++++++++++---------------------- 1 file changed, 254 insertions(+), 271 deletions(-) diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index 5ce47e8af51..c2281a39b58 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -12,379 +12,362 @@ s40=' ' sss="$s40$s40$s40$s40$s40$s40$s40$s40$s40$s40" # 400 ttt="$t40$t40$t40$t40$t40$t40$t40$t40$t40$t40" # 400 -test_expect_success \ - 'long lines without spaces should be unchanged' ' - echo "$ttt" >expect && - git stripspace actual && - test_cmp expect actual && - - echo "$ttt$ttt" >expect && - git stripspace actual && - test_cmp expect actual && - - echo "$ttt$ttt$ttt" >expect && - git stripspace actual && - test_cmp expect actual && - - echo "$ttt$ttt$ttt$ttt" >expect && - git stripspace actual && - test_cmp expect actual +test_expect_success 'long lines without spaces should be unchanged' ' + echo "$ttt" >expect && + git stripspace actual && + test_cmp expect actual && + + echo "$ttt$ttt" >expect && + git stripspace actual && + test_cmp expect actual && + + echo "$ttt$ttt$ttt" >expect && + git stripspace actual && + test_cmp expect actual && + + echo "$ttt$ttt$ttt$ttt" >expect && + git stripspace actual && + test_cmp expect actual ' -test_expect_success \ - 'lines with spaces at the beginning should be unchanged' ' - echo "$sss$ttt" >expect && - git stripspace actual && - test_cmp expect actual && +test_expect_success 'lines with spaces at the beginning should be unchanged' ' + echo "$sss$ttt" >expect && + git stripspace actual && + test_cmp expect actual && - echo "$sss$sss$ttt" >expect && - git stripspace actual && - test_cmp expect actual && + echo "$sss$sss$ttt" >expect && + git stripspace actual && + test_cmp expect actual && - echo "$sss$sss$sss$ttt" >expect && - git stripspace actual && - test_cmp expect actual + echo "$sss$sss$sss$ttt" >expect && + git stripspace actual && + test_cmp expect actual ' -test_expect_success \ - 'lines with intermediate spaces should be unchanged' ' - echo "$ttt$sss$ttt" >expect && - git stripspace actual && - test_cmp expect actual && +test_expect_success 'lines with intermediate spaces should be unchanged' ' + echo "$ttt$sss$ttt" >expect && + git stripspace actual && + test_cmp expect actual && - echo "$ttt$sss$sss$ttt" >expect && - git stripspace actual && - test_cmp expect actual + echo "$ttt$sss$sss$ttt" >expect && + git stripspace actual && + test_cmp expect actual ' -test_expect_success \ - 'consecutive blank lines should be unified' ' - printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'consecutive blank lines should be unified' ' + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt$ttt\n" > expect && - printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$ttt$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && - printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual ' -test_expect_success \ - 'only consecutive blank lines should be completely removed' ' +test_expect_success 'only consecutive blank lines should be completely removed' ' - printf "\n" | git stripspace >actual && - test_must_be_empty actual && + printf "\n" | git stripspace >actual && + test_must_be_empty actual && - printf "\n\n\n" | git stripspace >actual && - test_must_be_empty actual && + printf "\n\n\n" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss\n$sss\n$sss\n" | git stripspace >actual && - test_must_be_empty actual && + printf "$sss\n$sss\n$sss\n" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss$sss\n$sss\n\n" | git stripspace >actual && - test_must_be_empty actual && + printf "$sss$sss\n$sss\n\n" | git stripspace >actual && + test_must_be_empty actual && - printf "\n$sss\n$sss$sss\n" | git stripspace >actual && - test_must_be_empty actual && + printf "\n$sss\n$sss$sss\n" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual && - test_must_be_empty actual && + printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual && + test_must_be_empty actual && - printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual && - test_must_be_empty actual && + printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual && + test_must_be_empty actual && - printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual && - test_must_be_empty actual + printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual && + test_must_be_empty actual ' -test_expect_success \ - 'consecutive blank lines at the beginning should be removed' ' - printf "$ttt\n" > expect && - printf "\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'consecutive blank lines at the beginning should be removed' ' + printf "$ttt\n" > expect && + printf "\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" > expect && - printf "\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n" > expect && + printf "\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" > expect && + printf "$ttt\n" > expect && - printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual && - test_cmp expect actual + printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual && + test_cmp expect actual ' -test_expect_success \ - 'consecutive blank lines at the end should be removed' ' - printf "$ttt\n" > expect && - printf "$ttt\n\n" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'consecutive blank lines at the end should be removed' ' + printf "$ttt\n" > expect && + printf "$ttt\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" > expect && - printf "$ttt\n\n\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n" > expect && + printf "$ttt\n\n\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n" > expect && - printf "$ttt$ttt\n\n\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n" > expect && + printf "$ttt$ttt\n\n\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt\n" > expect && - printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt$ttt\n" > expect && - printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt$ttt$ttt\n" > expect && + printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" > expect && + printf "$ttt\n" > expect && - printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual && - test_cmp expect actual + printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual && + test_cmp expect actual ' -test_expect_success \ - 'text without newline at end should end with newline' ' - test $(printf "$ttt" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 +test_expect_success 'text without newline at end should end with newline' ' + test $(printf "$ttt" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 ' # text plus spaces at the end: -test_expect_success \ - 'text plus spaces without newline at end should end with newline' ' - test $(printf "$ttt$sss" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && - test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0 +test_expect_success 'text plus spaces without newline at end should end with newline' ' + test $(printf "$ttt$sss" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && + test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0 ' -test_expect_success \ - 'text plus spaces without newline at end should not show spaces' ' - ! (printf "$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null) +test_expect_success 'text plus spaces without newline at end should not show spaces' ' + ! (printf "$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null) ' -test_expect_success \ - 'text plus spaces without newline should show the correct lines' ' - printf "$ttt\n" >expect && - printf "$ttt$sss" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'text plus spaces without newline should show the correct lines' ' + printf "$ttt\n" >expect && + printf "$ttt$sss" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" >expect && - printf "$ttt$sss$sss" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n" >expect && + printf "$ttt$sss$sss" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n" >expect && - printf "$ttt$sss$sss$sss" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n" >expect && + printf "$ttt$sss$sss$sss" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n" >expect && - printf "$ttt$ttt$sss" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n" >expect && + printf "$ttt$ttt$sss" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n" >expect && - printf "$ttt$ttt$sss$sss" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n" >expect && + printf "$ttt$ttt$sss$sss" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt$ttt\n" >expect && - printf "$ttt$ttt$ttt$sss" | git stripspace >actual && - test_cmp expect actual + printf "$ttt$ttt$ttt\n" >expect && + printf "$ttt$ttt$ttt$sss" | git stripspace >actual && + test_cmp expect actual ' -test_expect_success \ - 'text plus spaces at end should not show spaces' ' - ! (echo "$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (echo "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && - ! (echo "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (echo "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null) +test_expect_success 'text plus spaces at end should not show spaces' ' + ! (echo "$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (echo "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) && + ! (echo "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (echo "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null) ' -test_expect_success \ - 'text plus spaces at end should be cleaned and newline must remain' ' - echo "$ttt" >expect && - echo "$ttt$sss" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'text plus spaces at end should be cleaned and newline must remain' ' + echo "$ttt" >expect && + echo "$ttt$sss" | git stripspace >actual && + test_cmp expect actual && - echo "$ttt" >expect && - echo "$ttt$sss$sss" | git stripspace >actual && - test_cmp expect actual && + echo "$ttt" >expect && + echo "$ttt$sss$sss" | git stripspace >actual && + test_cmp expect actual && - echo "$ttt" >expect && - echo "$ttt$sss$sss$sss" | git stripspace >actual && - test_cmp expect actual && + echo "$ttt" >expect && + echo "$ttt$sss$sss$sss" | git stripspace >actual && + test_cmp expect actual && - echo "$ttt$ttt" >expect && - echo "$ttt$ttt$sss" | git stripspace >actual && - test_cmp expect actual && + echo "$ttt$ttt" >expect && + echo "$ttt$ttt$sss" | git stripspace >actual && + test_cmp expect actual && - echo "$ttt$ttt" >expect && - echo "$ttt$ttt$sss$sss" | git stripspace >actual && - test_cmp expect actual && + echo "$ttt$ttt" >expect && + echo "$ttt$ttt$sss$sss" | git stripspace >actual && + test_cmp expect actual && - echo "$ttt$ttt$ttt" >expect && - echo "$ttt$ttt$ttt$sss" | git stripspace >actual && - test_cmp expect actual + echo "$ttt$ttt$ttt" >expect && + echo "$ttt$ttt$ttt$sss" | git stripspace >actual && + test_cmp expect actual ' # spaces only: -test_expect_success \ - 'spaces with newline at end should be replaced with empty string' ' - echo | git stripspace >actual && - test_must_be_empty actual && +test_expect_success 'spaces with newline at end should be replaced with empty string' ' + echo | git stripspace >actual && + test_must_be_empty actual && - echo "$sss" | git stripspace >actual && - test_must_be_empty actual && + echo "$sss" | git stripspace >actual && + test_must_be_empty actual && - echo "$sss$sss" | git stripspace >actual && - test_must_be_empty actual && + echo "$sss$sss" | git stripspace >actual && + test_must_be_empty actual && - echo "$sss$sss$sss" | git stripspace >actual && - test_must_be_empty actual && + echo "$sss$sss$sss" | git stripspace >actual && + test_must_be_empty actual && - echo "$sss$sss$sss$sss" | git stripspace >actual && - test_must_be_empty actual + echo "$sss$sss$sss$sss" | git stripspace >actual && + test_must_be_empty actual ' -test_expect_success \ - 'spaces without newline at end should not show spaces' ' - ! (printf "" | git stripspace | grep " " >/dev/null) && - ! (printf "$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) && - ! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null) +test_expect_success 'spaces without newline at end should not show spaces' ' + ! (printf "" | git stripspace | grep " " >/dev/null) && + ! (printf "$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) && + ! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null) ' -test_expect_success \ - 'spaces without newline at end should be replaced with empty string' ' - printf "" | git stripspace >actual && - test_must_be_empty actual && +test_expect_success 'spaces without newline at end should be replaced with empty string' ' + printf "" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss$sss" | git stripspace >actual && - test_must_be_empty actual && + printf "$sss$sss" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss$sss$sss" | git stripspace >actual && - test_must_be_empty actual && + printf "$sss$sss$sss" | git stripspace >actual && + test_must_be_empty actual && - printf "$sss$sss$sss$sss" | git stripspace >actual && - test_must_be_empty actual + printf "$sss$sss$sss$sss" | git stripspace >actual && + test_must_be_empty actual ' -test_expect_success \ - 'consecutive text lines should be unchanged' ' - printf "$ttt$ttt\n$ttt\n" >expect && - printf "$ttt$ttt\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && +test_expect_success 'consecutive text lines should be unchanged' ' + printf "$ttt$ttt\n$ttt\n" >expect && + printf "$ttt$ttt\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$ttt$ttt\n$ttt\n" >expect && - printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$ttt$ttt\n$ttt\n" >expect && + printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect && - printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect && + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect && - printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect && + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect && - printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual && - test_cmp expect actual && + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect && + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual && + test_cmp expect actual && - printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect && - printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual && - test_cmp expect actual + printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect && + printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual && + test_cmp expect actual ' test_expect_success 'strip comments, too' '