From patchwork Thu Nov 7 18:51:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233587 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 48C311599 for ; Thu, 7 Nov 2019 18:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CE8D2084C for ; Thu, 7 Nov 2019 18:51:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jkXA80gc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727557AbfKGSvY (ORCPT ); Thu, 7 Nov 2019 13:51:24 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44587 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbfKGSvY (ORCPT ); Thu, 7 Nov 2019 13:51:24 -0500 Received: by mail-pg1-f194.google.com with SMTP id f19so2564942pgk.11 for ; Thu, 07 Nov 2019 10:51:22 -0800 (PST) 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=R1w3FxxbAMlXsqb33I15CrIn8+TcMd9pB2dG70pteHE=; b=jkXA80gcI0gErtMVMXPRq2mvmJlY8D2P2ePxIxqFe1BkvBvs4N86lwgDks8MOzB78A XxbC167wZXwjengt/g6Lg97G0AYOGy9XwJh+Wgvwq34XOo4TZeKd34QmFsLX94SFzX6N t7iJ/zpZzSXCNwD9MYuIUK4wxHGjhwIdXnytI5EZyOrv3yemUKP5Rn9Ag47CAYd0vYPf qKwc1tEY7H4iqwtunbjaz9x0iKGAVMKLCqo4Jw1C/vKaiVny6Zlq4GQw0sY7i8+BKHna xZpgNcHK22EDslydr8QXhrVt+MkTO9luUNda8LsOdEYKBt3/ROW3/vwW/z7BUq4fEZzN RyWw== 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=R1w3FxxbAMlXsqb33I15CrIn8+TcMd9pB2dG70pteHE=; b=DCiBGi2Uv4kkeYVjGX0m8TPyIv6luw58MKOhBYLQ7RoHioh7YB3Tue1AeHPQcO8zyX MuYY5bbvV5LaNSlWqx9AEuoPt/fnhywzJoDkt/jaoY5w5kMuhEOR6wFuvn6MbW6iPR7E 5/7I2Yr07TDdospZ4idC8uGGshBHsnPyotTlgcB49B2wAXruSTRF9dsP0bzRfbvgxu9B gL6MwF9H3sjm/yb2TSDgZWtuEEZyxULCEwR83Sxm9mc0cCc4Rx/WHu5at+xsisdRIYur 7qFN52R0Kl563ZEEDO/atMTO0M2tcw+JjOvuK3KXA68urKK8iG+OwZbH/s5GM5hfo7la OQDg== X-Gm-Message-State: APjAAAVUfVUpEJ4l04KVAuvlb4cOBJrw+X7kMkgApd7J6m9CkmfFt+li z3IaTrXn1n/yXtHwYSVtJkpa6NSw X-Google-Smtp-Source: APXvYqyVkcMnEIHHPfy4VJVjd6BL8aLr3h5mc2s069Eq/KYzIsmGDtzJg5flFDJhL7kegd25Nudsaw== X-Received: by 2002:a63:7a50:: with SMTP id j16mr6288091pgn.206.1573152681331; Thu, 07 Nov 2019 10:51:21 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id z7sm3599843pfr.165.2019.11.07.10.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:20 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:19 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals Message-ID: <0d0696f310a6f8e13ed480b1a1e91cdc2debaa20.1573152599.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 | 22 +++++++++++++++++++--- 8 files changed, 29 insertions(+), 13 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..064131ac39 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,10 +1030,17 @@ 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 + local comp_out + if "x$inverted_op" = 'x=' + then + comp_out='the same' + else + comp_out='different' + fi cat >&4 <<-EOF - error: two revisions point to different objects: + error: two revisions point to $comp_out objects: '$1': $r1 '$2': $r2 EOF From patchwork Thu Nov 7 18:51: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: 11233589 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 3501C1599 for ; Thu, 7 Nov 2019 18:51:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0925421D79 for ; Thu, 7 Nov 2019 18:51:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NY/rqDLv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727631AbfKGSv1 (ORCPT ); Thu, 7 Nov 2019 13:51:27 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37089 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbfKGSvZ (ORCPT ); Thu, 7 Nov 2019 13:51:25 -0500 Received: by mail-pl1-f195.google.com with SMTP id p13so2144199pll.4 for ; Thu, 07 Nov 2019 10:51:24 -0800 (PST) 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=vtUUygPqWJ5q1kM8GB+SS/tMDtJ3ywFWxQG91RjhgHM=; b=NY/rqDLvkGETHyZHTkKOi4szPptDXffFAtRsXv8BG606RiDhUmdcA/aSOu8zVAXk/1 t83aU7mRwH/sJUPw39FZLoE5VjhL1c1Bp2e6gdIovuC9UrdrduxNTT1iuOGdeeU/GIbs 07VcTZvQBU3HkmJIJkDVhcEdKzt20ggXXa3ck7g9qNQfN2DPnIpjYuWhDPP7tI8nYePs dOpZ7cQfNOIHr5LX2MMYCrYE/RT2LHRKKvs6VAoYJ3atzVvIgmZ4v9XuM+yxspeST3ga lk583kgVmSiESOSjT1Tj3CTmuSfe7nF0p7ny2GOFiNmOopNjAhxKc1jqja5JURTCa7dY cO5A== 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=vtUUygPqWJ5q1kM8GB+SS/tMDtJ3ywFWxQG91RjhgHM=; b=JhsVnQ9vc0Z+MxtrG7TrxFy3ENuh01vas7amOhReW9bJbLYomaIwZs56ZYSs+vOxgL XlkYKPJ2A0p6/yV/Gta8u2lrC2690bge5tspqXZHukIpOLUUcc5KWwMrphhbOKBbtzs2 YGeB3tBoMHYN5ISJ3UcZaEvt5rZIFTy9hVlJlpb0caeK+LBQ7189GywaeQhy+XSk+A/t kjjToSpChT09MjUnsY/NRLnB8IKPsWOadQq3GJjhrqU19tp6sTWW++LIrMLuYJJP0OHw kMtDBLKlHjswM3do1zJ4vT8iegPvKuVNpJsTRrmcPKc7PGIyrozkDfh0hXV1E0vyKfXy 1OKQ== X-Gm-Message-State: APjAAAUvpTRvQOkD/RwHrThs4SA+0g+jK40KndNyS5j4vp20Erzam2o3 u6yOCH3l/rOUcHUtqFS3fY8wXjNs X-Google-Smtp-Source: APXvYqyBgUuVMRQW6Z7xh5K6b0RolMyUAq5h/685LwE/b19PdnSJOrcGP1uz+qrNwm4acKD66oVl7A== X-Received: by 2002:a17:90b:438b:: with SMTP id in11mr7163997pjb.129.1573152683817; Thu, 07 Nov 2019 10:51:23 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id a34sm5523107pgl.56.2019.11.07.10.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:23 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:21 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 02/14] t5520: improve test style 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 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 Thu Nov 7 18:51:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233591 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 95E071575 for ; Thu, 7 Nov 2019 18:51:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7397E2084C for ; Thu, 7 Nov 2019 18:51:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oFdLrJ+q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727685AbfKGSv1 (ORCPT ); Thu, 7 Nov 2019 13:51:27 -0500 Received: from mail-pl1-f177.google.com ([209.85.214.177]:38019 "EHLO mail-pl1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfKGSv1 (ORCPT ); Thu, 7 Nov 2019 13:51:27 -0500 Received: by mail-pl1-f177.google.com with SMTP id w8so2142376plq.5 for ; Thu, 07 Nov 2019 10:51:26 -0800 (PST) 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=KSqRXsx6ge6yD5iZlHZp/xY3kn1TsjFuBzDc1t+lOtw=; b=oFdLrJ+qwbanW/IzzFVafFe0leTB27ZdFMdDmWGjkKvvmNiDCqRjnrjHyNAFJjHl/V YFnmysG1wfjcLRS7/7dCRvoSurVDc5PXpO2bRDNrpC1Dvd02ltwc7db0aRnslPRe8tM+ YocY5+2OUJJJ58KCzkj6XbiM1FdlZSfBsn5YWaubwSdOMmXwf40924RTMiVEtdfOq5bG Uu2ItNCrXiCjOqvRSe4H9nRrh3tvOFc5KYZKmjahHFvH4MmAmBvsscljGEdoqH0bqQo8 QrJ06V67JRICA1Qbb6H6YD1lEI7Hh+HkCj4n6Ez5N9T1ozilMNI9aHcuOhi1Xtr4bcOX oZzg== 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=KSqRXsx6ge6yD5iZlHZp/xY3kn1TsjFuBzDc1t+lOtw=; b=CHrIdddCo8Gb11U9Xy0sEditmYAjhRGcEyDc2H/xN3E9lvMfopHqYmuL3McC9800Bx IzFpPKSynBqOcn365wRty8CQsQZbUyJdGYboRqkvnCZB/BTiqDRY792hkT+ml7b34foY W6p2tckEB2HyovDMLRpsrD2xAdYySgFDAYV1dsOBBtDcg7teR/oiBtaZVjB7qByPGTQq IwkVJlCMxa2rJrSoQixlC6H5eERtPdtvj2dGG2gLugoc4jXy+fdp6jxWdU0sVQWh18me MarSS6wTLv7sF12FYbXKZRfZ5IT6RKBLrxfYwPYGuBKVrPrOPo4fDTZv4ogOofKkg9xJ KaaQ== X-Gm-Message-State: APjAAAXbC+oyVSUL9gEi/5bQGDLUQ6kT+eWXIvTf2yruDWe03AHDZEJG zRAC2yeyxwyhUL3sMbpiNHZ8gEY2 X-Google-Smtp-Source: APXvYqxMFtkB+yTgpDccBKaRUkqadfA7ux5XiH6qU1rHDI5v9JwLI0WezTxqCW5lqEXmTIlNFqDLkw== X-Received: by 2002:a17:902:6b47:: with SMTP id g7mr5226021plt.160.1573152686101; Thu, 07 Nov 2019 10:51:26 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id f189sm4393018pgc.94.2019.11.07.10.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:25 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:24 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 03/14] 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 Thu Nov 7 18:51: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: 11233593 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 1DACF1599 for ; Thu, 7 Nov 2019 18:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F019121D79 for ; Thu, 7 Nov 2019 18:51:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NtzN5dCO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727699AbfKGSva (ORCPT ); Thu, 7 Nov 2019 13:51:30 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33008 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfKGSv3 (ORCPT ); Thu, 7 Nov 2019 13:51:29 -0500 Received: by mail-pl1-f194.google.com with SMTP id ay6so2162080plb.0 for ; Thu, 07 Nov 2019 10:51:29 -0800 (PST) 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=olVodVSAYEvL08uENA+7uUiU4nLw+LOIVLFg0xxOF84=; b=NtzN5dCOUtNdcaPgh4EEbihZmGoAc/D12DrEIZWQRNDmuMjbpna1H8YBDG1+YFCCfI GAGgplAMtxmp/VDbOA0wgbLuqp2ESOsmhGucTgJQy0S+7u7KcgIP2FFE7m9Crn8kIt3z Qgg2sNuBunGA31rZu5At71rCucVNcLecHWlulcju/Enxp40yc6vyGxtJhYc7DmsVFVN1 X+4OAEZ1iLjCRDuOWi31CEhjbTbgX3jY39G8F3eGQ2o9PzAcBlYGUvjcDT97weYFLiy/ Apxr/yU81gPhWugrLCAN/rlSsDvtCAEeStB+mt+RUWnOj1WsabTnB0pAU3Lwba7XNb2S 28rQ== 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=olVodVSAYEvL08uENA+7uUiU4nLw+LOIVLFg0xxOF84=; b=ravyOX2Pgt+KTHXQTHgF4vhseTgmcaM2eUEqnXlXhefsnkf1JER7vP7nZf0hJtQg1X /6zLf5MKWeBXJXvPQdI0umfN1zoCwYLAOVYHZbpJaoqeEAkl3ucdUSu7MXFd2AgRS05H JjA3K+PfTHSsGCEKe9OfWBq0eiir+KIQcM8EC5j79+0SzVSMXrEahepZanXx+95GJkv1 QQOPocm3yxMYNE73GCnLHQbX07B7pTcjEz/39iDuYa5fBkgIsuPWZmLTD1hDxblBrOxQ N2x1eYzFryRj0AeH3YAsT6OM93GGy2fXPdAXyqImJZOcd7gooyT2M7cMDOW5WWs2uHPD 0N9g== X-Gm-Message-State: APjAAAWH653TUfOAUcg7e4RzDkfUfzLhKd6wYq31lbKAUYRzzF0vOnFF jHTr71qbrxjl6+cg9qepb1LSNtq1 X-Google-Smtp-Source: APXvYqxc/Dk99cjdgRM9hFbkkRSCok5rT3x2ZswaPilJIIVy88Jsam3kolWbZPb+XGGqmhebGL7j7w== X-Received: by 2002:a17:902:467:: with SMTP id 94mr5347461ple.170.1573152688692; Thu, 07 Nov 2019 10:51:28 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id q199sm3152535pfq.147.2019.11.07.10.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:27 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:26 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 04/14] t5520: let sed open its own input 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 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 Thu Nov 7 18:51:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233595 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 479C81599 for ; Thu, 7 Nov 2019 18:51:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 249892084C for ; Thu, 7 Nov 2019 18:51:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cQH2XGmW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbfKGSvc (ORCPT ); Thu, 7 Nov 2019 13:51:32 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39148 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfKGSvc (ORCPT ); Thu, 7 Nov 2019 13:51:32 -0500 Received: by mail-pl1-f195.google.com with SMTP id o9so2134734plk.6 for ; Thu, 07 Nov 2019 10:51:31 -0800 (PST) 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=3RW7Tw+dMgeqif8ZNQJXPA0boz1zuyGvTDN3T6nZgzU=; b=cQH2XGmWmX2IRgPd87bLjDZtfyduZCyWysD95mfG91oVwIsqvc7nvgHwqG+YKNZHfY 3mS42UlJm+K8mf1R05Fp2kUlo3X3YJki4Qt7l58q1ybeCvcPs8ib8QKu2y005pFuY6jK AQMKLTxUhXtVOMjEpC2bBqHr/I2CIhU+NzelmoPIdwF4ppwzNrpY+oqiNejwPDg9UJ69 wgxuMYwUeDnRFRo3hb5V6fGL2XM+fzMmO1pYTlo6i1ZBxTNBglBB04kY8BF1wzL7EvU9 gcx6OWUb4gKbDAXviZhZG5C3Wk+pAbFmkvjsIE2z0kaQucfGtE0dn6CJz6hmLNzwBm1X XN8Q== 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=3RW7Tw+dMgeqif8ZNQJXPA0boz1zuyGvTDN3T6nZgzU=; b=Ktpat+/NS1emIyoKdPY/YiL99idwQQuT/E9ZJcSj/ciJK1fLB8phcACp50X+QdC2xp slBELbNQT4KUD3wBIcvU43AXXAIb5o0JFTpTj44oweVraVNN/VqtiCJDt9n8eRYLlyPh +6Q1FQT2ahhWAhd65RKIugZ87/qVKV0tx7/UnjowDQLFbaeyM0Na47v/SpEo9QeM+z8Y Y/DXXeMVz+4BVjKor4j7hH7wNWoZdPlEzhSictskbXv8+S7nsjK1spygVei0yey9QAqo hx56LhH/pUyqA2KP6T3pAOdsTxgXgEcn1MSaOl1RVV5rQ+lp2y2OfjsCtJGE6gAq2mMp vcYg== X-Gm-Message-State: APjAAAXfabGhCbLyFF+gu60c+cDN9oervNtAs9pR72URCeoR6R7/X8Fp C7XU45dtU48OTwoTGOJ9Ru59X8xF X-Google-Smtp-Source: APXvYqwD6bxGSrVgBhdoOZulV4Vc3r22t65CRHC4w7yyUksazvrx2zkdXUQnGyMSlOg0Fv58dkMJKg== X-Received: by 2002:a17:90a:5895:: with SMTP id j21mr7340377pji.129.1573152691069; Thu, 07 Nov 2019 10:51:31 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id g14sm3480270pgp.32.2019.11.07.10.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:30 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:28 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 05/14] t5520: replace test -f with test-lib functions Message-ID: <2af85e39133cde036fe1ccd1ed417cdeb3113a64.1573152599.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 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 Thu Nov 7 18:51:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233597 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 913DF1575 for ; Thu, 7 Nov 2019 18:51:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F8B321D7B for ; Thu, 7 Nov 2019 18:51:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eVxOYaAO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727770AbfKGSvg (ORCPT ); Thu, 7 Nov 2019 13:51:36 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39621 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbfKGSvg (ORCPT ); Thu, 7 Nov 2019 13:51:36 -0500 Received: by mail-pf1-f194.google.com with SMTP id x28so3130237pfo.6 for ; Thu, 07 Nov 2019 10:51:34 -0800 (PST) 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=iPxCLePrhm2/kfMH6mNdtlnKt6XOUsR1p2H+WqpKSCw=; b=eVxOYaAOHjo0huw6Uj4JJopaTUXKHqNs5FmqpbtWNriq67V6+LVb9/1vW18xnsnPz/ Z/Ni44l4sLVG20oMkcFZSpHFmRrPNeh0C3LaE3iEcR/r4Dl2GRjukl/Hf0TWWtVdSE4v VmHo1FlA22r8Ft87qtQOhjYEPJmZ9tc+Z2lpVhyuTNTkCF2FRUjyhhNBH3VGnpVwrt8K C4+Ucl5/rEpSsl/keE6d2UMQSbOWyVQp0OGQ0nNXgfK7RyY7um61kz8XXeQXAGkQJjeM NiAmIgM3h0o90j0hOquAWVzugqD1w2kItc3MIcLZPJUuGuFTLLjd+QI/c9LLSueTNrlS CgUQ== 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=iPxCLePrhm2/kfMH6mNdtlnKt6XOUsR1p2H+WqpKSCw=; b=JlWe4VMUELZWbV3d+xXNeIcR2VOBri9LxT1FQx7w2rfV5eMEMK4hVphZkWZ+oYD5Ke eeyjZ9fgC4hfAI9qWh7GCIcUwp84Fwh9sr88dD6EFXVKuUhJNx8LNitqdojKnGdwlwqM iQDaGOvhrCpKMo7oPqo+jLYUB+sD6/KxrFraGqwV4y5LxP/qoLbYNaT+GBKgugjvK2cA J8vLZSZH0nRKcbbaYgUT+dVJp7vY6KT8ZfDJAmG1QkQq0+YW8vmuVr4Q2cNDggmkP2LW csiTq1836Nxxb01UVUdX1PabKvEsby2ZbhtF1nn2t7tDzY0aF+nuMRtBYM44SRv9y1ek salw== X-Gm-Message-State: APjAAAUHtbRHA3JrPuDNf1qjppnyzRy2JUkLcLWZY4A0wnvUR2J9/1Mu KHdHfo2IDcGkGN4YhL6zAlSNVSzO X-Google-Smtp-Source: APXvYqybo9SevUeydWlwSBBD7k7dBV7RmEKxB1UlCUUw3utlCk0InYWGKfQbhXpvw8netwie/4XdFg== X-Received: by 2002:a63:fc1e:: with SMTP id j30mr3049710pgi.158.1573152693848; Thu, 07 Nov 2019 10:51:33 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id w15sm3386054pfn.13.2019.11.07.10.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:32 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:31 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 06/14] t5520: remove spaces after redirect operator Message-ID: <280cfa0adc516810a3e642b5a3425589bc1ad398.1573152599.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 Thu Nov 7 18:51: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: 11233599 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 BF8641575 for ; Thu, 7 Nov 2019 18:51:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CF0021D7B for ; Thu, 7 Nov 2019 18:51:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rHbBBNYA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727892AbfKGSvh (ORCPT ); Thu, 7 Nov 2019 13:51:37 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39625 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbfKGSvh (ORCPT ); Thu, 7 Nov 2019 13:51:37 -0500 Received: by mail-pf1-f196.google.com with SMTP id x28so3130283pfo.6 for ; Thu, 07 Nov 2019 10:51:37 -0800 (PST) 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=LW8/hCM+7ag1gF3rgUI1vQFMYMeglOWvnRFNyloJvqk=; b=rHbBBNYAmyFxIuCWPUW6NXEZHkXxmvCFu6vwvcEr0NrzoZG/Dro3CV/WvxFqy/uMlk 4Mg6nx4MWSu3j09GQZpb0jVe71yd2LcrsQ5Nenvxtrfvmg4crYx7Wh6LgrswfpTdxj8M rSvL/UZCmx5HmFUf7yLHxptpN2Vfb4jDwl5YzfC5g7XC++DY+prRgarw0lEw/Fb6129V HpJjFejiAgYU0UJaP5hALYBXIKsL2V0tfkbbVRvcxpdVcmt7uG3lVafPkujZESrz5yUU Uqq2+VICqLYe3UzZxNSnG82ICR/xFHSWpVDPl9xNU5nvOoalozDiKbwmTrLS3qr4VIop SoQw== 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=LW8/hCM+7ag1gF3rgUI1vQFMYMeglOWvnRFNyloJvqk=; b=e1D7gbEDqI6aG8SI3WpML//BdickyfohIWKMCsJJ7Z67ZwFGUoADHjGcUxriqfmgNg ycMJoQ3X1MSG1HGe4Ov3RoH1mzAliNBRu+RuhiF+fV6gPtOxC0+c4wFcKKdqH1fRU7YV gquB090/Qq4+kznHcJ2ZPkveB7N687WbFYHvwPXtcgJm6/R3UTViRecQF+C/t2zj3DC4 hY4+ayz06eXuHfU+ovkEoqKoZzWybi1zf5WrR6gL3LjzG1a/wbE8aO6gf29keq5DnMe5 oiAzclqjMZtdzHGbg7zLM3bNduiPDbSwVWZ2ulSPDDzFhmQuzYwa/UwzzDHlZ8f/TBvd SK9w== X-Gm-Message-State: APjAAAWulEKy7LczHEv86iq5gNb1wF9mXytgx+92hv+wGty6jWHl0a6i GNU7ITYFlTj9U8CfnsA/G7/zPfGf X-Google-Smtp-Source: APXvYqwxUB6Nlu/v62QOTzaPk6NTW+EtbXncmOQSQLvAHHMVEJSiGw+1eOh3y4WNGh4KBQzI0eEU3A== X-Received: by 2002:a62:20e:: with SMTP id 14mr5895095pfc.153.1573152696323; Thu, 07 Nov 2019 10:51:36 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id k190sm4775322pga.12.2019.11.07.10.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:35 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:34 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 07/14] t5520: use test_line_count where possible Message-ID: <1e8ecb80a4c7bc614f39dbf099fc5fe417e48a7c.1573152599.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 Thu Nov 7 18:51:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233601 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 6AF961575 for ; Thu, 7 Nov 2019 18:51:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 485DE2084C for ; Thu, 7 Nov 2019 18:51:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c3PaoP6X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728126AbfKGSvk (ORCPT ); Thu, 7 Nov 2019 13:51:40 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35420 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfKGSvj (ORCPT ); Thu, 7 Nov 2019 13:51:39 -0500 Received: by mail-pg1-f193.google.com with SMTP id q22so2607693pgk.2 for ; Thu, 07 Nov 2019 10:51:39 -0800 (PST) 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=TiPCmfYzMvBxDpCZ1CIUpZqG/XTg1YN4i5l/jM+IYKE=; b=c3PaoP6XN3DOnvI4zWk5adCrDQ56cbAJwV9PAxE1STs7JsfjOfpeyOs6z3B9ZzUGYs 7zGuq8iqkB6SBNAMkBFZgsXBsSSjQTfJwpYSg2xF+Vgy3XSSoqxtj3+yy3U6WU4d/WAf 9O7WPayp0nJTioLoUWUj9GnWCK4BPf7h+26qhFRg4Ca9uO/ws3mmWxK0sdBH7dY1Il9/ NbhJRCzra9aZN0aX1f8X5KmXCooJzkGTn+LodCeZ7yG6s2+4ih3SfNxSuuGLG3G1o4Uh I/jYdSKbX3pZ3WQ270xCO4Nb18VofBnNsuIPVXr/a2WkwHKaHev1zPDIhZ4A5gj++sKc qvoA== 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=TiPCmfYzMvBxDpCZ1CIUpZqG/XTg1YN4i5l/jM+IYKE=; b=QIJfxGEpkWQ3oNhx+ZQK+sBw5ejqHNCpSnP5esvFbKDOvSINChQjV1GOIkYB4KgPTg 5oTiK/HMMwtT42CD1iGqUznyRoYvTKaIbEH5Cz0ZJI3ILswHNH2tHM4NVoQXXDjO1/Dx 4vv/tvN8tSgmrEVZFM2h/X/vxoQfYWhLi1krtDsgrPcU9jlwbvfj2BS24MVmCjTGxoss OIOcKLvFkthp+lMd+AUpaYu5/SouKlz0EgU8/XhP718Dxto3TXds6z/sxT+LTX1VpaId Gp5cv6l4T04cyRo8s1reW4Kwc+zCx5P34LocHace6B+q0ln89Vw1fBrA+rrtDe9BK/XO hFoQ== X-Gm-Message-State: APjAAAWOTcON35Z8HRm1L6yG1yZ9p3oXnjDjOnpS3vhC6O7T2xBJWsP0 FmN9vA0iRjbAqt//1n45U7/6uzTa X-Google-Smtp-Source: APXvYqyAAfgmJgwVqP0gNTWzA/59BfU0/uJ/RY5nvzIY4Dai4hKRP8S4SQhigo5uRYpcaIyci21xGw== X-Received: by 2002:a63:fe09:: with SMTP id p9mr6220090pgh.293.1573152698841; Thu, 07 Nov 2019 10:51:38 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id j24sm3139192pff.71.2019.11.07.10.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:38 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:36 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 08/14] t5520: replace test -{n,z} 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 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 Thu Nov 7 18:51:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233603 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 CA9BE1864 for ; Thu, 7 Nov 2019 18:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 943DC2077C for ; Thu, 7 Nov 2019 18:51:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iYUyQfU0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728203AbfKGSvp (ORCPT ); Thu, 7 Nov 2019 13:51:45 -0500 Received: from mail-pl1-f173.google.com ([209.85.214.173]:45338 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfKGSvo (ORCPT ); Thu, 7 Nov 2019 13:51:44 -0500 Received: by mail-pl1-f173.google.com with SMTP id y24so2113438plr.12 for ; Thu, 07 Nov 2019 10:51:42 -0800 (PST) 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=Xf27bonguaK88iPVSUiznvhrT5M6F0dGn51khv+8TRk=; b=iYUyQfU0cnL2ApqA/k42P6HuOlYMd76zgevkQ9fueRzueG0xB1aXJzEfZHfChAaa/q aJcFktwjcYKGLb6l5EDmiKnSTu4oUOKlUnSCwqo6l+7dgRLPR0/dJxf3LUG6ewThaCp2 PlkIUsxZ2vxLWrDpoKrgvLwhLxb4Sz0gEneQm6N785pNzsKF+/OdjQ4xfqPSAyohCHkY dyqWTBt5d11h6opbM2W6b6b3I3xzLtCg4XzFkO/U3Z7je9W+dChBSEtWldBK9nV4G9T5 mIJjVPQZj4XN8cGYSP8pTYD1lBsVuxwQTNaSwHawQ1rng2SLPGUSAPwrv+YaBF6gmwrb 5cKA== 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=Xf27bonguaK88iPVSUiznvhrT5M6F0dGn51khv+8TRk=; b=g77tympIbUEBRLy7t76vrD8knch6a34tO8LoPSy9RaqwNnHs7qwFKZ+B9rP0G6+5LJ npv4R71AnPeJaVCmD+Ma+mxfrxosTgwh6A6t+AwcXKpEhqp4HLnk+Digx5CNChb5MQgL kPg0n2WMQWpEnSWiaVOV5peV0oF4S7EHnwrq6RfpxmkFYwISf4ow/xGsXfUg1+wa8RWg gp33ooz+VNpIiHh0NJnPaEa/lbLbSN0l/mCpJskhp8fmSGE99UId3vaccsW/1HfBdmgM w7X49bdl/VQ2L+fzg0om762hTG0lpEzK5T1qNp74BzDaJkZzpvU4NxNphdEHL/XZQHYf 4Egw== X-Gm-Message-State: APjAAAWV2H2pwVincNSOW7e8pJeMKlNf7DyXpsQDUAc4KnqJt3Fa6U14 WbaIGb1Y5GoL+VI1MRIZWk0iWUe5 X-Google-Smtp-Source: APXvYqxyMTxynlDjFT908adK4mhk0kdYd2k3hTyqX26WmvWkQUfpBqz7X2E+h1B4pSFtdP/cb1i/Ug== X-Received: by 2002:a17:902:ff07:: with SMTP id f7mr5444597plj.216.1573152701193; Thu, 07 Nov 2019 10:51:41 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id b9sm4857246pfp.77.2019.11.07.10.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:40 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:39 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 09/14] t5520: use test_cmp_rev where possible 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 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 Thu Nov 7 18:51:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233605 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 143C81599 for ; Thu, 7 Nov 2019 18:51:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB6EC20673 for ; Thu, 7 Nov 2019 18:51:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T0q1o/+l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728292AbfKGSvr (ORCPT ); Thu, 7 Nov 2019 13:51:47 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44490 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727825AbfKGSvq (ORCPT ); Thu, 7 Nov 2019 13:51:46 -0500 Received: by mail-pl1-f193.google.com with SMTP id az9so1292102plb.11 for ; Thu, 07 Nov 2019 10:51:44 -0800 (PST) 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=VDQNzey+3g9Pktk/4Mqo3SYW43UaBhQqGtrlL+o/LGg=; b=T0q1o/+lb+bBPCRJ41wMDwmFPap1eY7f2WL0aZpEbU8BQY/YjWFJfpcooEA18iN/1f qKB0jPoIeAkT0JNNb/EQkFF6V+9Xk9uqfLBiT/0LJe2cMZWk+flgKOtFm+1Pz+qMA4RK XmuOdlOydbVxpVk/KgxLM13xkSCLAV3ST5qC+f9vRIUcQ6WWDfFZBEJLKB3/Rjy3K+C2 /9k5WA373bEr3OTK4z96o+5IltI0h2BN7vse3Le5X7D8I7uxyN5TwntrYGLkG5dvH6H9 LclG1zsy5P6heA44nPP7Ym3m58NmA2EiffOz18VUI9848CK0tuEzXwBZ6gJg6WQTLomD 4nuw== 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=VDQNzey+3g9Pktk/4Mqo3SYW43UaBhQqGtrlL+o/LGg=; b=USwlOho7tpCDW2q6m2FyxDl+VtSndS8OFAQKQqV7h5021NZvi51rTt9X/15bQbZpO/ tpDC2pfbIsbEmaGZQrpP2XwDihf+7rrvZno3ADrvmkPZArzEvGbR68x+hKb3r6ULvOLL 4v/ZkceQ8qsXtfXvMAb6MM/Mo/wuIyhkySFMTJarFT9u8RM/tPT525JaX5U5iKzwsUVP frZzP2YJWiK6v8YJ5l0waBkgzDRsCR1QoNwUqA7FHJy25slBkjdQuudPa14qkYGwf8kI ygUfmQEPmiypK+WRlwlkRmArZIQvTSS0Y5/b8l08CYyAYRZ0kdqufj1uMJwxUgcTP5Js n4uQ== X-Gm-Message-State: APjAAAUorTF4M6cXFgdPuzda4b6iv0KCOXz63akRqad7Ul+XrbOGTZkH jCeaegxeSQZt+Sg10q0UyCS43us9 X-Google-Smtp-Source: APXvYqz+yE38AgyFi4RKtgQ2T6wDjyigaysD/SgW+igv22CEqWtRj8TEF4MEv9lN5HLx/cVsWUfH/Q== X-Received: by 2002:a17:90a:850c:: with SMTP id l12mr7394410pjn.16.1573152703565; Thu, 07 Nov 2019 10:51:43 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id 62sm4028233pfg.164.2019.11.07.10.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:42 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:41 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 10/14] t5520: test single-line files by git with test_cmp Message-ID: <6cb78bce4061455cdbf2cad7672c4e9c2bb188ac.1573152599.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 Thu Nov 7 18:51:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233607 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 71C8A1864 for ; Thu, 7 Nov 2019 18:51:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F1E32084D for ; Thu, 7 Nov 2019 18:51:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qytDLITS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728294AbfKGSvs (ORCPT ); Thu, 7 Nov 2019 13:51:48 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34313 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfKGSvr (ORCPT ); Thu, 7 Nov 2019 13:51:47 -0500 Received: by mail-pg1-f193.google.com with SMTP id e4so2616677pgs.1 for ; Thu, 07 Nov 2019 10:51:46 -0800 (PST) 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=E3sVJOSprGW1kZocGfXTxKI4ScsS5+LToeKaeIpshoY=; b=qytDLITS9762X6kqEkwPSFkNNqG4ZGpG+2ejZPSHFtMr77qlbyfhN1duL6uw+CMszT m3vSvRgk5jU/4IyIupOMJvPxGQJ0bOgEyBh8vodPhVDr2J0YRIs90xkoa8bmzqQuTTkH chLpV3cjo8MFQ1mbucP0lQ5Po1Q1lqF0YUaM+WL+K6KX8wPmd9BVNyZvx19J77jy8yXW nsMe1Roxeem7dnDNsymHGpzpwElkAVqnbnelEzkSug3UPfZEK/2q0g1kmnGS8ZnaqgYL SMNoapTA6BQxGFm9is+d1OGheI63OG+gxaTgn8fM06uHykIe8jSdpek62PwWR8q6TGkh 5hGA== 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=E3sVJOSprGW1kZocGfXTxKI4ScsS5+LToeKaeIpshoY=; b=TyJVslDRA6YnihXKy/QwI/oCGQFcbGRHV895uYs75P+0UzLS0ITGXUaIen+kXN8rR3 4jn+VxWMWInp4pYTHbuy1Nc/rCSf1qqo72NxxyK11nIvUi+NvF/0nlAIWVFP+kj4fG2E z2RN2Q8lUWoMtkm4lFPrsAyYUPw6i0awlEAtV0J2oObEtxQsWxoO50OAHgoMH8lv2yZr uG6TKTxAXDUJqy/Dp0G3PyG8uT7pAnPHMQSxhGubhYBlSAAceHrQ7rzNMtYYidYYU9Yn kNB5lC8bADnhna+VPtTzaYH/5xHPGrqbV6+zh9/rY1WuDQd1zY0F5qM1/1pESUdza3yE fsfg== X-Gm-Message-State: APjAAAWy/FC3+w/RhX0NKcVeDd1p8xqY28DuCNIuYhMDlZx/QTva3gln 4uYJwAfVpj6lywTwWISBq+pR0SLi X-Google-Smtp-Source: APXvYqyNxK5PXVQjqTmCK/ibCT3MFsWKoz4fhXiCI7TTV8gMRZKiJjIf4I/W8AZ4xH91ED0HQuJqsg== X-Received: by 2002:a62:14d0:: with SMTP id 199mr5900211pfu.147.1573152706166; Thu, 07 Nov 2019 10:51:46 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id y11sm4218242pfq.1.2019.11.07.10.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:45 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:43 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 11/14] t5520: don't put git in upstream of pipe 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 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 Thu Nov 7 18:51:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233609 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 F170A1575 for ; Thu, 7 Nov 2019 18:51:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B09D72077C for ; Thu, 7 Nov 2019 18:51:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I7/DK+Y5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728325AbfKGSvu (ORCPT ); Thu, 7 Nov 2019 13:51:50 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:47053 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfKGSvt (ORCPT ); Thu, 7 Nov 2019 13:51:49 -0500 Received: by mail-pl1-f195.google.com with SMTP id l4so2104816plt.13 for ; Thu, 07 Nov 2019 10:51:49 -0800 (PST) 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=MRV2ZywY1gvncpNluWSVtjtjNJA88SGWi8emPfvjL8w=; b=I7/DK+Y5vU3iDT5UZ+1qhq0p7BcJTIsBeTGXjA4YHmM5HXpyV8zQiBwW0k3Egf8JCa 7l6URagLay8tJpLcwhLeiwPpe/GLbMVfqYaYG9lPiJs8hOPJn1qWZwHGokitjj0NjUDN O6XokVY6hFKiHRZL8k5O6TONxe0pLzG8F1VfRTikGJxP0br2r1wx6pB25eBnv92yOZiH lTLdr1fRL39fWL8UcZw6wMJ7SwqLq/S2PLKQAa0lffkqQRqHsfLnv/+iQvmkSC863pea SKCD7PXI7lePl0xtaAujhSupG8+spzc6xdU7xMCxDjRqdGrwS55DOFd/w8tZPaZvboaL Y8Zg== 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=MRV2ZywY1gvncpNluWSVtjtjNJA88SGWi8emPfvjL8w=; b=fvoXwENfROCGHa4/5QsxJGYAgHeIGjsds5uQJdVZoRh7909fiWcJOC/DqOU1VIa2Nr erS5l/3Paubr0cgcwE3EVa8gpcx0biQGc3io81gEm0CbgsjZcH8uT6wWlq6YdNNcmwXb XJd0kzv9wV4Y0dSlXh94GymBWUayZgoWH+mbkJ+7nxZo2gG+FPX4d4qL9gP13gKSrlmI PQasGNISArch0svupaUAuHiBTEwfFKnOetxwd9B1A/YiAAAXUPR/UV4FQefppwKeeXNQ pGmYNuDZYSrf28AtlGa4pBMjNSDGauo/B2u1/HV4mlbJu091EioXCkET1pKt2YEWTcOP ANqg== X-Gm-Message-State: APjAAAWWLOH3UC5kKOliKIoyPLKfWO9qSBnoONi+Ga4Yg3q1k6ugH30e BsFps4U7mF65YUElhXN+zySy/mU0 X-Google-Smtp-Source: APXvYqxBw+MXs9baahgQH6ZxEfd6oYRj5vjB/6xol0XtiBMzZg7/7iT3DFKLPnCaJEpoJG8NIi+QNw== X-Received: by 2002:a17:90a:d152:: with SMTP id t18mr7163060pjw.119.1573152708683; Thu, 07 Nov 2019 10:51:48 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id c2sm3398599pfn.55.2019.11.07.10.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:48 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:46 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 12/14] 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 Thu Nov 7 18:51:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11233611 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 B2E2D1575 for ; Thu, 7 Nov 2019 18:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EE7620673 for ; Thu, 7 Nov 2019 18:51:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ohQLsBzK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbfKGSvx (ORCPT ); Thu, 7 Nov 2019 13:51:53 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39193 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfKGSvx (ORCPT ); Thu, 7 Nov 2019 13:51:53 -0500 Received: by mail-pl1-f193.google.com with SMTP id o9so2135558plk.6 for ; Thu, 07 Nov 2019 10:51:52 -0800 (PST) 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=nyJkNi2RC8Uc+UwszCOT+m7gidyiW2BU1hwxpru8MBM=; b=ohQLsBzKjHeMPpci/jLkd6nMyWbas2/uCHsaH4nur4hrwRXQ4HF7E2GvJed8kRPeLE fSWgnQn/9CTybgJSqCC7dDtDDYuHBqnjjdgEeLJkOMoKLScYIHH1gYAXxSnZ2Jekr71F a82WNBmUSjr6yATpQ4/hclAwhKwAHQCjhQDDK8wrljDqw4s9saNaJHYB3PpkWFhay5aZ ja4wXuhDixh6/m6azPpubjtsFzyEUTAzx+mhfLSezGWDtudWfB0Il7mKFRPFKNNRSWzt QkxdiHQiC8eISlSDiu3XJnNf7nC46UsRgb+3AS1OLTEhkr5LYP7+miWd7jk5+RnGIIN2 YUbw== 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=nyJkNi2RC8Uc+UwszCOT+m7gidyiW2BU1hwxpru8MBM=; b=mfBxldiy6yoO5bXqDR3iDM4fBgpmdBt9hxTLmwvDmtuMNhYoz2DiFecHyLq6RFfVYa xB+mivUr7O7HD1gHtk0zM1dzrqPxyReS1WoFnvujbLbVGbbSYwdgVJ8s+fxPwsglm3Md GX8xJjJprwvkV5jGypoFFfm1vg3BQDzKNa9TQaUsdqJuIIZRv516ycw8rQDeEi5BQY3C WxiDn1Rurio1J8fQ9UhVmteYKErVRB/LRjEOSjMYxCI1ZHm/wEUWJhcXxYGx47pfPfjl pJx6Pgp7CWgt6kHjdEjlJSNdwC8nRnP5VFc+Ig/KFx6OX7Vert+7THe22sOEu+0dMRAg l3ow== X-Gm-Message-State: APjAAAXaFy/DJ+ynoQBLaWTXlR6jyCxsKJE1nJATUW0wk4xi+voQ1son VzUEhgiws2eQmP9G4EB61bfM6Ee1 X-Google-Smtp-Source: APXvYqwe8RIIB+jx/vTx9ZhkGn/R8mrSNWWlB57slvpKUBFmgmNXmwUlxyfuqPfM0cvthtsqFYWrEQ== X-Received: by 2002:a17:902:326:: with SMTP id 35mr5347147pld.248.1573152712081; Thu, 07 Nov 2019 10:51:52 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id h8sm9664262pjp.1.2019.11.07.10.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:51 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:48 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 13/14] t5520: remove redundant lines in test cases 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 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 Thu Nov 7 18:51: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: 11233613 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 C06C91599 for ; Thu, 7 Nov 2019 18:51:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D8E42077C for ; Thu, 7 Nov 2019 18:51:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ch7edLAS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728383AbfKGSvz (ORCPT ); Thu, 7 Nov 2019 13:51:55 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42600 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfKGSvz (ORCPT ); Thu, 7 Nov 2019 13:51:55 -0500 Received: by mail-pg1-f196.google.com with SMTP id q17so2575370pgt.9 for ; Thu, 07 Nov 2019 10:51:55 -0800 (PST) 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=2BLCzK76FFm+HLc9AK4IO5s/ZrE3apkIVY4M0J3ZR20=; b=Ch7edLASZALuDOh92OVkTLNbBvqgGxC+PUA4GyBKUowT/TYSkNoXYxtRJjN2/zC/Q6 voqhGk1n6AddAxJELXY1cOkdJttX7KlHKFNgcGHpcsb9DQtqHRaZJUV7N0RGHHWAAOkY Ye8Iczc1TlHipVxtJzMhRklxw+d8bambLCCDn/KLjtwGXtC3zrMKEm3WWAEnUFKM3SFy ekFnbSiZ2R4+5AWB9ldBHWlEhpuXiSiXPynnnOPP/8V4AnsxfUWNR7fXQJQTldiIrhlL M78bpxLAnnUnVH7YBQ9wCJkepu/6IQ1KwLjmr8Qu68zJSOtPsxveQPnz2dgCFli/BGJB cHdg== 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=2BLCzK76FFm+HLc9AK4IO5s/ZrE3apkIVY4M0J3ZR20=; b=brNnzeFqtwelsUtYYVX6cPJesX+wcq9ieGU45za3HTSKdD0TBUS1tPUTxH+ewHUxf7 wW6Xdh4Z54mW0c2TECztsX+4ba4mNi6oQ/Hdd9Rh4xO9M8Pji9RvpAQhCikctQR9+bRs TwoRyFq4IbRhUDfae6Ge3hjivNhOktgWs8BkakraxfL1SoR5uN5CszJmQs88x1Z2xjNR E6qYIRvV2bNkvnTp1KDkP27gwMgtFNtDKr7DcmtUo6My7IYxsOka5TTzDErvfu4vPHPU FRs5SRKSn7H6BEESkg/N2yzpUvG/Va2YpVhnvSriSo02jpJ5sVbeHqhb5cqcG7a0NCGs X7EQ== X-Gm-Message-State: APjAAAXul3EOphfPfP0Ctmxr54lQOGVM6977RiJU2meNpf1rjmMqu4La ji9FdiZRyf7HW8AvDqPaS79nLbJN X-Google-Smtp-Source: APXvYqzLrP0rh+55h477KxhGMu5F5WT46rsjQf9CPvY5CzqUm/XFgOP5J1NrxVyr4TGGHHeUijvo9A== X-Received: by 2002:a62:545:: with SMTP id 66mr5843600pff.1.1573152714482; Thu, 07 Nov 2019 10:51:54 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id y144sm3840747pfb.188.2019.11.07.10.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 10:51:53 -0800 (PST) Date: Thu, 7 Nov 2019 10:51:52 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= , Junio C Hamano Subject: [PATCH v4 14/14] t5520: replace `! git` with `test_must_fail git` Message-ID: <70698bd9020ee896def07c36981767e331d2047a.1573152599.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' '