From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 965E6203C2 for ; Sat, 16 Jul 2016 05:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751374AbcGPFG4 (ORCPT ); Sat, 16 Jul 2016 01:06:56 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36334 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750871AbcGPFGr (ORCPT ); Sat, 16 Jul 2016 01:06:47 -0400 Received: by mail-lf0-f66.google.com with SMTP id 33so8089333lfw.3 for ; Fri, 15 Jul 2016 22:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kAB0M0FFD7AqgLeBi+3hTUFiQhpIq7PVxLcU0cMBvno=; b=yMHtAhFUweLor8Binwwa9cKGb9iQPkODtce74Z6xChtMigwTur3TZcC8WA0iBJPkZx Iyjy4cU0xIRtKVBDUdz8ji1JDgHmJYzxkX8iTy192XXaIJpNn6OF1jWep8uglpChM7Sk T86jK3TeUDUBSqVMntQrHWj2oE60jAjCnSe+ex+iPrpST87SmKPx6eV3F0WKkY4clGl+ 25vxgVF6qW7dqTey5BVPrHXH+4Ufh0Fx7cfXqsb17ujijMrqmxe1gRtLn9JFGyolwfu4 JNZHXTBreiLzASnCuGWYtYWlUDZoHu/PFBosq16ZrqPg5bRJ3FigRetpbp4SxrTXeVg3 q0Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kAB0M0FFD7AqgLeBi+3hTUFiQhpIq7PVxLcU0cMBvno=; b=AJqGrqOpRWv+EbyAVuUrt/ljQEBbOnwGJBySXj2/w+ecLEnv/FsDge/73wMRPrnxWT DCD1dHsb3JcReDKszZRUuY74CdV85YimFhbcnGI9n8cldmqWxNeZubyuygmQMhNiNEuf Yoc+6p2tmUdBwDAn6bQPlxoKtNiqiTA1V+om3fE6zqwqcFe3R5QbVOO2hjU8gNjo55iz kb8P2GKc4mKcyFGbnmxWv/8ili5XE5LrcFenf1YcNKJOEAKUNhb6CRq0RAf+M/JWv3fu o/+L8Qa9vhQc6DXsoM4CmuqN7G+ip/HUXVEU5SzlMP1YUZi2I+eoysv8upx3jPi8dmz4 B3mw== X-Gm-Message-State: ALyK8tLoA94rQQYVP1G3kqABBZ7/bjpPMB3APSpt3sf7U9UCz4rG/Mn7JqLID0Xx3nxWWw== X-Received: by 10.46.5.9 with SMTP id 9mr7829199ljf.17.1468645605264; Fri, 15 Jul 2016 22:06:45 -0700 (PDT) Received: from duynguyen.does.not.exist (10.219.241.83.in-addr.dgcsystems.net. [83.241.219.10]) by smtp.gmail.com with ESMTPSA id g40sm634654ljg.22.2016.07.15.22.06.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jul 2016 22:06:44 -0700 (PDT) From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: git@vger.kernel.org Cc: Junio C Hamano , yuri.kanivetsky@gmail.com, =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Subject: [PATCH v4 2/4] test-lib.sh: introduce and use $EMPTY_BLOB Date: Sat, 16 Jul 2016 07:06:25 +0200 Message-Id: <20160716050627.9416-3-pclouds@gmail.com> X-Mailer: git-send-email 2.9.1.566.gbd532d4 In-Reply-To: <20160716050627.9416-1-pclouds@gmail.com> References: <20160709052356.30570-1-pclouds@gmail.com> <20160716050627.9416-1-pclouds@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Similar to $EMPTY_TREE this makes it easier to recognize this special SHA-1 and change hash later. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t1011-read-tree-sparse-checkout.sh | 8 ++++---- t/t1700-split-index.sh | 24 ++++++++++++------------ t/t3102-ls-tree-wildcards.sh | 8 ++++---- t/t7011-skip-worktree-reading.sh | 12 +++++------- t/t7012-skip-worktree-writing.sh | 10 ++++------ t/t7063-status-untracked-cache.sh | 6 +++--- t/t7508-status.sh | 2 +- t/test-lib.sh | 3 ++- 8 files changed, 35 insertions(+), 38 deletions(-) diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh index 0c74bee..2563d18 100755 --- a/t/t1011-read-tree-sparse-checkout.sh +++ b/t/t1011-read-tree-sparse-checkout.sh @@ -15,11 +15,11 @@ test_description='sparse checkout tests . "$TEST_DIRECTORY"/lib-read-tree.sh test_expect_success 'setup' ' - cat >expected <<-\EOF && + cat >expected <<-EOF && 100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/added - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/addedtoo - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 subsub/added + 100644 $EMPTY_BLOB 0 sub/added + 100644 $EMPTY_BLOB 0 sub/addedtoo + 100644 $EMPTY_BLOB 0 subsub/added EOF cat >expected.swt <<-\EOF && H init.t diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh index 8aef49f..292a072 100755 --- a/t/t1700-split-index.sh +++ b/t/t1700-split-index.sh @@ -33,14 +33,14 @@ test_expect_success 'add one file' ' git update-index --add one && git ls-files --stage >ls-files.actual && cat >ls-files.expect <actual && cat >expect <ls-files.actual && cat >ls-files.expect <ls-files.actual && cat >ls-files.expect <ls-files.actual && cat >ls-files.expect <expect <ls-files.actual && cat >ls-files.expect <actual && cat >expect <actual && cat >expect <ls-files.actual && cat >ls-files.expect <expect <<-\EOF && - 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a[a]/three + cat >expect <<-EOF && + 100644 blob $EMPTY_BLOB a[a]/three EOF git ls-tree -r HEAD "a[a]" >actual && test_cmp expect actual ' test_expect_success 'ls-tree outside prefix' ' - cat >expect <<-\EOF && - 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ../a[a]/three + cat >expect <<-EOF && + 100644 blob $EMPTY_BLOB ../a[a]/three EOF ( cd aa && git ls-tree -r HEAD "../a[a]"; ) >actual && test_cmp expect actual diff --git a/t/t7011-skip-worktree-reading.sh b/t/t7011-skip-worktree-reading.sh index 88d60c1..84f4145 100755 --- a/t/t7011-skip-worktree-reading.sh +++ b/t/t7011-skip-worktree-reading.sh @@ -23,17 +23,15 @@ S sub/1 H sub/2 EOF -NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 - setup_absent() { test -f 1 && rm 1 git update-index --remove 1 && - git update-index --add --cacheinfo 100644 $NULL_SHA1 1 && + git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && git update-index --skip-worktree 1 } test_absent() { - echo "100644 $NULL_SHA1 0 1" > expected && + echo "100644 $EMPTY_BLOB 0 1" > expected && git ls-files --stage 1 > result && test_cmp expected result && test ! -f 1 @@ -42,12 +40,12 @@ test_absent() { setup_dirty() { git update-index --force-remove 1 && echo dirty > 1 && - git update-index --add --cacheinfo 100644 $NULL_SHA1 1 && + git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && git update-index --skip-worktree 1 } test_dirty() { - echo "100644 $NULL_SHA1 0 1" > expected && + echo "100644 $EMPTY_BLOB 0 1" > expected && git ls-files --stage 1 > result && test_cmp expected result && echo dirty > expected @@ -120,7 +118,7 @@ test_expect_success 'grep with skip-worktree file' ' test "$(git grep --no-ext-grep test)" = "1:test" ' -echo ":000000 100644 $_z40 $NULL_SHA1 A 1" > expected +echo ":000000 100644 $_z40 $EMPTY_BLOB A 1" > expected test_expect_success 'diff-index does not examine skip-worktree absent entries' ' setup_absent && git diff-index HEAD -- 1 > result && diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh index 9ceaa40..9d1abe5 100755 --- a/t/t7012-skip-worktree-writing.sh +++ b/t/t7012-skip-worktree-writing.sh @@ -53,17 +53,15 @@ test_expect_success 'read-tree removes worktree, dirty case' ' git update-index --no-skip-worktree added ' -NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 - setup_absent() { test -f 1 && rm 1 git update-index --remove 1 && - git update-index --add --cacheinfo 100644 $NULL_SHA1 1 && + git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && git update-index --skip-worktree 1 } test_absent() { - echo "100644 $NULL_SHA1 0 1" > expected && + echo "100644 $EMPTY_BLOB 0 1" > expected && git ls-files --stage 1 > result && test_cmp expected result && test ! -f 1 @@ -72,12 +70,12 @@ test_absent() { setup_dirty() { git update-index --force-remove 1 && echo dirty > 1 && - git update-index --add --cacheinfo 100644 $NULL_SHA1 1 && + git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && git update-index --skip-worktree 1 } test_dirty() { - echo "100644 $NULL_SHA1 0 1" > expected && + echo "100644 $EMPTY_BLOB 0 1" > expected && git ls-files --stage 1 > result && test_cmp expected result && echo dirty > expected diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh index a971884..a828a5f 100755 --- a/t/t7063-status-untracked-cache.sh +++ b/t/t7063-status-untracked-cache.sh @@ -53,7 +53,7 @@ A two EOF cat >../dump.expect <../actual && cat >../expect <../actual && cat >../expect <expect <