From patchwork Fri Oct 18 22:04:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DA2A19A1 for ; Fri, 18 Oct 2019 22:04:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEC19222D3 for ; Fri, 18 Oct 2019 22:04:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oh8QtdWS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbfJRWEK (ORCPT ); Fri, 18 Oct 2019 18:04:10 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36619 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbfJRWEJ (ORCPT ); Fri, 18 Oct 2019 18:04:09 -0400 Received: by mail-pg1-f195.google.com with SMTP id 23so4083424pgk.3 for ; Fri, 18 Oct 2019 15:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bbf9inHo0I4t73aUKSW0KXTGxunKjYwC2acEh6a5lp8=; b=Oh8QtdWSzoc0KeXwXNnyEZl45WMsgukbU4dEuGEK7W25y66IO1XPDsodMqj3sUei4q Ul79xrAJhQmSUKdJI6Scx4tlFBRDML9hH0DWMiuakjDlW+s/7EHSjPydhBc504HT+Sn0 OE6VhegbKJdIPzIvgfy+x6086dWUygQwWePfPkbGxQohPqwS8QF4WGiBbHrwBwK1CiDQ KsULsal/kZToErgvyN2uNhFg04mf0/3Q7e+31Vivmr1P969CB3cYnS0IgUzBeK7F60Px H2W69TgRupa7qgydg4qUV516TKWQx6DBomrO0YDPOZeufp+UcN1ldcza3Hf0Io0xZ0RB +L7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bbf9inHo0I4t73aUKSW0KXTGxunKjYwC2acEh6a5lp8=; b=rQRN8vA64LGxnI0KrRpj4wnb9U5M5OyrHAFr3wgDd3QKokOcne4TZzum8eBIR/h7Uk q3ro1svV9Z1Jefvsi17Tej5tSuL8fajjfzS4dYGUn2SmSAerViPT0MAPsJCu3hC8wsO3 K5szcT3635tycHGa0PPj9356IXf33km/ugWK5u9EOXsPiMUhl8DquOn7jhP1VjLBGNJQ EbZCFwRq6tFpn4NvpE7JLfHI3eUsc74LR3OWwV/iPLwQaS52Bk5JHU2qybLHh+08BASR jvB+xHZT2cHvjir+IdkZIpe2MNna0PVhPR46f5jPe9iffH2d5XBJtEKuUy3Use4At5UY DshA== X-Gm-Message-State: APjAAAW4siNXXyxrVfkYpNn+4fVrMPWpJgBCagKFIOCtQvoa9CzYR5Om mSq4kfKeKipfoJVQ6wBqtGb5QH2O X-Google-Smtp-Source: APXvYqx6679xEnjABmYssjePQvtJmLOrVjOnGpuj9rUU0EQ2FpOrID1GEYHjGX3RycFCMQirv8YKPg== X-Received: by 2002:a17:90a:23b0:: with SMTP id g45mr13073597pje.127.1571436248365; Fri, 18 Oct 2019 15:04:08 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 206sm6750715pge.80.2019.10.18.15.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:04:07 -0700 (PDT) Date: Fri, 18 Oct 2019 15:04:06 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 01/15] t7408: replace `test_must_fail test_path_is_file` Message-ID: <987fee4652ae1bd8d3eb50ed51f7c9694d567dfc.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org According to t/README, test_must_fail() should only be used to test for failure in git commands. Replace the only invocation of `test_must_fail test_path_is_file` with `test_path_is_missing` since in this test case, the path should not exist at all. Signed-off-by: Denton Liu --- t/t7408-submodule-reference.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh index 34ac28c056..9e62d43cac 100755 --- a/t/t7408-submodule-reference.sh +++ b/t/t7408-submodule-reference.sh @@ -123,7 +123,7 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat test_must_fail git submodule update --init && # and we have no alternates: test_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub && - test_must_fail test_path_is_file sub/file1 + test_path_is_missing sub/file1 ) ' From patchwork Fri Oct 18 22:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74415112B for ; Fri, 18 Oct 2019 22:12:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 492EE2246F for ; Fri, 18 Oct 2019 22:12:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dwSamf8O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391439AbfJRWMM (ORCPT ); Fri, 18 Oct 2019 18:12:12 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42909 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390067AbfJRWKY (ORCPT ); Fri, 18 Oct 2019 18:10:24 -0400 Received: by mail-pg1-f195.google.com with SMTP id f14so4067630pgi.9 for ; Fri, 18 Oct 2019 15:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UX+VZk0QQaKTngJZjkzDxOa8HNh61474k9NXQNCELQY=; b=dwSamf8OvRchljafoRfpoTvXu1DlRd+iw1Jwy7ZTaVqHIl9kZzT3KVH1pnmxbJ29P5 OGKcrC0XIgEV3rJfbrL6Ud1ngyNZHELsHgzcXpAb0xNAklEQdYifgADAoU0KetxtNurR DBFvhnCoOHXRnBMvtM4Yq2RQ6eQKfiM56yLuouXeB9fQgCtoOdc7vpeCT3yXeZlnD7jX gmGD2onLTmt5hvXT5PK/dro9TjdIyPNErW2do3ZgUGf4ikDnCmn68Jun7phjuUSqvHlz WTu8WQ51UJPuY0gTO8ktr5++zOEG6IIo/WFLuAeHfcVQenVUMtkmKgzl5y58RqzslCT0 XVpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UX+VZk0QQaKTngJZjkzDxOa8HNh61474k9NXQNCELQY=; b=dNhRT3fADo32ebHDTevXV0R4CDrWfjLYTlzYDSRJ+A/fvFboooUVni58jmHEWiSu5G +uDMDQN6mVjIr2vjh0sde64rqb9MBQEGNl8Iz6OQyTZaXSPk/cZqUC7XiuSh5ODL6iLX 6DA7JwPiFYcUe+6xF0HIhiwCHYVGdiAdP2oENoxj8wc1wkm0abnv3/KHXUTPjtdYlsxj GjsNoQGkULIT9EK4g1XYFyWgXcrEqovx/QE3ShYt5v6BibCWd8w9NwS3F2OUv4GJXDzW o3x9ikW0mwlJmR8ZNXLrp5qNKQcuvEbD/sO41GpbGF+KzX/SFDAUZJmgv+gaZhSKaRZE AEbQ== X-Gm-Message-State: APjAAAUNN4yY0VOb1TxqVUXQ10XFhfxnop9wooVP73y/YnlqmaC2rjXw EYlZOklPp3/o1397Obv/6Z6eNvAP X-Google-Smtp-Source: APXvYqyJZCLM8lO/3WbiuZ5mT+rHJsE3mQs+YrQVmEjb4afnrb29kg79cHOiIIqLNdJ1NgYfZPx+zw== X-Received: by 2002:aa7:955a:: with SMTP id w26mr9569314pfq.193.1571436623595; Fri, 18 Oct 2019 15:10:23 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id o64sm15771698pjb.24.2019.10.18.15.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:22 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:21 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 02/15] t: teach test_cmp_rev to accept ! for not-equals Message-ID: <417e808466ee3e61a1719faa319fe0e796d5d271.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently, in the case where we are using test_cmp_rev() to report not-equals, we write `! test_cmp_rev`. However, since test_cmp_rev() contains r1=$(git rev-parse --verify "$1") && r2=$(git rev-parse --verify "$2") && In the case where `git rev-parse` segfaults and dies unexpectedly, the failure will be ignored. Rewrite test_cmp_rev() to optionally accept "!" as the first argument to do a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !` in all tests to take advantage of this new functionality. Signed-off-by: Denton Liu --- t/t2400-worktree-add.sh | 4 ++-- t/t3400-rebase.sh | 2 +- t/t3421-rebase-topology-linear.sh | 6 +++--- t/t3430-rebase-merges.sh | 2 +- t/t3432-rebase-fast-forward.sh | 2 +- t/t3501-revert-cherry-pick.sh | 2 +- t/t3508-cherry-pick-many-commits.sh | 2 +- t/test-lib-functions.sh | 13 +++++++++++-- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index e819ba741e..52d476979b 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' ' cd foo && test_must_fail git config "branch.foo.remote" && test_must_fail git config "branch.foo.merge" && - ! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo + test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo ) ' @@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' ' cd foo && test_must_fail git config "branch.foo.remote" && test_must_fail git config "branch.foo.merge" && - ! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo + test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo ) ' diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index ab18ac5f28..f267f6cd54 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' ' pre="$(git rev-parse --verify HEAD)" && git rebase master && test_cmp_rev "$pre" ORIG_HEAD && - ! test_cmp_rev "$pre" HEAD + test_cmp_rev ! "$pre" HEAD ' test_expect_success 'rebase, with and specified as :/quuxery' ' diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh index b847064f91..325072b0a3 100755 --- a/t/t3421-rebase-topology-linear.sh +++ b/t/t3421-rebase-topology-linear.sh @@ -61,7 +61,7 @@ test_run_rebase () { test_expect_$result "rebase $* -f rewrites even if upstream is an ancestor" " reset_rebase && git rebase $* -f b e && - ! test_cmp_rev e HEAD && + test_cmp_rev ! e HEAD && test_cmp_rev b HEAD~2 && test_linear_range 'd e' b.. " @@ -78,7 +78,7 @@ test_run_rebase () { test_expect_$result "rebase $* -f rewrites even if remote upstream is an ancestor" " reset_rebase && git rebase $* -f branch-b branch-e && - ! test_cmp_rev branch-e origin/branch-e && + test_cmp_rev ! branch-e origin/branch-e && test_cmp_rev branch-b HEAD~2 && test_linear_range 'd e' branch-b.. " @@ -368,7 +368,7 @@ test_run_rebase () { test_expect_$result "rebase $* -f --root on linear history causes re-write" " reset_rebase && git rebase $* -f --root c && - ! test_cmp_rev a HEAD~2 && + test_cmp_rev ! a HEAD~2 && test_linear_range 'a b c' HEAD " } diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh index 9efcf4808a..abbdc26b1b 100755 --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' ' git merge --allow-unrelated-histories khnum && test_tick && git rebase -f -r HEAD^ && - ! test_cmp_rev HEAD^2 khnum && + test_cmp_rev ! HEAD^2 khnum && test_cmp_graph HEAD^.. <<-\EOF && * Merge branch '\''khnum'\'' into asherah |\ diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh index 034ffc7e76..92f95b57da 100755 --- a/t/t3432-rebase-fast-forward.sh +++ b/t/t3432-rebase-fast-forward.sh @@ -64,7 +64,7 @@ test_rebase_same_head_ () { test_cmp_rev \$oldhead \$newhead elif test $cmp = diff then - ! test_cmp_rev \$oldhead \$newhead + test_cmp_rev ! \$oldhead \$newhead fi " } diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index d1c68af8c5..1c51a9131d 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' ' rm -rf * && git cherry-pick initial && git diff --quiet initial && - ! test_cmp_rev initial HEAD + test_cmp_rev ! initial HEAD ' test_expect_success 'cherry-pick "-" to pick from previous branch' ' diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh index b457333e18..23070a7b73 100755 --- a/t/t3508-cherry-pick-many-commits.sh +++ b/t/t3508-cherry-pick-many-commits.sh @@ -5,7 +5,7 @@ test_description='test cherry-picking many commits' . ./test-lib.sh check_head_differs_from() { - ! test_cmp_rev HEAD "$1" + test_cmp_rev ! HEAD "$1" } check_head_equals() { diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index b299ecc326..76dce5f8ee 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1012,8 +1012,17 @@ test_must_be_empty () { fi } -# Tests that its two parameters refer to the same revision +# Tests that its two parameters refer to the same revision, or if '!' is +# provided first, that its other two parameters refer to different +# revisions. test_cmp_rev () { + local inverted_op + inverted_op='!=' + if test $# -ge 1 && test "x$1" = 'x!' + then + inverted_op='=' + shift + fi if test $# != 2 then error "bug in the test script: test_cmp_rev requires two revisions, but got $#" @@ -1021,7 +1030,7 @@ test_cmp_rev () { local r1 r2 r1=$(git rev-parse --verify "$1") && r2=$(git rev-parse --verify "$2") && - if test "$r1" != "$r2" + if test "$r1" "$inverted_op" "$r2" then cat >&4 <<-EOF error: two revisions point to different objects: From patchwork Fri Oct 18 22:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88BED1390 for ; Fri, 18 Oct 2019 22:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E64721D7C for ; Fri, 18 Oct 2019 22:12:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rFQwcJSf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390158AbfJRWK2 (ORCPT ); Fri, 18 Oct 2019 18:10:28 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35697 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390102AbfJRWK1 (ORCPT ); Fri, 18 Oct 2019 18:10:27 -0400 Received: by mail-pg1-f193.google.com with SMTP id p30so4101034pgl.2 for ; Fri, 18 Oct 2019 15:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AycKOxNnZzb7SpX4mMXXq7R3gcO6GMYw7CZIwbF9BYw=; b=rFQwcJSfXrEztQnKI0CaUnQFrHnQm3/Wa7EXpJE2aQCxpY10xTXdQMX7/5zF5FTXQh JEaZArrrWMRlfphecAkKXccnuiHiIE58G/rEiFS99pze0dNDr8iVSNxg4HPscTw5dXNX FDJcGTizWgdzTgBhk65IYq5XaqLEWyjU6md/2OvX1fFdryLZWsHCfiHm5b5bIQUX39lN 5LXWv2ecZfrJ7b33mT95dADdee6P5Ym5JqzxfPWu8ipMpzdigSq7yhkqa8fiWULXWAwa CZHQILNwK3ex+DWroQvufOYH+Lrl90CN6jF9T4MQEV5zhK0Yk8TIdz2lN8rwAIYTlm/g rmNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AycKOxNnZzb7SpX4mMXXq7R3gcO6GMYw7CZIwbF9BYw=; b=S3rsJjlYfZIYQ5beNzFASjxg8GXjxD+KBP4jib6baGJ772HYsVv05KjwhvLBv2OAI5 jdHcrpd5k/rQSBOsy2zXf+AnanEwL2WD2kV9B07oC4pj3IpVHWGcnWTvKdNYGvEDFAI+ CGwvUsyS50nB0p1MDbrf4KvDYydlY2nSZ4PmqPIGQp2I++D3yW4YDqB1AWJ0dHcy0mue e4Zz+ixuNiWCsZdMYdeU0Kyp3SpDANM5vvH1N0ajfpuf7ooHTJMFhNlqfboN34X+/DLb o7Ptz3tKWTQ0T8n1/A87VlX7CV9D8+0e8pL/iCyRm7E7Um37SJ9etI3XEjwVL1rjUoZX e6kA== X-Gm-Message-State: APjAAAVRJuZpfGM37i/ixNzx8dp/JePkearPRJ8XXtcOWWGFiUlq8kci 2yQveV7ySeWvpczYJtwGuYCGjFIU X-Google-Smtp-Source: APXvYqxxy5/jQORx4GsAKHgTS+SFsOrzeUQ07UQuFjduoZ4MByAl2EGmsOHtjN0MohKyoHzShMjaRA== X-Received: by 2002:a63:352:: with SMTP id 79mr12581443pgd.232.1571436626257; Fri, 18 Oct 2019 15:10:26 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id h1sm8103243pfk.124.2019.10.18.15.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:25 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:23 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 03/15] t5520: improve test style Message-ID: <0a569808576de4edad598edcafa9fc9a35b056a6.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Improve the test style by removing leading and trailing empty lines within test cases. Also, reformat multi-line subshells to conform to the existing style. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index cf4cc32fd0..51d6ce8aec 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m ' test_expect_success '--rebase with rebased upstream' ' - git remote add -f me . && git checkout copy && git tag copy-orig && @@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' ' git pull --rebase me copy && test "conflicting modification" = "$(cat file)" && test file = "$(cat file2)" - ' test_expect_success '--rebase -f with rebased upstream' ' @@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' ' ' test_expect_success '--rebase with rebased default upstream' ' - git update-ref refs/remotes/me/copy copy-orig && git checkout --track -b to-rebase2 me/copy && git reset --hard to-rebase-orig && git pull --rebase && test "conflicting modification" = "$(cat file)" && test file = "$(cat file2)" - ' test_expect_success 'rebased upstream + fetch + pull --rebase' ' @@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' ' ' test_expect_success 'pull --rebase dies early with dirty working directory' ' - git checkout to-rebase && git update-ref refs/remotes/me/copy copy^ && COPY="$(git rev-parse --verify me/copy)" && @@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' ' git checkout HEAD -- file && git pull && test "$COPY" != "$(git rev-parse --verify me/copy)" - ' test_expect_success 'pull --rebase works on branch yet to be born' ' git rev-parse master >expect && mkdir empty_repo && - (cd empty_repo && - git init && - git pull --rebase .. master && - git rev-parse HEAD >../actual + ( + cd empty_repo && + git init && + git pull --rebase .. master && + git rev-parse HEAD >../actual ) && test_cmp expect actual ' @@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' test_expect_success 'setup for detecting upstreamed changes' ' mkdir src && - (cd src && - git init && - printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff && - git add stuff && - git commit -m "Initial revision" + ( + cd src && + git init && + printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff && + git add stuff && + git commit -m "Initial revision" ) && git clone src dst && - (cd src && - modify s/5/43/ stuff && - git commit -a -m "5->43" && - modify s/6/42/ stuff && - git commit -a -m "Make it bigger" + ( + cd src && + modify s/5/43/ stuff && + git commit -a -m "5->43" && + modify s/6/42/ stuff && + git commit -a -m "Make it bigger" ) && - (cd dst && - modify s/5/43/ stuff && - git commit -a -m "Independent discovery of 5->43" + ( + cd dst && + modify s/5/43/ stuff && + git commit -a -m "Independent discovery of 5->43" ) ' test_expect_success 'git pull --rebase detects upstreamed changes' ' - (cd dst && - git pull --rebase && - test -z "$(git ls-files -u)" + ( + cd dst && + git pull --rebase && + test -z "$(git ls-files -u)" ) ' test_expect_success 'setup for avoiding reapplying old patches' ' - (cd dst && - test_might_fail git rebase --abort && - git reset --hard origin/master + ( + cd dst && + test_might_fail git rebase --abort && + git reset --hard origin/master ) && git clone --bare src src-replace.git && rm -rf src && mv src-replace.git src && - (cd dst && - modify s/2/22/ stuff && - git commit -a -m "Change 2" && - modify s/3/33/ stuff && - git commit -a -m "Change 3" && - modify s/4/44/ stuff && - git commit -a -m "Change 4" && - git push && - - modify s/44/55/ stuff && - git commit --amend -a -m "Modified Change 4" + ( + cd dst && + modify s/2/22/ stuff && + git commit -a -m "Change 2" && + modify s/3/33/ stuff && + git commit -a -m "Change 3" && + modify s/4/44/ stuff && + git commit -a -m "Change 4" && + git push && + + modify s/44/55/ stuff && + git commit --amend -a -m "Modified Change 4" ) ' test_expect_success 'git pull --rebase does not reapply old patches' ' - (cd dst && - test_must_fail git pull --rebase && - test 1 = $(find .git/rebase-apply -name "000*" | wc -l) + ( + cd dst && + test_must_fail git pull --rebase && + test 1 = $(find .git/rebase-apply -name "000*" | wc -l) ) ' From patchwork Fri Oct 18 22:10:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199745 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48C1F112B for ; Fri, 18 Oct 2019 22:11:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26D9420854 for ; Fri, 18 Oct 2019 22:11:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FrPkpffD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389673AbfJRWKb (ORCPT ); Fri, 18 Oct 2019 18:10:31 -0400 Received: from mail-pg1-f178.google.com ([209.85.215.178]:40620 "EHLO mail-pg1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390212AbfJRWKa (ORCPT ); Fri, 18 Oct 2019 18:10:30 -0400 Received: by mail-pg1-f178.google.com with SMTP id e13so4075958pga.7 for ; Fri, 18 Oct 2019 15:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=e95ojsHm7vmKqMzqBTVWGVgpE6h9ehNY26fnbtBrNJU=; b=FrPkpffDjG5rRWxaVDGkvd3HIgQUWxtnfQaVyCPgbX9s2rEZsM4KACNT3yT7bhQpvD Rq+wXVzbUaXurPVQ2NnxX8msW40SpvYQMbFPFY6h2zJcucPQ+/xZL3CMVQco0G7eW7RQ lI4QNFY+PKSybB8Fc7vCon07+Ndg7N2v/W2URy77gIucc4rQnfmMJBd5TSN8kYpLMGwv h4GN8H4tqFipf+mzUx2IXzoU6wkRPnprVZXERSYsF3lf3I+FuJHXOybEt/wMplRhnA3q 8obHrys5izJ+hyK/fnsVQhQRqhI+ONhzGGoch/aBXBa/U3s6pwZUpN4igVjedpE1mP2I 4/aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=e95ojsHm7vmKqMzqBTVWGVgpE6h9ehNY26fnbtBrNJU=; b=ghKQYfxYTXcT3v7sY7cckeC3xXbKiSO/gGbsomPB2tGf1VL0aW4xX9J0HH3jIwFqr4 cVJHtgME4E+b6sbUby+bMwBa612MpYlwdIPMW3v065kUOLKko5AGWFccwmmdnbVE9b25 VyddWYyeY/IRFnxQ8FJa+t2cBquTg86SA190axs4d8lMfkLRIgFtN7fm2z8GSDC//TGe 5S0OcQah2OkzB0iLjjdAzDkT/BRv8Wp7tm4s/skiTr+NSEOb6wVSIFoH/WtX9IqMyo2O NSHuhMEYBrs5MrssDeD1tiWeA+R4ZQBprB6h+rbObBLlT+6yV2MMT+AlAaz6rLxnF12y G40w== X-Gm-Message-State: APjAAAVc/IXr6pw+Toq2N3Be3e+9Syfx776Yxx7wTUWDB7IQA1+vcSCd 5PvlFUXLBzt2Id6X3CRZ7OPqaty3 X-Google-Smtp-Source: APXvYqwTFpmFOX5Fg6wZr56cFBo+SsoomNvJNBVaq6V+kkj+RrfH837QgFtB7+r9seyumX6ibDInnw== X-Received: by 2002:a63:1c03:: with SMTP id c3mr12057394pgc.198.1571436629276; Fri, 18 Oct 2019 15:10:29 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id w65sm8194019pfb.106.2019.10.18.15.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:28 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:26 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 04/15] t5520: use sq for test case names Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The usual convention is for test case names to be written between single-quotes. Change all double-quoted test case names to single-quotes except for two test case names that use variables within. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 51d6ce8aec..a3de2e19b6 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' test new = "$(git show HEAD:file2)" ' -test_expect_success "pull --rebase warns on --verify-signatures" ' +test_expect_success 'pull --rebase warns on --verify-signatures' ' git reset --hard before-rebase && git pull --rebase --verify-signatures . copy 2>err && test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && @@ -416,7 +416,7 @@ test_expect_success "pull --rebase warns on --verify-signatures" ' test_i18ngrep "ignoring --verify-signatures for rebase" err ' -test_expect_success "pull --rebase does not warn on --no-verify-signatures" ' +test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' git reset --hard before-rebase && git pull --rebase --no-verify-signatures . copy 2>err && test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && From patchwork Fri Oct 18 22:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199743 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D86191390 for ; Fri, 18 Oct 2019 22:11:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD04F22475 for ; Fri, 18 Oct 2019 22:11:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ABIZ3UDO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390372AbfJRWKe (ORCPT ); Fri, 18 Oct 2019 18:10:34 -0400 Received: from mail-pg1-f182.google.com ([209.85.215.182]:42006 "EHLO mail-pg1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390334AbfJRWKd (ORCPT ); Fri, 18 Oct 2019 18:10:33 -0400 Received: by mail-pg1-f182.google.com with SMTP id f14so4067777pgi.9 for ; Fri, 18 Oct 2019 15:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YktZpmrJifjA99PNTOVnRtSLaAx+iks0dLQmMQ/JKCw=; b=ABIZ3UDOrnViUxVX8Mfyu6RJjUOMeKU0AKOT8BVpzSU7xk0XAvOkQwSdYZXtaUC2Cs aBWZOdgJ/Kc/RjC30nA402HU1KHcd0q6uP3MqDYpGEDvphXPf//N92n2fzRzbZZvAkSD r0tFVnyAxgFzOAvzsZ+T+GaIQk6wEhNBoPDk59Cx5a7kz0/24vvkVswX9q2hpTL9GNO9 /owVslqtndjD7OjyfC0A5MBKP23xfiTfDfb3r2xT1WMmkXcYpUpOZPIj1JDud39neB+N ce23BFFIJ3Im/LkzQXZaKs28YGJmwweOkG4ikC/XtnziFfDpSAfKGIe6JMxXNK3xQGBe gWJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YktZpmrJifjA99PNTOVnRtSLaAx+iks0dLQmMQ/JKCw=; b=EXD/MjOypRqi/1+bLj4P0+hdWs+/tOZUSgbx3Yktbm1LlPYtji9skFa+CXOtHHmq77 HdcryuBqHjatIs6+SdMOrwWSxSQ4Suat9pg3N9Qd6bDwmmvDR1W8mRcyA0oI+8bU4ITc hgd1JXZyKfNqXqZFa1QR1cC2wTh/jnsAmLBIlFPFlFOdlJkyHQuRCtG2sOINLYqQhgEg 6EaeJiAUGytTJ69v+4UR70jB8lyRaoC5jDaQMHLrkJgGyzLWPOS7YOtwA6GjZ/JRAUGI mFRV2Ljd0xlkwmgdJEA+1zEA7scrU44ZzqVqasuyR7nbfKSUy1T2J1f10JqZAAQF3V9r TJQA== X-Gm-Message-State: APjAAAXTFYUfO4SHm08tQTWCbujOC9YmeETQAGXqV6TuZE5iEUlLdsWa GpgDima9S/vNyCz1y+uDJHAAhHzh X-Google-Smtp-Source: APXvYqxMiJ2mSLCGYcezMf6n/2r/m7FDljkiaziZwQIZvJKg9B9HChovdDrjuHfHhQeri6OEW6f8mw== X-Received: by 2002:aa7:86d6:: with SMTP id h22mr9313371pfo.72.1571436632231; Fri, 18 Oct 2019 15:10:32 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id n66sm11601022pfn.90.2019.10.18.15.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:31 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:29 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 05/15] t5520: let sed open its own input Message-ID: <9fac3dff833624c458cd0bf14d811ea49ac1ee30.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We were using a redirection operator to feed input into sed. However, since sed is capable of opening its own files, make sed open its own files instead of redirecting input into it. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index a3de2e19b6..55560ce3cd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -5,7 +5,7 @@ test_description='pulling into void' . ./test-lib.sh modify () { - sed -e "$1" <"$2" >"$2.x" && + sed -e "$1" "$2" >"$2.x" && mv "$2.x" "$2" } From patchwork Fri Oct 18 22:10:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199723 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0FDD112B for ; Fri, 18 Oct 2019 22:10:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FA8222478 for ; Fri, 18 Oct 2019 22:10:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NU2dJ7Lf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390469AbfJRWKh (ORCPT ); Fri, 18 Oct 2019 18:10:37 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33659 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390408AbfJRWKf (ORCPT ); Fri, 18 Oct 2019 18:10:35 -0400 Received: by mail-pl1-f194.google.com with SMTP id d22so3509343pls.0 for ; Fri, 18 Oct 2019 15:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mdbRREHR3G+YqzRMS3O8dG+eB1ZWdwu62/sUlzQo810=; b=NU2dJ7Lft92zeKRZnHMOxYuvS5vhz//UWq2qAlxpbJSGJ2z4hCeFwA3Osv+Oc/f6y3 wTLpRwmu1RJRc8mqSO2oa5xUUWk4Z4zwNDMy1tvmojox1yYaye8xkyIKcNnEje/deWdg +FobhlT5Q2fGrWk3rtXH2pzR6+DJ75p3ScQo/KZ0fUEZnJ/MHftJOLKuPWPBUPtz5Eho fB5WMqj41iZKh7JIojJnIJD5o2LTXIZcqh9qpOFHw5+WCrWqjmTbadlYA/+5TN7r7pJ5 UUWVn6m6CvhxBfrYcXR2CupmL4FLNmAtzrGZPlzB7K82IaXVLttnW9eUNdT30LWMn/i1 DS0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mdbRREHR3G+YqzRMS3O8dG+eB1ZWdwu62/sUlzQo810=; b=oWWJj8cwslj8mH89Dxq7FtscL5obKcNcLLSEP56NncMpLAqupPQ8o3vOO0N6a5ktyl rz7+ooYHcgv6x/4s/xkGsure16jrlV8Z8d9zMGy1/B5CEKijNxcr63ErRlT0wiKdCP7A lBNOdhL/EOhwovxdfo3s6uSUCZEB8ncNc3TEICxvsdykbEYSkgrMMWsfVqO2Z9xADMLg daFuTzxMXMO8nhMHy3HwmzBNQjPCWKAI0D7JGtseyH+RdwS1bWQDs54OAX4CoGFSM0oC zCcw4f0oUctpJD8Z5rWBWbMeeHDXV+oNTeGEQWZIzxSpo/MZreH7JRe0SX4js6463mST oNeg== X-Gm-Message-State: APjAAAUYIVYveCMs5PPbA27Cy287EMSMhhMe3VGudopCQCUVzRkwQqvT QAxGeufmdTCFC1gab0uChPP1v/pE X-Google-Smtp-Source: APXvYqy7OMlHuyno59tCCVIOdJLtZJbT9la+G6lKc7KOpgYS+Vw3WYjPPSYP9MvUYqxLIBKhY1jx6A== X-Received: by 2002:a17:902:d689:: with SMTP id v9mr7665622ply.198.1571436634584; Fri, 18 Oct 2019 15:10:34 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id c4sm6184013pgd.3.2019.10.18.15.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:33 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:32 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 06/15] t5520: replace test -f with test-lib functions Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Although `test -f` has the same functionality as test_path_is_file(), in the case where test_path_is_file() fails, we get much better debugging information. Replace `test -f` with test_path_is_file() so that future developers will have a better experience debugging these test cases. Also, in the case of `! test -f`, not only should that path not be a file, it shouldn't exist at all so replace it with test_path_is_missing(). Signed-off-by: Denton Liu --- t/t5520-pull.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 55560ce3cd..004d5884cd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -39,8 +39,8 @@ test_expect_success 'pulling into void' ' cd cloned && git pull .. ) && - test -f file && - test -f cloned/file && + test_path_is_file file && + test_path_is_file cloned/file && test_cmp file cloned/file ' @@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' ' cd cloned-uho && git pull .. master:master ) && - test -f file && - test -f cloned-uho/file && + test_path_is_file file && + test_path_is_file cloned-uho/file && test_cmp file cloned-uho/file ' @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' ( cd cloned-octopus && test_must_fail git pull .. master master && - ! test -f file + test_path_is_missing file ) ' From patchwork Fri Oct 18 22:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C64F1390 for ; Fri, 18 Oct 2019 22:11:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AFB622475 for ; Fri, 18 Oct 2019 22:11:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VxtAUHIn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391031AbfJRWLV (ORCPT ); Fri, 18 Oct 2019 18:11:21 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:32978 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390488AbfJRWKi (ORCPT ); Fri, 18 Oct 2019 18:10:38 -0400 Received: by mail-pg1-f195.google.com with SMTP id i76so4098684pgc.0 for ; Fri, 18 Oct 2019 15:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=maL13i5pQgo46tW4TDfni+FU/nTl5BeKKSciXlHc0Fo=; b=VxtAUHInqCZkLjbqXfxUI9iM3IUJaZV9XUg0RS5Pho3qcZSwQjqeIC3LdAonGt9y5x /kUKCfvVpbDqIqxt/95VLLC9QTYRbji0zwgJ+x/YJlYXkHqFqzP23OfVBIi3b/YDR0IO A5O9hLH7/I01q6WKNP5KJWzdC2wmyJr5ahvltJYBhsTg/lKmztl9o0w05aCDESlrq0Tc PpW63O6HobcH6kBdS+da5jWzQLodmBDHkapk8GOUxB0al0AWM7zKjx0uo7POp+8vKU7F zA3KpNrDr6ZWyp4sYuJ9JXkINxBYvQnZqBdk+8ZFLHcAG6b4BLqQO+s5SuiEqD1dpzTu zdeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=maL13i5pQgo46tW4TDfni+FU/nTl5BeKKSciXlHc0Fo=; b=NZsjan8U+YvhobGDl9lAcKYUEenXHWDy6jnrAJ7Z27aginHboe+2sCbCs7PH57XJQV p3QIiYr0TmmGKbWzP4jwshyHqg3YAD0J8N5rRqpZTpQKjHZ+M3+w797gAXb3dvxfl/e7 1gqHkIsGzmUE4HhTzP4qIAXUSs465QY4TueqSG6bqUsh3LxLjF3oXxVjzLsWl32Dc09E UecV6m8NgNzY/o7JbL4JnVjy/d4eFdbow9nDbbkLW7wEIz8BLJum/Rbjs+zEmsld8fZ8 xMUWni/QRIk9BHXnd+cFieGLp5YNFnU5BA0xU92SVtxjFUY1f4mHeEr4UYxiyRHKBHN1 lIiQ== X-Gm-Message-State: APjAAAU7QAlfTgeYOKlqAQ3FU0rC0vUgz4o7YtGACCv0Emb9srRtU9Oc QwDFZRII/GbTekblL4pPpUuUyS+J X-Google-Smtp-Source: APXvYqwl9iNu5pXGRSdb6bFQhwbnsBd8o3Zl8vrEvwscySW9z5bAHD875+AKYiWK55A87HacJAqONQ== X-Received: by 2002:a62:a504:: with SMTP id v4mr8917375pfm.243.1571436637224; Fri, 18 Oct 2019 15:10:37 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id c128sm8075381pfc.166.2019.10.18.15.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:36 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:34 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 07/15] t5520: remove spaces after redirect operator Message-ID: <830a8212ae78e2bb3f1001dc11cf6ba2edb85561.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The style for tests in Git is to have the redirect operator attached to the filename with no spaces. Fix test cases where this is not the case. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 004d5884cd..7bb9031140 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' ' test_expect_success '--rebase' ' git branch to-rebase && - echo modified again > file && + echo modified again >file && git commit -m file file && git checkout to-rebase && - echo new > file2 && + echo new >file2 && git add file2 && git commit -m "new file" && git tag before-rebase && @@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' ' git checkout copy && git tag copy-orig && git reset --hard HEAD^ && - echo conflicting modification > file && + echo conflicting modification >file && git commit -m conflict file && git checkout to-rebase && - echo file > file2 && + echo file >file2 && git commit -m to-rebase file2 && git tag to-rebase-orig && git pull --rebase me copy && @@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' ' test_config branch.to-rebase.remote me && test_config branch.to-rebase.merge refs/heads/copy && test_config branch.to-rebase.rebase true && - echo dirty >> file && + echo dirty >>file && git add file && test_must_fail git pull && test "$COPY" = "$(git rev-parse --verify me/copy)" && From patchwork Fri Oct 18 22:10:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FE631390 for ; Fri, 18 Oct 2019 22:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E39021835 for ; Fri, 18 Oct 2019 22:11:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g+dMz7jP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390594AbfJRWKn (ORCPT ); Fri, 18 Oct 2019 18:10:43 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46728 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390558AbfJRWKk (ORCPT ); Fri, 18 Oct 2019 18:10:40 -0400 Received: by mail-pf1-f194.google.com with SMTP id q5so4661123pfg.13 for ; Fri, 18 Oct 2019 15:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Q9Rmxbd6f9HFKGKnSFTmLyEMqsXoXai0k8/rbaD4GDM=; b=g+dMz7jPq2BG83kWMX3W4icmkNzEbqwXU47ok0aR08XQPikr+O3M56ccMB1seIAK/w QpAfdUTjLElJcixeQm5VeRs3LQwb25CViL0nZmH+nDkCjHUpHwBUUwfNrQlAfFcQL2vM JEWFqHE+/+2SFFb3APggnTALw29gMb1y6LFcJ6C1QvkCnx/w/JxVsWa+QFkg7mMm10MP uNUYELZ68zSWoLPRHnfMvkqeDsSCAED/fSdx7LnnNSkRYWrP/amI+arxkkQZ7aM2YB3A 1Hf1wtoNBOWt/K+wBFkQbmjKDs3QV1Do1d9BnZW3PnCEdw4UDkNGYoEod1iiyAuqHaYr +Y/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Q9Rmxbd6f9HFKGKnSFTmLyEMqsXoXai0k8/rbaD4GDM=; b=U/j1ezC3lyLbwdH5GJVQC5j7idczfnW9r/E35OmajoaN/ZFay3Qn5hTYrXO2u/WpRK bKIUYXYyYdca9kLrQNjkte2GvYF6SYm5K1T+Gd8JW4RjKtpEF6GMWHo1WU2o3lReNMVl Gz5F+1l4BvYRCZ/Owq3F2zQpoXkHz9xtl8NhgyPjT3Dd3wgOu6lXIRGfQA00Ekw5l9gz mz/Yqe5sjAEDta/2gl9t890pGtCCtQ2xpTuoF0oPdTyFEOVzEfiTV0Rq2HMBkeU0viDr jKnurEFKtAq5Rx0dgQRgeavwQfADE0DUaGplx5yTMDWvT5qC2nkPnMWeiGjl6MOpY+5F YBMA== X-Gm-Message-State: APjAAAXj4M3IDugnFjiaedyGpWDmUvQMsbKiE/9TjwLB7wF3Eo72Tptr WvebRKFp+fiC40acoudHRCfXYsS0 X-Google-Smtp-Source: APXvYqxqzsrSbTxB6+dp1EERsaiQAnrxhhblE7L8XiAKpkGMCGx2oOzO4FCL2W7PaQAeHQh4KMWV5Q== X-Received: by 2002:a65:6702:: with SMTP id u2mr13024369pgf.426.1571436639503; Fri, 18 Oct 2019 15:10:39 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id v19sm7680061pff.46.2019.10.18.15.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:39 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:37 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 08/15] t5520: use test_line_count where possible Message-ID: <3d982230be6af86120534d1233eee98d5a152485.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Instead of rolling our own functionality to test the number of lines a command outputs, use test_line_count() which provides better debugging information in the case of a failure. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 7bb9031140..0ca4867e96 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' ' ( cd dst && test_must_fail git pull --rebase && - test 1 = $(find .git/rebase-apply -name "000*" | wc -l) + find .git/rebase-apply -name "000*" >patches && + test_line_count = 1 patches ) ' From patchwork Fri Oct 18 22:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199717 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A33419A1 for ; Fri, 18 Oct 2019 22:04:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59F6F2245C for ; Fri, 18 Oct 2019 22:04:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="skwOGrfJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfJRWEc (ORCPT ); Fri, 18 Oct 2019 18:04:32 -0400 Received: from mail-pf1-f171.google.com ([209.85.210.171]:39133 "EHLO mail-pf1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728251AbfJRWEa (ORCPT ); Fri, 18 Oct 2019 18:04:30 -0400 Received: by mail-pf1-f171.google.com with SMTP id v4so4670937pff.6 for ; Fri, 18 Oct 2019 15:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zJ81W7ZgttEIX4oKmBXv/wY1VZeeU4NQp4kmTA0r8Co=; b=skwOGrfJt7ftpQBoeMvj5v1X1aZu0zVlOpjTr+WzPLKsS9jNbjzrrz49FLp0KQnwlM AapNq+WvF0RXeBc7y1O7fw77iiD5ejtxuQpLnxKBZOu6FP7uRqXIVlGnDz3c3IyciEm4 OrKg7A4pE79mfd370P13RcJrZVBbCv64rNzmpumOxROtSsR4ER/MOQEWmjwU5BXJHb4I TfO3liNiNQDDTwh5uPt3Zeo5rqtfc4Pgm0VXfbuR6fvqtkJrqTbL8BJB7tapSVaWKwqZ gp0v2MD5Pf+ZaIJKeJR9ToJz7xSLNtrB3HQBKmwxMod/9CHoopctUZUJPZgsJeAJ9ASC Fwew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zJ81W7ZgttEIX4oKmBXv/wY1VZeeU4NQp4kmTA0r8Co=; b=TlXGvqQf2eVCdEDg7cUHivGESna5o3oDtCLJX3twyDilt5HbEltnxz+xA2yam+q+lu 9urI0t4PZw6d29Cm52xRTd/hoMVMCKPxu1cP5F50gT/Oaa3GvM2ngNcWAKRsOxQjKI/p Uts6CXifg6DcR69Z0nf9UGmmVm5Dme28sr7JhDGG0HMyX07aXBgtfq8VSVWOo3Ow9P9g mqSgqbLDdG8dR7MVVcaDdgNqSGnYWcEPP8cWv4Bpx8KoPmfmaSl+VqfdDxesl9Vx7LG9 HuApRasd9rQBZXDgMZqVnL54doWxzUjdRwoK5ETYA/d56q1ecyEGLr8EPV8T6wNu7bBj Sr1Q== X-Gm-Message-State: APjAAAX8U0cvmEaoiiKOcEkj8Z8vriCe4j6xzuxgSlfZNDyMB7klJBr5 aSblm0uRVLCLxyFDmBX+arUfoRLF X-Google-Smtp-Source: APXvYqwXSlqA+u4gTL491I1rJEp7v+9NQ/BPfSzcZFujfcZFaeu358G90xtfBGqQ1gn1XrcPuaKdRA== X-Received: by 2002:a63:d70f:: with SMTP id d15mr12849338pgg.424.1571436269423; Fri, 18 Oct 2019 15:04:29 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id b20sm10102942pff.158.2019.10.18.15.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:04:28 -0700 (PDT) Date: Fri, 18 Oct 2019 15:04:26 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 09/15] t5520: replace test -{n,z} with test-lib functions Message-ID: <2bca4f046d72615045e584d89817f99b6c0c61ec.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When wrapping a Git command in a subshell within another command, we throw away the Git command's exit code. In case the Git command fails, we would like to know about it rather than the failure being silent. Extract Git commands so that their exit codes are not lost. Instead of using `test -n` or `test -z`, replace them respectively with invocations of test_file_not_empty() and test_must_be_empty() so that we get better debugging information in the case of a failure. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 0ca4867e96..18225d8430 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' ' test_when_finished "git checkout -f copy && git branch -D third" && test "$(cat file)" = file && test_commit modified2 file && - test -z "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_must_be_empty unmerged && test_must_fail git pull . second && - test -n "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_file_not_empty unmerged && cp file expected && test_must_fail git pull . second 2>err && test_i18ngrep "Pulling is not possible because you have unmerged files." err && test_cmp expected file && git add file && - test -z "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_must_be_empty unmerged && test_must_fail git pull . second 2>err && test_i18ngrep "You have not concluded your merge" err && test_cmp expected file @@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' ' ( cd dst && git pull --rebase && - test -z "$(git ls-files -u)" + git ls-files -u >untracked && + test_must_be_empty untracked ) ' From patchwork Fri Oct 18 22:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F1C0112B for ; Fri, 18 Oct 2019 22:11:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02E252089C for ; Fri, 18 Oct 2019 22:11:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OfAqurwD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390907AbfJRWLQ (ORCPT ); Fri, 18 Oct 2019 18:11:16 -0400 Received: from mail-pl1-f169.google.com ([209.85.214.169]:36063 "EHLO mail-pl1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390635AbfJRWKq (ORCPT ); Fri, 18 Oct 2019 18:10:46 -0400 Received: by mail-pl1-f169.google.com with SMTP id j11so3502951plk.3 for ; Fri, 18 Oct 2019 15:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1kH/H9/UmTiuH43xd3spo4dKsgimlvugG7wwdcA5ZSk=; b=OfAqurwDJcrY/wJwMwuuFadx0Uq+nZBTIK8g2dDIjzPMBcpuMvbbP4m29mVYEaahV7 Km7MqfV4DkWG+DJ5wfEtz3K/Ul46qWAbOGf1cW3e4U3cbsj80crnWWyGWFBR0IYJI+41 AVHvABrKacwhnF2e8m4l34KXY/088WcqnRvdizKrt7mugoMSfkoO3upKWcNe/3SMM23w dJj3wQzFLeF+DjeXJ7Jq0fZbm4SF0Yzat5/uQA8klVDxzGEpmf3kwKToJW8QsRtpBtH+ dN8mxqnOKGatyvDwMhcPK80n/9yGXIxuUKGWJ3S/GM4q3TxxgxjufxUzI7dZtQKagAGK y6Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1kH/H9/UmTiuH43xd3spo4dKsgimlvugG7wwdcA5ZSk=; b=RTjrZ0IMV086cWqtn5d3bL4Fs/S87Q9OJXYXobOjMoT9AFz1PvMLY7UfghcKIxeN5F v2+pU3oT82abN9JS3RRvFGxqcDk1iYVUQWfgzjPCriMzsOomcDx8UsIh3AolQAvTnsJG T3xMUZ2fnWKvFDqklmQOruICBNQ1BQdHr93k4bPgYKeyWTwfg7JXBBS8MQAolLwSH6H8 IZOoTGgp/7m7Wl+/pGs1UV9Bibgi9ARSkuqMxl/lFMBgXM9nDNbndf3j0WX5lY/2ViCo xPcXt+ciA7nKVu5WlbgooSn1QfyAdYW64FGFj+frQTLsp72rXJ7P2MgqXXgwUq8IzDkf A++w== X-Gm-Message-State: APjAAAVAwZJLhCRGrQulek4vrs6m3W06wFJdzjwmgO8x5Zz41lE+1vsj GhqOb4KsV0BhPRb2V64n0UZtQ/uJ X-Google-Smtp-Source: APXvYqyzCYUK09v/RTfLDLmjk/ZRjrakuNU+jrEm+TeckcIyLlZJINyxx394Zx0uwlSp2HiaG/R2hQ== X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr11325957pls.120.1571436645270; Fri, 18 Oct 2019 15:10:45 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id i187sm9449067pfc.177.2019.10.18.15.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:44 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:42 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 10/15] t5520: use test_cmp_rev where possible Message-ID: <1a54db1d5ce6dde8f3526d19b617b7587acba851.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In case an invocation of `git rev-list` fails within the subshell, the failure will be masked. Remove the subshell and use test_cmp_rev() so that failures can be discovered. This change was done with the following sed expressions: s/test "$(git rev-parse.* \([^)]*\))" = "$(git rev-parse \([^)]*\))"/test_cmp_rev \1 \2/ s/test \([^ ]*\) = "$(git rev-parse.* \([^)]*\))"/test_cmp_rev \1 \2/ s/test "$(git rev-parse.* \([^)]*\))" != "$(git rev-parse.* \([^)]*\))"/test_cmp_rev ! \1 \2/ s/test \([^ ]*\) != "$(git rev-parse.* \([^)]*\))"/test_cmp_rev ! \1 \2/ Signed-off-by: Denton Liu --- t/t5520-pull.sh | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 18225d8430..1af6ea06ee 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' ' git pull . second:third 2>err && test_i18ngrep "fetch updated the current branch head" err && test "$(cat file)" = modified && - test "$(git rev-parse third)" = "$(git rev-parse second)" + test_cmp_rev third second ' test_expect_success 'fast-forward fails with conflicting work tree' ' @@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' ' test_must_fail git pull . second:third 2>err && test_i18ngrep "Cannot fast-forward your working tree" err && test "$(cat file)" = conflict && - test "$(git rev-parse third)" = "$(git rev-parse second)" + test_cmp_rev third second ' test_expect_success '--rebase' ' @@ -254,7 +254,7 @@ test_expect_success '--rebase' ' git commit -m "new file" && git tag before-rebase && git pull --rebase . copy && - test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^ copy && test new = "$(git show HEAD:file2)" ' @@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' ' git checkout to-rebase && git pull --rebase . ff && - test "$(git rev-parse HEAD)" = "$(git rev-parse ff)" && + test_cmp_rev HEAD ff && # The above only validates the result. Did we actually bypass rebase? git reflog -1 >reflog.actual && @@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' ' git checkout behind && echo dirty >file && git pull --rebase --autostash . to-rebase-ff && - test "$(git rev-parse HEAD)" = "$(git rev-parse to-rebase-ff)" + test_cmp_rev HEAD to-rebase-ff ' test_expect_success '--rebase with conflicts shows advice' ' @@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' ' test_expect_success '--rebase fails with multiple branches' ' git reset --hard before-rebase && test_must_fail git pull --rebase . copy master 2>err && - test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" && + test_cmp_rev HEAD before-rebase && test_i18ngrep "Cannot rebase onto multiple branches" err && test modified = "$(git show HEAD:file)" ' @@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' ' git reset --hard before-rebase && test_config pull.rebase true && git pull . copy && - test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^ copy && test new = "$(git show HEAD:file2)" ' @@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' ' git reset --hard before-rebase && test_config branch.to-rebase.rebase true && git pull . copy && - test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^ copy && test new = "$(git show HEAD:file2)" ' @@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' test_config pull.rebase true && test_config branch.to-rebase.rebase false && git pull . copy && - test "$(git rev-parse HEAD^)" != "$(git rev-parse copy)" && + test_cmp_rev ! HEAD^ copy && test new = "$(git show HEAD:file2)" ' test_expect_success 'pull --rebase warns on --verify-signatures' ' git reset --hard before-rebase && git pull --rebase --verify-signatures . copy 2>err && - test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^ copy && test new = "$(git show HEAD:file2)" && test_i18ngrep "ignoring --verify-signatures for rebase" err ' @@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' ' test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' git reset --hard before-rebase && git pull --rebase --no-verify-signatures . copy 2>err && - test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^ copy && test new = "$(git show HEAD:file2)" && test_i18ngrep ! "verify-signatures" err ' @@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' ' git reset --hard before-preserve-rebase && test_config pull.rebase false && git pull . copy && - test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" && - test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^1 before-preserve-rebase && + test_cmp_rev HEAD^2 copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^^ copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase 1 && git pull . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^^ copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -469,8 +469,8 @@ test_expect_success REBASE_P \ git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && - test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)" + test_cmp_rev HEAD^^ copy && + test_cmp_rev HEAD^2 keep-merge ' test_expect_success 'pull.rebase=interactive' ' @@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' ' git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull --rebase=false . copy && - test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" && - test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^1 before-preserve-rebase && + test_cmp_rev HEAD^2 copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' ' git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull --rebase=true . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^^ copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -523,8 +523,8 @@ test_expect_success REBASE_P \ git reset --hard before-preserve-rebase && test_config pull.rebase true && git pull --rebase=preserve . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && - test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)" + test_cmp_rev HEAD^^ copy && + test_cmp_rev HEAD^2 keep-merge ' test_expect_success '--rebase=invalid fails' ' @@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m git reset --hard before-preserve-rebase && test_config pull.rebase preserve && git pull --rebase . copy && - test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" && + test_cmp_rev HEAD^^ copy && test file3 = "$(git show HEAD:file3.t)" ' @@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' ' echo dirty >>file && git add file && test_must_fail git pull && - test "$COPY" = "$(git rev-parse --verify me/copy)" && + test_cmp_rev "$COPY" me/copy && git checkout HEAD -- file && git pull && - test "$COPY" != "$(git rev-parse --verify me/copy)" + test_cmp_rev ! "$COPY" me/copy ' test_expect_success 'pull --rebase works on branch yet to be born' ' From patchwork Fri Oct 18 22:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2746219A1 for ; Fri, 18 Oct 2019 22:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F05192245C for ; Fri, 18 Oct 2019 22:04:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hjq8nv8H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728438AbfJRWEi (ORCPT ); Fri, 18 Oct 2019 18:04:38 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46587 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbfJRWEh (ORCPT ); Fri, 18 Oct 2019 18:04:37 -0400 Received: by mail-pl1-f193.google.com with SMTP id q24so3470937plr.13 for ; Fri, 18 Oct 2019 15:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ak+lTrf00kbfLeAZYGinrBzu7iQVjhs52xLhRN1MjMU=; b=Hjq8nv8HDXX6zcfLcTNUKHi5cJu4EWMjhDtCQFbXV7/ADQYhWegiMud/tGmQzOJczl NAmN+0YuUP+YDAjzToi0U3SBEXK6t9kDLj8ToPekOxPbrY82QarDQQHN4xS/ADDyqanw 9GrSfggsLQ8vUMneyx/yMZ4l/JolXO6CtjuNxoUnbPGa7tfmkKsUA8XpvqiczqeX0TQA XudhmWdLebuAHOQjrboYcVyzEhRhcTKfBbyxEd8fP4rBKWshMba9bT3KTCIQH0+q9c9u 0Fr1ggdVmnePEgdtYyOfj51ejgVwWrm77D6ixRzo/rqRUm6cy+sb/qIt6q3P6TNu9YEv Zkcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ak+lTrf00kbfLeAZYGinrBzu7iQVjhs52xLhRN1MjMU=; b=tlqVAWVEWBiU67lmrhPTKUiQSYxpILdDuyott9SClmyl6dPaGmMdEWiFNcbrQQnrGK ra9tzBhz2VMM2rnKevUhUG5ZaQ4vkLeOQD5FAstdq8GG5YgsWD6f2iGEiY50ju090TGU lKWqbQ+JuwxYcostJfhGSZ16qH5EHv3BEFNLE1vvATSNAG167TsrqqWYaPXv9OzCTsSv nEGcU4vKvkM4X+qaqR1IuwdbUBhtKFLG4cIh+MZN2u9i76kpesNRrOlzEWtJig23Gfc+ va7mT32IFYMSRiSK9cKDP3vU8xWJYtQAvReV9IPfP2wkNi7f+KvZPhmA533BL3B9G9qx PWaA== X-Gm-Message-State: APjAAAXfLToIp98AJHhtSz+HjAo9GxEmEC2vi0CgqJ/Nd23zZy8c84VZ 0AjiOIOW7SP6BQ50CbiBIQE/Yk0n X-Google-Smtp-Source: APXvYqy/eViCNpfJv3rHTqcvElNT0FqrMwJJz2vlU8zcZzj10odJI13068P8wGIuusnxQu0eCSI6rQ== X-Received: by 2002:a17:902:9b85:: with SMTP id y5mr12260478plp.138.1571436275665; Fri, 18 Oct 2019 15:04:35 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id x139sm9227434pgx.92.2019.10.18.15.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:04:34 -0700 (PDT) Date: Fri, 18 Oct 2019 15:04:32 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 11/15] t5520: test single-line files by git with test_cmp Message-ID: <52cf4f0d0fbab70ed90e24bba9271521d3e55d5b.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In case an invocation of a Git command fails within the subshell, the failure will be masked. Replace the subshell with a file-redirection and a call to test_cmp. This change was done with the following GNU sed expressions: s/\(\s*\)test \([^ ]*\) = "$(\(git [^)]*\))"/\1echo \2 >expect \&\&\n\1\3 >actual \&\&\n\1test_cmp expect actual/ s/\(\s*\)test "$(\(git [^)]*\))" = \([^ ]*\)/\1echo \3 >expect \&\&\n\1\2 >actual \&\&\n\1test_cmp expect actual/ A future patch will clean up situations where we have multiple duplicate statements within a test case. This is done to keep this patch purely mechanical. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 1af6ea06ee..8b7e7ae55d 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -255,7 +255,9 @@ test_expect_success '--rebase' ' git tag before-rebase && git pull --rebase . copy && test_cmp_rev HEAD^ copy && - test new = "$(git show HEAD:file2)" + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual ' test_expect_success '--rebase fast forward' ' @@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' ' test_must_fail git pull --rebase . copy master 2>err && test_cmp_rev HEAD before-rebase && test_i18ngrep "Cannot rebase onto multiple branches" err && - test modified = "$(git show HEAD:file)" + echo modified >expect && + git show HEAD:file >actual && + test_cmp expect actual ' test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' ' @@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' ' test_config pull.rebase true && git pull . copy && test_cmp_rev HEAD^ copy && - test new = "$(git show HEAD:file2)" + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual ' test_expect_success 'pull --autostash & pull.rebase=true' ' @@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' ' test_config branch.to-rebase.rebase true && git pull . copy && test_cmp_rev HEAD^ copy && - test new = "$(git show HEAD:file2)" + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual ' test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' @@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' ' test_config branch.to-rebase.rebase false && git pull . copy && test_cmp_rev ! HEAD^ copy && - test new = "$(git show HEAD:file2)" + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual ' test_expect_success 'pull --rebase warns on --verify-signatures' ' git reset --hard before-rebase && git pull --rebase --verify-signatures . copy 2>err && test_cmp_rev HEAD^ copy && - test new = "$(git show HEAD:file2)" && + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual && test_i18ngrep "ignoring --verify-signatures for rebase" err ' @@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' git reset --hard before-rebase && git pull --rebase --no-verify-signatures . copy 2>err && test_cmp_rev HEAD^ copy && - test new = "$(git show HEAD:file2)" && + echo new >expect && + git show HEAD:file2 >actual && + test_cmp expect actual && test_i18ngrep ! "verify-signatures" err ' @@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' ' git pull . copy && test_cmp_rev HEAD^1 before-preserve-rebase && test_cmp_rev HEAD^2 copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success 'pull.rebase=true flattens keep-merge' ' @@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' ' test_config pull.rebase true && git pull . copy && test_cmp_rev HEAD^^ copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' ' @@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' ' test_config pull.rebase 1 && git pull . copy && test_cmp_rev HEAD^^ copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success REBASE_P \ @@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' ' git pull --rebase=false . copy && test_cmp_rev HEAD^1 before-preserve-rebase && test_cmp_rev HEAD^2 copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success '--rebase=true rebases and flattens keep-merge' ' @@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' ' test_config pull.rebase preserve && git pull --rebase=true . copy && test_cmp_rev HEAD^^ copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success REBASE_P \ @@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m test_config pull.rebase preserve && git pull --rebase . copy && test_cmp_rev HEAD^^ copy && - test file3 = "$(git show HEAD:file3.t)" + echo file3 >expect && + git show HEAD:file3.t >actual && + test_cmp expect actual ' test_expect_success '--rebase with rebased upstream' ' @@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' cd empty_repo2 && echo staged-file >staged-file && git add staged-file && - test "$(git ls-files)" = staged-file && + echo staged-file >expect && + git ls-files >actual && + test_cmp expect actual && test_must_fail git pull --rebase .. master 2>err && - test "$(git ls-files)" = staged-file && - test "$(git show :staged-file)" = staged-file && + echo staged-file >expect && + git ls-files >actual && + test_cmp expect actual && + echo staged-file >expect && + git show :staged-file >actual && + test_cmp expect actual && test_i18ngrep "unborn branch with changes added to the index" err ) ' From patchwork Fri Oct 18 22:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199725 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F8BC1390 for ; Fri, 18 Oct 2019 22:10:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2CF7D2246F for ; Fri, 18 Oct 2019 22:10:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xjnr4h8y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390779AbfJRWKw (ORCPT ); Fri, 18 Oct 2019 18:10:52 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39129 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390733AbfJRWKv (ORCPT ); Fri, 18 Oct 2019 18:10:51 -0400 Received: by mail-pg1-f193.google.com with SMTP id p12so4082349pgn.6 for ; Fri, 18 Oct 2019 15:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=thwPGOD7mKEo0w/iIlnc1rVQeffLBQTg9Iga9wO9L14=; b=Xjnr4h8yqo7+aC0N8LTooE2O7oFlt5RjuGoMxW0wajX2pbgIyKaFOvvLnAoMTeXtDy tIO1bSPs3PjP79KZ/JX3/CKrUADxWUeQa4lXenKvxfRS4CqW8M+NXO8cN9TgbOVCdosP 39gKdIenP2II5+oWOy8GFqWnXL9ZGOUzmumEOLSos4i2bbEWzTsO5U8ipfvlVIsZIRGX vjR156bXzr4eMyLd7JNztc4r/x92og66dBBmp5nNVl5YuZ0onYVPjyEY3oxeRjleVOvf 9wBWNc/b6wSNkFm+m+rL6H2Rpb4uu3YQzZw9lV4IplP4vjj03Kg2hQ2hj5s2fxKVd+I5 MQgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=thwPGOD7mKEo0w/iIlnc1rVQeffLBQTg9Iga9wO9L14=; b=VEiq1DHKfEFw9ytOOXsdoxv5R2+wJv0Ri+FtB3BA2/aBlPGG4kb4PSZ8pEtHfGI6UH bInHbWcWGcDJm9HjqP3NcweLr/gAaZyGzsU2BcwDcTfUPG1x42x5B7T+LWrKObWlpMly MBBEVBU3dxZZZvSumH14ePRUc5KWKoTBekaOYNAbiS7jzwPQbmiTarRrj3djKl5Bo6iB GxjFC1W/Lhyg98+T4G0SwgAElwuDmuHsrD6B2Hic9rEXvv7QPDBAu64tg3mpq8wDXHGK rKTKClxd+K2PyxYByoSAQdVG1e9UY2hK+c927M3N7C77SsyrPIZovpWI8RvwxyiixfbA VpZg== X-Gm-Message-State: APjAAAVtY5b37Vxnjq3U75QBiE1frnyfq4EM+a8NvMivJjcO7k6zb4AK xDn/JL9z4PQLBpMgIOyzvdQ/jmPA X-Google-Smtp-Source: APXvYqwlyoJBFlV3y3gwK2BsiLRZl0+HSQkdoMZfkn4JbyjeWd4imUdxL0sAcpD3gCkO5tW8ToqOjg== X-Received: by 2002:a63:1242:: with SMTP id 2mr12258893pgs.288.1571436650212; Fri, 18 Oct 2019 15:10:50 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id s73sm6815612pjb.15.2019.10.18.15.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:49 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:47 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 12/15] t5520: don't put git in upstream of pipe Message-ID: <0cfabb201c5a79f665e79252edcfc28aa3df59ff.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, if the invocation of git failed, it would be masked by the pipe since only the return code of the last element of a pipe is used. Rewrite the test to put the Git command on its own line so its return code is not masked. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 8b7e7ae55d..8ddf89e550 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' ( cd corrupt && test_commit one && - obj=$(git rev-parse --verify HEAD | sed "s#^..#&/#") && + git rev-parse --verify HEAD >head && + obj=$(sed "s#^..#&/#" head) && rm -f .git/objects/$obj && test_must_fail git pull --rebase ) From patchwork Fri Oct 18 22:10:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199731 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA412112B for ; Fri, 18 Oct 2019 22:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B51A92089C for ; Fri, 18 Oct 2019 22:11:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SqwaAmGh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390822AbfJRWKy (ORCPT ); Fri, 18 Oct 2019 18:10:54 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42940 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390784AbfJRWKx (ORCPT ); Fri, 18 Oct 2019 18:10:53 -0400 Received: by mail-pg1-f194.google.com with SMTP id f14so4068159pgi.9 for ; Fri, 18 Oct 2019 15:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JFj037VppACIW60EHUgaVAhKbhf9QHZDzfY/bCKf8EA=; b=SqwaAmGhd8Ktxd05KAono/fcu5jhjNiiLkzUoKsBs7AsGgJ9JBP1WIH2EdJRKeDS74 JH0zz+Ro6CKM/E2ki8j8zriXoNYzWPuNFA9OTCC15qWjFSKuEMdLQSD1GuDFz3PwB8JK R4jLcZfWTtI6/ar+lAqHFrY3Nc+vYV+MYpI6go5o+sVboWB2UXmdtW3E/30IANldM7p5 rLiiIcfDA8GTDCbAbVNIM1NqDPRn6MqiiD+oNKeuFc3vbJ703rqzqJDZaWud0NJ9+I9x poT7pi2GRxSPa0thxTrDa5rB+ef6OHZZbHjRpBnbuc5sMsQY1Us7PhxDIJF8Z+QNqI6Z bbDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JFj037VppACIW60EHUgaVAhKbhf9QHZDzfY/bCKf8EA=; b=M9HSG0xepI0V3IpUILX9znEWvp0XqMbCoGpnwbbVgY4K4Qbhr+vHD5UetbkOAaGTRr Siy3SUNlA0qBrnqwSLvhkehGOVQbLl+SaMvvf6axMChg+C2nUjLLUOt4TIPgdW3vTTSB TZo11zgrUUxf72/ML4pWeHNmG7Nf/fFIRjlISlcwed6+J7vQmVoaenrG+AkYWPC63NYS 9L6hSKIEluUJ5P8Dt1EEyMSRJ3E71/lD/YEQiigOExLFMLW4yY9fZk6WfepPx86blvuk 6nkg3NzTgI/JOSLJ+oQenuDTG4Q7xhpqLsvAVXY3npk0qU6TkFmH6JIlCkIEygU/qE++ 2mOg== X-Gm-Message-State: APjAAAXrK9rZftreZ3HdGbVv7mT1TXIkjEsWfmDOiWLvCNx0TzaYxTOh ETVmjABFiu4gRmRHamlFouN2moo3 X-Google-Smtp-Source: APXvYqymRQo32JoiGPEa53XlD7D4iaK6zuuaC7ezNPlV64QojWRA8eP3iMgYB62DLgPL5k9kuByTGw== X-Received: by 2002:a17:90a:ff0f:: with SMTP id ce15mr14235025pjb.14.1571436652498; Fri, 18 Oct 2019 15:10:52 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id f13sm7122974pgr.6.2019.10.18.15.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:51 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:50 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 13/15] t5520: replace subshell cat comparison with test_cmp Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We currently have many instances of `test = $(cat )` and `test $(cat ) = `. In the case where this fails, it will be difficult for a developer to debug since the output will be masked. Replace these instances with invocations of test_cmp(). This change was done with the following GNU sed expressions: s/\(\s*\)test \([^=]*\)= "$(cat \([^)]*\))"/\1echo \2>expect \&\&\n\1test_cmp expect \3/ s/\(\s*\)test "$(cat \([^)]*\))" = \([^&]*\)\( &&\)\?$/\1echo \3 >expect \&\&\n\1test_cmp expect \2\4/ A future patch will clean up situations where we have multiple duplicate statements within a test case. This is done to keep this patch purely mechanical. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 35 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 8ddf89e550..c9e4eec004 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -15,8 +15,10 @@ test_pull_autostash () { git add new_file && git pull "$@" . copy && test_cmp_rev HEAD^ copy && - test "$(cat new_file)" = dirty && - test "$(cat file)" = "modified again" + echo dirty >expect && + test_cmp expect new_file && + echo "modified again" >expect && + test_cmp expect file } test_pull_autostash_fail () { @@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' ' echo updated >file && git commit -a -m updated && git checkout copy && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && git pull && - test "$(cat file)" = updated && + echo updated >expect && + test_cmp expect file && git reflog -1 >reflog.actual && sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy && echo "OBJID HEAD@{0}: pull: Fast-forward" >reflog.expected && @@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' ' git commit -a -m modified && git checkout copy && git reset --hard HEAD^ && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && git pull . second && - test "$(cat file)" = modified && + echo modified >expect && + test_cmp expect file && git reflog -1 >reflog.actual && sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy && echo "OBJID HEAD@{0}: pull . second: Fast-forward" >reflog.expected && @@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' ' test_expect_success 'fail if wildcard spec does not match any refs' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err && test_i18ngrep "no candidates for merging" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'fail if no branches specified with non-default remote' ' @@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' ' test_when_finished "git remote remove test_remote" && git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_config branch.test.remote origin && test_must_fail git pull test_remote 2>err && test_i18ngrep "specify a branch on the command line" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'fail if not on a branch' ' @@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' ' test_when_finished "git remote remove origin" && git checkout HEAD^ && test_when_finished "git checkout -f copy" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "not currently on a branch" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'fail if no configuration for current branch' ' @@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote test_remote && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no tracking information" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'pull --all: fail if no configuration for current branch' ' @@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' ' git checkout -b test copy^ && test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote test_remote && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_must_fail git pull --all 2>err && test_i18ngrep "There is no tracking information" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'fail if upstream branch does not exist' ' @@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' ' test_when_finished "git checkout -f copy && git branch -D test" && test_config branch.test.remote . && test_config branch.test.merge refs/heads/nonexisting && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no such ref was fetched" err && - test "$(cat file)" = file + echo file >expect && + test_cmp expect file ' test_expect_success 'fail if the index has unresolved entries' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && test_commit modified2 file && git ls-files -u >unmerged && test_must_be_empty unmerged && @@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' ' test_expect_success 'fast-forwards working tree if branch head is updated' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && git pull . second:third 2>err && test_i18ngrep "fetch updated the current branch head" err && - test "$(cat file)" = modified && + echo modified >expect && + test_cmp expect file && test_cmp_rev third second ' test_expect_success 'fast-forward fails with conflicting work tree' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && - test "$(cat file)" = file && + echo file >expect && + test_cmp expect file && echo conflict >file && test_must_fail git pull . second:third 2>err && test_i18ngrep "Cannot fast-forward your working tree" err && - test "$(cat file)" = conflict && + echo conflict >expect && + test_cmp expect file && test_cmp_rev third second ' @@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' ' test_set_editor "$TRASH_DIRECTORY/fake-editor" && test_when_finished "test_might_fail git rebase --abort" && test_must_fail git pull --rebase=interactive . copy && - test "I was here" = "$(cat fake.out)" + echo "I was here" >expect && + test_cmp expect fake.out ' test_expect_success 'pull --rebase=i' ' @@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' ' test_set_editor "$TRASH_DIRECTORY/fake-editor" && test_when_finished "test_might_fail git rebase --abort" && test_must_fail git pull --rebase=i . copy && - test "I was here, too" = "$(cat fake.out)" + echo "I was here, too" >expect && + test_cmp expect fake.out ' test_expect_success 'pull.rebase=invalid fails' ' @@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' ' git commit -m to-rebase file2 && git tag to-rebase-orig && git pull --rebase me copy && - test "conflicting modification" = "$(cat file)" && - test file = "$(cat file2)" + echo "conflicting modification" >expect && + test_cmp expect file && + echo file >expect && + test_cmp expect file2 ' test_expect_success '--rebase -f with rebased upstream' ' test_when_finished "test_might_fail git rebase --abort" && git reset --hard to-rebase-orig && git pull --rebase -f me copy && - test "conflicting modification" = "$(cat file)" && - test file = "$(cat file2)" + echo "conflicting modification" >expect && + test_cmp expect file && + echo file >expect && + test_cmp expect file2 ' test_expect_success '--rebase with rebased default upstream' ' @@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' ' git checkout --track -b to-rebase2 me/copy && git reset --hard to-rebase-orig && git pull --rebase && - test "conflicting modification" = "$(cat file)" && - test file = "$(cat file2)" + echo "conflicting modification" >expect && + test_cmp expect file && + echo file >expect && + test_cmp expect file2 ' test_expect_success 'rebased upstream + fetch + pull --rebase' ' @@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' ' git reset --hard to-rebase-orig && git fetch && git pull --rebase && - test "conflicting modification" = "$(cat file)" && - test file = "$(cat file2)" + echo "conflicting modification" >expect && + test_cmp expect file && + echo file >expect && + test_cmp expect file2 ' @@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' ' test_expect_success 'git pull --rebase against local branch' ' git checkout -b copy2 to-rebase-orig && git pull --rebase . to-rebase && - test "conflicting modification" = "$(cat file)" && - test file = "$(cat file2)" + echo "conflicting modification" >expect && + test_cmp expect file && + echo file >expect && + test_cmp expect file2 ' test_done From patchwork Fri Oct 18 22:10:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199727 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8E841390 for ; Fri, 18 Oct 2019 22:10:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B747521835 for ; Fri, 18 Oct 2019 22:10:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m7moutVC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390924AbfJRWK6 (ORCPT ); Fri, 18 Oct 2019 18:10:58 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46379 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390879AbfJRWK5 (ORCPT ); Fri, 18 Oct 2019 18:10:57 -0400 Received: by mail-pg1-f194.google.com with SMTP id e15so4060336pgu.13 for ; Fri, 18 Oct 2019 15:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=erkiYgyZVZjHdJVDwgrPyczAgjqKYZih12Jmuwj7u5M=; b=m7moutVCwVhy2qefMQdy+uiM4mq/HYT25ridoIBTYweE1C9iZ436zPHVwddhtQoCQx th6xXtQ/6fc5cM/bNk9Gg9pu63Z4Sxf/oFh3wUNS8Yg5adjSGGfI4oRwAgW1bXbP5K6U qJIPHGT3ghAaoEbb6iSZeo+eUCvgyz3GzrJMFaq/H5pMWiNFbob4lF30rY+K25aRzKx2 4WczgXDFrb3ZVd4JHD0kyS5wThhKVNw2aVZXz+krbEZzXsZ6ESq2YBfhAOZ76RymGAxt RMwfdXMmsKOGMlKzxkE9CW26U2aITMewd0eGzPrtJvqdY1Svbo8QyedQ43AQxMecUFqY IUaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=erkiYgyZVZjHdJVDwgrPyczAgjqKYZih12Jmuwj7u5M=; b=nY/0fhhvcvG6iOFLlNNFzblgT/LUzdsk54LtzhAwYxnM0kIBVM5idwH3M1RnIWaGBa 4H38v20dW0eGPjJFfrDvrZY1KelzwaXUHevlBbBS2h2o2ubuH2IzV3bvPrgPfpKS0w3H o6NLqSWsYNU6pk3okksKTL2kkhJy7+z5uqst00/Zs+jdyON+p9dJsoRNCqtnGr+/fCMd 3OL5b2aEp/Js6qgnHzOOtlWDTQH00vkD+hJg1GDDv93mbSmv/WdSavadU8BS9bj7eoe1 EtmiPC/pH3WBkpd5OFLNGoBTnP2s5gkGs1IR6mcHBcYaEmypVFRkFyRapBX0kIXZOyVv E2qw== X-Gm-Message-State: APjAAAX5zixtZR37Xa1/0mCZ2nSvj9yQI0QAwGXTOSW93uZStEzZFbfS hJyLReElF2BXUPtDLRNolgllKwCA X-Google-Smtp-Source: APXvYqxx7qt1Tf1d8MVJcNCWjuEBqwSyeFp0oXyTSdBnGFhALoY5XfYIyBn+Ci3TlYJCnOHyY0RmQw== X-Received: by 2002:aa7:838f:: with SMTP id u15mr8873497pfm.13.1571436655435; Fri, 18 Oct 2019 15:10:55 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id b5sm8134514pfp.38.2019.10.18.15.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:54 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:52 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 14/15] t5520: remove redundant lines in test cases Message-ID: <5aac40a029a95f0a72415f80b546310a3940f053.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the previous patches, the mechanical application of changes left some duplicate statements in the test case which were not strictly incorrect but were redundant and possibly misleading. Remove these duplicate statements so that it is clear that the intent behind the tests are that the content of the file stays the same throughout the whole test case. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index c9e4eec004..ef3dbc201a 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' ' test_cmp expect file && test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err && test_i18ngrep "no candidates for merging" err && - echo file >expect && test_cmp expect file ' @@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' ' test_config branch.test.remote origin && test_must_fail git pull test_remote 2>err && test_i18ngrep "specify a branch on the command line" err && - echo file >expect && test_cmp expect file ' @@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "not currently on a branch" err && - echo file >expect && test_cmp expect file ' @@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no tracking information" err && - echo file >expect && test_cmp expect file ' @@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' ' test_cmp expect file && test_must_fail git pull --all 2>err && test_i18ngrep "There is no tracking information" err && - echo file >expect && test_cmp expect file ' @@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no such ref was fetched" err && - echo file >expect && test_cmp expect file ' @@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' git ls-files >actual && test_cmp expect actual && test_must_fail git pull --rebase .. master 2>err && - echo staged-file >expect && git ls-files >actual && test_cmp expect actual && - echo staged-file >expect && git show :staged-file >actual && test_cmp expect actual && test_i18ngrep "unborn branch with changes added to the index" err From patchwork Fri Oct 18 22:10:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11199729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 153E6112B for ; Fri, 18 Oct 2019 22:11:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E891021852 for ; Fri, 18 Oct 2019 22:11:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AAUjCyvw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391028AbfJRWLB (ORCPT ); Fri, 18 Oct 2019 18:11:01 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34118 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390953AbfJRWK7 (ORCPT ); Fri, 18 Oct 2019 18:10:59 -0400 Received: by mail-pf1-f196.google.com with SMTP id b128so4696135pfa.1 for ; Fri, 18 Oct 2019 15:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vbU+tuIsOpgYa0UzYuQaWY9s/mlIJVUzw9cPvnNUHZc=; b=AAUjCyvwpwju6qSSkLLZj3FGlBl2xB6oStUPXNjALZGyQHxs2gQuJXTPW6vtGH6Sbi fWIE79XuYHtoJjd2qV0gmfknSFKWptpDGfbEZ4vOHYkiTyqvAsu1Lp6Kx4hnGj/C5+S6 X1ebSWWqxk86TXe01agZvsacY732kig2GXWGCnB6W7SBuFgV5C+zt1exIhHV49MQpRet viYfs9t7NTsAqal9N2SVAt90TgmRMgh1+Ti7HZBy9F4QY7femZcx5yGTwbpi6f8TUoSG oG38NY+76hQBFxgxMYEUcDd0DRHrUhc68TxxCIkqHLnNxnddfQiT1XhFqlsEHppKPIMx 2sUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vbU+tuIsOpgYa0UzYuQaWY9s/mlIJVUzw9cPvnNUHZc=; b=oKhtIRh99stgHo5JfFaYImdFXvb4ciWMWmFyJaw7QJdoWxktBqGf7HH6SJpexu1Ig2 5nEpmYW94UFbBSoOTxYGgl1VLD1vkd0De62dafb6fM9PAyzl1mRVUc9xsaQRL3tcWcCo BtUeKHaV2fhfDEAkDlYzShHwTjv9Mi3UV0YwLjh1AGO4E2Zx0XWJogRK/qCpCbL2kf8+ Wgo5RhVxrHdmEPpcpCiecZsaPh/ENJm79TKIyI4DNr+CznV7AmmfjgG03WgUliJ0xl+n sm6mZuAMqbTJud8UmtCKHykCFU8P6NZVQcHyJvRyK8J5HSTijTkKfB4sE/VvA/UyvHJb jpbA== X-Gm-Message-State: APjAAAWwpac2mRAM0831+SBqVGnqXQ67i0Yz2d2hmouQDzH7pNg7a4fY hiFD88cNxvgu9PJP+1GhmZnbxmf5 X-Google-Smtp-Source: APXvYqyiPlfG7gpnsw/U7lh43Z3blk6Xy/Ed32suNFnizT+gXB4jGjxva8j/u4WOcaxC1PBA2Ypvtg== X-Received: by 2002:a63:cc4a:: with SMTP id q10mr12534758pgi.221.1571436658303; Fri, 18 Oct 2019 15:10:58 -0700 (PDT) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id e192sm7438548pfh.83.2019.10.18.15.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:10:57 -0700 (PDT) Date: Fri, 18 Oct 2019 15:10:55 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine Subject: [PATCH v2 15/15] t5520: replace `! git` with `test_must_fail git` Message-ID: <2c0d3ac416ff1373ea74514e36a1a8f9afa2ff2b.1571435195.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently, if a Git command fails in an unexpected way, such as a segfault, it will be masked and ignored. Replace the ! with test_must_fail so that only expected failures pass. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index ef3dbc201a..602d996a33 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' ' test_expect_success 'pull.rebase=invalid fails' ' git reset --hard before-preserve-rebase && test_config pull.rebase invalid && - ! git pull . copy + test_must_fail git pull . copy ' test_expect_success '--rebase=false create a new merge commit' ' @@ -572,7 +572,7 @@ test_expect_success REBASE_P \ test_expect_success '--rebase=invalid fails' ' git reset --hard before-preserve-rebase && - ! git pull --rebase=invalid . copy + test_must_fail git pull --rebase=invalid . copy ' test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '