From patchwork Tue Oct 22 10:19:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204191 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 BE8BF139A for ; Tue, 22 Oct 2019 10:19:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92C7521783 for ; Tue, 22 Oct 2019 10:19:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N3oR+sds" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731764AbfJVKT6 (ORCPT ); Tue, 22 Oct 2019 06:19:58 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42659 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKT6 (ORCPT ); Tue, 22 Oct 2019 06:19:58 -0400 Received: by mail-pl1-f194.google.com with SMTP id c16so4393942plz.9 for ; Tue, 22 Oct 2019 03:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=s9gtzXbkxU2AwA1Az3M4p+6fdX0e/8tFrxZmzvsFb7U=; b=N3oR+sdsClptlFh9fjTnulJRN8s5IHRU3LcUjIB+4ZzFE/siyZU8eLZK9pEp7Bsa0w 2SrUgUY0CL9m16xnTJAnqc1MGHPUJ85eDwtjZGxnU+pzFJNxHIGDQoZEG45mHd1VeT9u TTGc3i0575lVbkHXUSAfuAF7yK7Www1VANzXesABZF1uGTLGr8XlhabFmgNvDrZ+869l amwMsG76FjMgCIdikyXGI316/REiiH2gKG6LXvcKbNCFhB3ZDQE3FKvkvhkVZDcXWxLV D4DU8n2qxUMLUHcb4VmeEVm5mMwxaszXXEnquvsUYJr76Vj9NNk01F84FfkMHH7QlstO z1Ag== 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=s9gtzXbkxU2AwA1Az3M4p+6fdX0e/8tFrxZmzvsFb7U=; b=rvIFqV7ZTOcVqoZgmOWSCysI0nVeEZ/E+1QX/4AKQiCkmyrg56OkmrEaXuRx0ZAtvj 9FrMTXZBWJqD0FSleqExoNJdhFLI2FkhnYMrVGXsDV2B87kecZ29Maa8B6VPh2UBIcko Sc9zCsqSqsFvVrb4YN0ynbHB5d7CzOkUMgMzpjZhEFAhtY4EfAH/uXAU6uO20oQytr6k o45XU1MCjqDT3pmv3O6LR138Gaz0Y1O6Ebtbr4ZNZP95pz4iqvs2/57t5KGQ6Z/W7r6q J3LQdyiHm1Q4RtnEFloppDlVH1smq4Mu3uiFOZgKGA4ZwRWjAHv5bi39IGgqLXvB1s2D blZw== X-Gm-Message-State: APjAAAUV3WNS41Ieg/eHhJtPXTfoQc3Y04PUpYByvKIUxV7Sv+zC4a31 GWcJ5PXKevMMM+uFmUyX9pH93ng0 X-Google-Smtp-Source: APXvYqyWtwlMaukd7I1rXjt2KlWDJgLXRWP8ZRTop+VAu22+4WyNXIecTzj+yHbUHVV9fJQRHaF7zg== X-Received: by 2002:a17:902:ff10:: with SMTP id f16mr2947638plj.102.1571739596975; Tue, 22 Oct 2019 03:19:56 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id y129sm16485520pgb.28.2019.10.22.03.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:19:56 -0700 (PDT) Date: Tue, 22 Oct 2019 03:19:54 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 01/14] t: teach test_cmp_rev to accept ! for not-equals Message-ID: <9a96f113e74601dda8f7f300b13dcca19ba3285e.1571739459.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 Tue Oct 22 10:19:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204201 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 20C351747 for ; Tue, 22 Oct 2019 10:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F15932184C for ; Tue, 22 Oct 2019 10:20:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qDs2AkY6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731777AbfJVKUB (ORCPT ); Tue, 22 Oct 2019 06:20:01 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38906 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUB (ORCPT ); Tue, 22 Oct 2019 06:20:01 -0400 Received: by mail-pg1-f195.google.com with SMTP id w3so9668619pgt.5 for ; Tue, 22 Oct 2019 03:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ugwryf6FIMm34N7g7Ikl4wn70qxj8jS0R+unGUfw3Yo=; b=qDs2AkY6+kQckbbPUznDEsvY/oZoXxeFhQw4Q0EWlgxdKhlGGWVTbQ/9ySkA7dyqu1 2oxYIO/4sqIetu2RMh/OHhsDn2+9wTevvSjxB6pAlbHqh7ascZ0RnAAcrFgeByO4C3H8 ceMc0JfiN/gX6msbAE9cQR0oB+0eM4de9SYhF6Dp2/CtZYTmAi16gndq5yGN8B+imDjv NIjdnaLcIcWYn2sJzh5YLH5JGIXOq1KYiKsqBO4vBRGXerLorQYGZBihFWbNVAcCvEZ+ +SE9ylHQYeVhfMAbCsy7myB1ulr85fSNFGlqV9kHtRoj790ytOnE8HlHHjaROB5Tdz+r FlLA== 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=Ugwryf6FIMm34N7g7Ikl4wn70qxj8jS0R+unGUfw3Yo=; b=VlLkZHkHzsOZfr0NUsIx/11AE/TlfOhA6g9/0f94htz9j9B4GcxEEKnOHe2d0jXbhe oy1PaT9+PgYWqjx9ze5IV0epCqWvHMZUmef+W1mYMXA99twR24M3t6is2pELYlshope7 wXbMuD6CpQOqE8LR4kXg4H+5NQJiGaIqw+2lu3gtCq0jsZxDtkIccS8oENe1AU7nmSRh tsVNUVKJwmVyRjSpHDqty2dOl5hTg//5LseyTUjFXGw1rsVnC3pwk03t7/dfcOR5jpy7 P7mSN5bttVih/t5DcG5wZLCgFvmy1QIhFRl1MR/6Gr7fhT+P5yndsG6j5AxF9NJtD/cJ jd0Q== X-Gm-Message-State: APjAAAUOiZ3uEWZ437LU8K1+trhx8yf0GU7EqoYMd0wQhSIC1I/GRvrn B7WcfnQNzSnq49M1VCzeVe3ierXW X-Google-Smtp-Source: APXvYqxXM0X38qQE009L6zhJCTLF4esruoH7nw+3uTUetZqFXI/T0S/6C4fPo5uY/d+cFyf4esc7wg== X-Received: by 2002:a63:e145:: with SMTP id h5mr2951684pgk.447.1571739599617; Tue, 22 Oct 2019 03:19:59 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id r18sm21835792pgm.31.2019.10.22.03.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:19:58 -0700 (PDT) Date: Tue, 22 Oct 2019 03:19:57 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 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 Tue Oct 22 10:19:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204203 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 4D3721951 for ; Tue, 22 Oct 2019 10:20:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A38421783 for ; Tue, 22 Oct 2019 10:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TXqty6y2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731761AbfJVKUF (ORCPT ); Tue, 22 Oct 2019 06:20:05 -0400 Received: from mail-pg1-f178.google.com ([209.85.215.178]:36067 "EHLO mail-pg1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUF (ORCPT ); Tue, 22 Oct 2019 06:20:05 -0400 Received: by mail-pg1-f178.google.com with SMTP id 23so9672548pgk.3 for ; Tue, 22 Oct 2019 03:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DCwWFgLOJ3+S9zGCzbTDi2aejRqoLZ25HtDbmBmhWME=; b=TXqty6y2mdUaMpQPbCS3UuWiLs1xutwRsezJYSQUdvlwunu8t7Q42aCa9aq9I7Vdtd GDLFEqZDfAvvPtTdg0Xi2po2smWsoM4ONpuYGMPbDwhQoKLcqF6OqmgK3/xnCwz5N/Os /etTQuLVQN8lkgNcyNwfN6qKhr37XuWBYdjyRdRc/8ZaRHCL1cdI7eD12mpEU0thTGnl ZfzwMJSPr8ffBjDo7iq/WirmzA2EDGANQY0GRB45rJdxeyxhSfj6n/WyxWnl8I+x3Skm AzKoj9IA3pbqJX31r4sQ9f8G4R8AvZu9/o6Kvosk6jMWrVOTA0RFlH+44p9QHLqDN5x7 hv/Q== 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=DCwWFgLOJ3+S9zGCzbTDi2aejRqoLZ25HtDbmBmhWME=; b=P1nxoRizoupeW8/c0RORT2t6FwrXupJM8LUDs6xyUVJUuy6ETtH/ZyJfXxlH4wzeMz w55llwhKcljBDpCoUVNm5tAPpvItnPuQetoryom+EjKBNZPlod4pbq9FPZ39Htqo+pq9 1eaTeii37wwoGhxnOCstj6rgD24cQ57aEaWpVAZRCmieZqjMhsMBKhJiUg4DtJTeY5WP r/XR6XATVLMm7CB+5ZkEVi+IqDa8ivCbE0qShYHYCjbN5gdvTTsY7ykNLnSX1tgUJkU1 O/8ykqIo43e8+9ty3dJ0j26c1UOlyVGfkvETdaxQYkDttzYTQG97TxY57IHCqAZ8DlBm OKYg== X-Gm-Message-State: APjAAAXAxkCvB3j0pWsMf0AgVU9smDX71vhJ2+wtFK7E9wLXU4V4UUWb d1xG1q+PG1qmqE0EGT8UQhbxY+00 X-Google-Smtp-Source: APXvYqxmRq6Nt/7aP7jQfXA58/5C2bjkBctwQ3Ssi6nPc5g/LxXSf3IhQDZAQmSW+vFz8EsYuCh0+Q== X-Received: by 2002:a63:f844:: with SMTP id v4mr3026766pgj.248.1571739602339; Tue, 22 Oct 2019 03:20:02 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id g7sm1597759pfq.143.2019.10.22.03.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:01 -0700 (PDT) Date: Tue, 22 Oct 2019 03:19:59 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 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 Tue Oct 22 10:20:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204195 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 37B84139A for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 10F5D218AE for ; Tue, 22 Oct 2019 10:20:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JJh16r6t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731778AbfJVKUG (ORCPT ); Tue, 22 Oct 2019 06:20:06 -0400 Received: from mail-pf1-f179.google.com ([209.85.210.179]:39602 "EHLO mail-pf1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUF (ORCPT ); Tue, 22 Oct 2019 06:20:05 -0400 Received: by mail-pf1-f179.google.com with SMTP id v4so10364527pff.6 for ; Tue, 22 Oct 2019 03:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UPmxpvz5/PCY/O3qjCziVp4k19Ep1/zOzUcfziyRfrg=; b=JJh16r6t5PdZK1ZBLwD721ecDcqqwQCnG9HkuNbyAcTN9bbn3/JrVzdqE+z1kuwGG8 WdRBWab2Pfjd2aEfbQOtDZHxiRAvMMRO/b53sLpVHG+8OnWim+UIqXutBwoZHG8RVmey W/tqMTEYDAWrUjsCSwlnzYra5zK9Lj8g8Tdd+Tc8b+sNljCEr4wzfJBQvlanpaQCFcwT tvJKkxTrjrYkuBjDnhS92OoskUYXFwFRsFSzdp6boWxX+LV78Cxx6J5ByE9xbX+On4o1 cLTU4BHul0/0cFhC7md+2MBR9Ad+RGOd4raZz8m/6n20PZQ+KF/etyN8Il3/4wmPoeab R7yQ== 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=UPmxpvz5/PCY/O3qjCziVp4k19Ep1/zOzUcfziyRfrg=; b=oB+Rzm0z1UCocK3LpgYoiJSyCrWGigLdoUZjzgtDGNDfyBMd7swHD9DQYFWsPdypuC tZYI6Sth37MUqOQZx1yiqHwpBIQPVI+0Glje/TF0R46PU7UhUaQpZn6UkJz2DvpUcBlw 4KUNsdizZHlBYo/f65sbiHDhNAMY4ohsLKmZHMKg4U65zw81K1FjAoYYFuSbWXpjMRFo eZE6t33xnhlC3YSuA0hrU2hYRUH4XQ3cynGDyMs+4UFMfo1MOkWL5z7PafyGpuoNie/H Z6+9gOQ5Bp5FTYQXUUlUaw7+B7ZlUzWR88qx6p4DqaQ0u6dtTt8y3ekzTs6w8TeTgz89 GvpA== X-Gm-Message-State: APjAAAW0/9W8IGUPQCACP8TLscYPUIKpwMl1lK5qDtiUcDvo1IakvKal lPY7zQDThWP7S8xScdM/xOc5ENUI X-Google-Smtp-Source: APXvYqwcuK3HX40EyI+laDbv3xcUzPmA4LshDqbWwx35nt+fxksL5TTlZPykZT1N2W6FZv3DszM+Ng== X-Received: by 2002:a63:b24c:: with SMTP id t12mr3058938pgo.340.1571739604791; Tue, 22 Oct 2019 03:20:04 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id c125sm18575934pfa.107.2019.10.22.03.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:04 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:02 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 04/14] t5520: let sed open its own input Message-ID: <0af3f5027ba9aa68da631afd21b32b534cc80cfa.1571739459.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We were using a redirection operator to feed input into sed. However, since sed is capable of opening its own files, make sed open its own files instead of redirecting input into it. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index a3de2e19b6..55560ce3cd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -5,7 +5,7 @@ test_description='pulling into void' . ./test-lib.sh modify () { - sed -e "$1" <"$2" >"$2.x" && + sed -e "$1" "$2" >"$2.x" && mv "$2.x" "$2" } From patchwork Tue Oct 22 10:20:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204197 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 5D4B31951 for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C1D4218AE for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ugCXjhN0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731789AbfJVKUJ (ORCPT ); Tue, 22 Oct 2019 06:20:09 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44981 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUI (ORCPT ); Tue, 22 Oct 2019 06:20:08 -0400 Received: by mail-pf1-f193.google.com with SMTP id q21so10348742pfn.11 for ; Tue, 22 Oct 2019 03:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WfTfRLFhXz1RU/LqEDa8JaobLYBGmAz3HY+wZYyQVow=; b=ugCXjhN0yTfUcREmP2IW4rVrFzN6wu049rYkFEJN1yzZuusA48oWz0A53eYcmJz2zG Jg5Xsb6VtY3v+MJuZZTQ8ruIZoTCJEws7OvhLOrcMzzsUIQCCYSspOWDLK3lNBWH9kuB kMFM06RKs5RDjjXVn2P8UKiWx3bwoA2UMU2uAIKt8vE8JzSmQbXmGM/iM5xdELzhEAFE t9VH0MW33ctgkw7CsFym1Lh+m/NAlycdjkMhnmtjcubsZaCryBDA2Loxg5CTj+GzQzyv 5amYcNSW9CSdeiKKJW3F7eDqLFPh0ZbrbPe8Rco510mbGHUF0kBt7KfsjsZjA8L00ruL LEUg== 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=WfTfRLFhXz1RU/LqEDa8JaobLYBGmAz3HY+wZYyQVow=; b=GhX6cyp0oK1guzdSJVsEMc1fshxyZpHTTgqohvhmLaecSEjDWgP4IvF24hFHWHguR7 kSs9GO0Ml7OiORhEQbLelbcepHOp/gn1REsmPrGU72bgUbM1/Sbf8iyW8unkvKobOfq3 EF2C/pCMTDf+GTcklY5zRN9c4la/gOPHMea+l7TRWO8gGpqg3eJp0lL6zkE6ZcQxn/IO 8c/Lya6bN5T06oN2qabYrs6oD9xfnM/IWklD8bqYt1CmCT7T2EnLJMxfm+nxHFlwXC/N RpH3LQ6fj1F5bsYpv9fax5iIo4JkzipenWH5Wbtsro2YqrWvozrI3yoxhx93uhqhBQo6 ZecA== X-Gm-Message-State: APjAAAXbWEv/HGZmfHdyokt7tfZsR+LBZzdmwMMYHbR78Ajp6Jp4sR8k +ipfNvKIGE+nEAnmu6HCetlv8Ibp X-Google-Smtp-Source: APXvYqw/bUxtCmhVWo7JTgw5/pqqCRiJ7QGRbsOZ6epCcoEhCTCpxyAGd2n5ewJrbECHMWtFxsNLsg== X-Received: by 2002:a63:6989:: with SMTP id e131mr2952593pgc.190.1571739607429; Tue, 22 Oct 2019 03:20:07 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id c10sm20679196pfo.49.2019.10.22.03.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:06 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:05 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 05/14] t5520: replace test -f with test-lib functions Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Although `test -f` has the same functionality as test_path_is_file(), in the case where test_path_is_file() fails, we get much better debugging information. Replace `test -f` with test_path_is_file() so that future developers will have a better experience debugging these test cases. Also, in the case of `! test -f`, not only should that path not be a file, it shouldn't exist at all so replace it with test_path_is_missing(). Signed-off-by: Denton Liu --- t/t5520-pull.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 55560ce3cd..004d5884cd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -39,8 +39,8 @@ test_expect_success 'pulling into void' ' cd cloned && git pull .. ) && - test -f file && - test -f cloned/file && + test_path_is_file file && + test_path_is_file cloned/file && test_cmp file cloned/file ' @@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' ' cd cloned-uho && git pull .. master:master ) && - test -f file && - test -f cloned-uho/file && + test_path_is_file file && + test_path_is_file cloned-uho/file && test_cmp file cloned-uho/file ' @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' ( cd cloned-octopus && test_must_fail git pull .. master master && - ! test -f file + test_path_is_missing file ) ' From patchwork Tue Oct 22 10:20:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204199 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 BDBCF4872 for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BD002184C for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iRFeBB50" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731793AbfJVKUM (ORCPT ); Tue, 22 Oct 2019 06:20:12 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38471 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUM (ORCPT ); Tue, 22 Oct 2019 06:20:12 -0400 Received: by mail-pf1-f195.google.com with SMTP id h195so10360041pfe.5 for ; Tue, 22 Oct 2019 03:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qfqzx5mqRrZHqyQX0fZRcQvFA5/6kzXcWyTpN5QWuFE=; b=iRFeBB50zxOzo9ehCIcDq6B/a/cTPfcopEnyBWvBsIdgJB3E2cU28CsSKL5cTeru6r OXxONoc4QDOkvTwsyHXFIGpTWJMFXVz5HyPiw67FZCQAAqvt8M6AggiiQIhXcQ1RKYlo CDvA4Mp7OoNRMGlHu1T/PA7ZLBtA6gHzyob4SQ4jgpA4rJ8IsTGc8RSY7SG9CpVRfby3 WXQHnwCIJHKPqLEcDOX8+y/NCgjlcsMtz7e7GfNtx+StWqQalN5fKTXY9xOZNOlWhs86 Se7Qhw5Ts9BYzVWw29BUjWEA2PMA1/jvO20Eq+Zrusl/T8f/jEvZlHx1u+fUQvvC3u/k Sr+Q== 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=qfqzx5mqRrZHqyQX0fZRcQvFA5/6kzXcWyTpN5QWuFE=; b=bHB4p2Bh/phqf0jUDbAn8Wr9/mKtR+nVzaFhvVFuRXVaX20biKCvK10cXg2dQ2X7yU zRdqyqykCFpvd1uSTs3YwCeWnsUEqjC46FX/UuCxAS7SWykvi6tk1w/aBli5FcutNI3Y s6MRkfx1fal6TFlQQKzcdX1KyH02HxHhYgbqMzAtI5Jx5W2avEkQaE3vmgzmoazim5xY qwNDzYCtCE/L69+ugozUcwvC5e8tyc4uiSwmiZ76qmo+4Ce2BfbDGBVvT6cMOMcH3ziP qux17i+En9col0IvsTWGHp//i+d8Wl4CxxeghK2JrcedWQT67GGV2T+b2NpsE/X2GDaC bs+g== X-Gm-Message-State: APjAAAWnAJBU1L7wlw6NVeAunEAE9hMFofuXogoMugkNCj7MO9vD2QFG zsnW/Ixet9EWKkI3OW02EdlQc0j2 X-Google-Smtp-Source: APXvYqzYuh5JqIr3wyFofvUx4yVBuF5ekM1/h6qJ+4gYf3at8N9Ohs6mDr5qXYNVhp4sLTfDdoqpxw== X-Received: by 2002:a62:ac02:: with SMTP id v2mr3252985pfe.200.1571739610647; Tue, 22 Oct 2019 03:20:10 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id k7sm7526984pfk.55.2019.10.22.03.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:09 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:07 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 06/14] t5520: remove spaces after redirect operator 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 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 Tue Oct 22 10:20:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204205 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 D3473139A for ; Tue, 22 Oct 2019 10:20:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B21172184C for ; Tue, 22 Oct 2019 10:20:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ooxl0b+s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731801AbfJVKUO (ORCPT ); Tue, 22 Oct 2019 06:20:14 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41881 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUO (ORCPT ); Tue, 22 Oct 2019 06:20:14 -0400 Received: by mail-pg1-f195.google.com with SMTP id t3so9658561pga.8 for ; Tue, 22 Oct 2019 03:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=a6QSvPox0audVTemUdwMvQrKuSMXve+4jCu/Zwy9rX8=; b=ooxl0b+sxtgyJQf+WpFG8I14Rgt/d1yZPmyPRwmy4myYxj0UQlEMKxr21Mvl8MKJav Ik7iJKxmPM3/GuQvOeOkgc4zEcLAQGFzBfvgsjoLiaZvy4EQZGsBY3w27n6UhguOwItE i8q+kXpIiIHLZiRWjd46BCkV0Lua43L3CZ98kpqbwFZmaqFFs+YoHOxOFgfu34rlZ6Qq 1GhUuf53At+bQBbGZQX3c026wK+VtNeUdcX+y0vsJwWreCHLUmno6yflZPeZ6L5m5Pgo 6CFvzv/Qe+M2AyhI19i59QQY4A+VLA7mANTtkKZpYKlU1KaUVn0PcJO9Wqyo6JsLxC8a V3Pw== 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=a6QSvPox0audVTemUdwMvQrKuSMXve+4jCu/Zwy9rX8=; b=lIDLxfXFl0MBxNe+TgvOFUiKMja7W7Bs5aGMtEeUE3A/SzK2aqJc3g9LBBY8tTsxY9 MliwntefxjGXXnkreDpw0ZFbfqw2rJPZy9EiF+iOruT5lx2+afHxjRHyMywtULvHsiHF f4/HF4FWjWJGLEQyX6OYggX6FGS1/L5ohqaTkOiMDwVE5a/RJVZY+W9tjF47uLr8MBEe o9atCvZhzvJwv0lhAU4aLcgiMBj5qiqZ0Nt5LAyqg/nMwwfbNHFOjp8VvmTaq9WsWSVv KK5BX7RbF5cY7T8NAI0u6Bkqj8IyS9RnzMXsMgnlSpFENpS6X2h2+STaCJEGjC4ar/xl Ojew== X-Gm-Message-State: APjAAAU+Ig2fmU9gB+B+oShMVK7zkzAMJ8SB2+CLqMJBFUa/bPYzkyqJ WbI+ZRDYIKso+V9+P9XpkoFa/pTs X-Google-Smtp-Source: APXvYqwFR7CSjGRucmL4hLq9qXec5LDxUvZxokGSPBoXoPapTY1vEFuh8ls4OlYhf+el21lLCdLRJg== X-Received: by 2002:aa7:9907:: with SMTP id z7mr3371772pff.133.1571739613380; Tue, 22 Oct 2019 03:20:13 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id f21sm16242949pgh.85.2019.10.22.03.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:12 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:10 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 07/14] t5520: use test_line_count 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 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 Tue Oct 22 10:20:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204207 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 B1CCE139A for ; Tue, 22 Oct 2019 10:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 906D92184C for ; Tue, 22 Oct 2019 10:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lN0J3d0r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731807AbfJVKUR (ORCPT ); Tue, 22 Oct 2019 06:20:17 -0400 Received: from mail-pl1-f175.google.com ([209.85.214.175]:44948 "EHLO mail-pl1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUR (ORCPT ); Tue, 22 Oct 2019 06:20:17 -0400 Received: by mail-pl1-f175.google.com with SMTP id q15so8121516pll.11 for ; Tue, 22 Oct 2019 03:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EigJeBJ0j0HcdKPYpu5EWH8ZxNvB/S22prLxKC5I0Uc=; b=lN0J3d0rWSqfQrVC8wvK5G/hq4hP4frOqwVl35ksTfmi8po0l6loEVfCqIAINMe2Dl jG3LhgLgzZ527ByqTZ3FMoB+Hxa4uwK+fO7pWRmE8vE6q4fkzWSe2sCkHWwj09L2YoxG KQKoshLSg1R6+Hepifrmj6Chu34Iq4JvE15tZqKSKs1zao1YFa1s08IjRG9eMR7SUOC9 QbYcRfBk4gzJii7NrlK0r3TG8HyPMH7WmrIk2p7Xkf8w5nwwKRCCL19yCAEX3TpGM7gt xtQu00emM9x+weAulHDJxVrRGdWflcuFNBuAvVgD5poENmTWaw9G/lrQSBnmyETWKaxT Q1tA== 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=EigJeBJ0j0HcdKPYpu5EWH8ZxNvB/S22prLxKC5I0Uc=; b=LdoqCHDyfd0bpAQk6kI1JgDtBLgEI80TbR3z6C66M2T9JufNA8wGMRhBZgsxbKMJsM hDfoEX+QzIT2SuDAgsX/Shmsnaza8SFBx214+xdF24YfkcpUidS4z95WnqeEl72ap488 Say600k+VfBjFQK/8beBf9UfaPNaZo5b6AaPB0iPUbF4NUuDDW+q9S6gPXuldzjs8oGM XaDo1CvhzWg9wt96D396jBV3bP4hQiw4YyGBPx87VJp9S0n/DFJPAOj/XhXelJCOuLET YJHq/6Dk9YQPOjJKkVOhMGBmzJukkWg5aqECaGG8HMsIiLSvzP29ecUfTytKL3ApPohx TItg== X-Gm-Message-State: APjAAAXsHvN4PYmOWz2vPwxTZc7+d739dRunLWPCiCXDi5UFUgNcPKCd Ae0PntQ2xpOyVAwRXDejD7+og6HB X-Google-Smtp-Source: APXvYqyidi/t7lzZ2SdRxtwDkNBBoGcPgPpge/AUxV/kwvqYmtYE87N4tPrm7ZYJhzKzFawl/nqERw== X-Received: by 2002:a17:902:6ac8:: with SMTP id i8mr2796422plt.164.1571739615854; Tue, 22 Oct 2019 03:20:15 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id 16sm17823889pfn.35.2019.10.22.03.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:15 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:13 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 08/14] t5520: replace test -{n,z} with test-lib functions Message-ID: <86dafc7b54ddc9f3323d9f8d29edc89cb33c5dac.1571739459.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When wrapping a Git command in a subshell within another command, we throw away the Git command's exit code. In case the Git command fails, we would like to know about it rather than the failure being silent. Extract Git commands so that their exit codes are not lost. Instead of using `test -n` or `test -z`, replace them respectively with invocations of test_file_not_empty() and test_must_be_empty() so that we get better debugging information in the case of a failure. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 0ca4867e96..18225d8430 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' ' test_when_finished "git checkout -f copy && git branch -D third" && test "$(cat file)" = file && test_commit modified2 file && - test -z "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_must_be_empty unmerged && test_must_fail git pull . second && - test -n "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_file_not_empty unmerged && cp file expected && test_must_fail git pull . second 2>err && test_i18ngrep "Pulling is not possible because you have unmerged files." err && test_cmp expected file && git add file && - test -z "$(git ls-files -u)" && + git ls-files -u >unmerged && + test_must_be_empty unmerged && test_must_fail git pull . second 2>err && test_i18ngrep "You have not concluded your merge" err && test_cmp expected file @@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' ' ( cd dst && git pull --rebase && - test -z "$(git ls-files -u)" + git ls-files -u >untracked && + test_must_be_empty untracked ) ' From patchwork Tue Oct 22 10:20:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204209 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 935061747 for ; Tue, 22 Oct 2019 10:20:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 687212184C for ; Tue, 22 Oct 2019 10:20:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s61KjNx8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731820AbfJVKUU (ORCPT ); Tue, 22 Oct 2019 06:20:20 -0400 Received: from mail-pf1-f177.google.com ([209.85.210.177]:41284 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUU (ORCPT ); Tue, 22 Oct 2019 06:20:20 -0400 Received: by mail-pf1-f177.google.com with SMTP id q7so10359773pfh.8 for ; Tue, 22 Oct 2019 03:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=N++QLZ0CUzU911GZ21MUWxozRqc2Bw/SmkALXsBiiPw=; b=s61KjNx8Oz19MvbSwBVELxp3SQ8Xy+dp7zxXsDhHqOUuKECz3BkgT1UUyINv7RDtI4 Pz7V7iObFVDFnHpcH4xX90ubOyPUEs9jAoRWCG6qcXcvBScLh+O6xlmiwWIzQhr1rsOJ o+OKvKKPC1Q6xT+oBngEG+wFPx1dYFebrKxE8o+WX59T/IWEjDzBxaWMEpRy8iQNc5FI /fe1JG6EBBpgPB6xXRB2eo7fznWzVucTEnAnrBnAMi3dpYzSY0+CUkERk/IdBSxqYYGY Grq6YU961s7aUCjxj4inPbkPdx4IeYB1mciITISxh0JBLoi/39yXw9EPNw/0fSXlZppF FqIw== 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=N++QLZ0CUzU911GZ21MUWxozRqc2Bw/SmkALXsBiiPw=; b=dpxT37utB/CokTL4MvD/yFKqLZVLWdLDnQ7C1bBSjExr2XgUydaikA3L6KD2zbVwxW cQbgCRrhS/jbciMJsY4kBouG1BoiCnS0yiN86zBY9czMWxUKIF2DH+4I2zgwzubW6p13 BLT/HK+dF1BZNLMsGROLRXja7/7uoxm2IE1iSF7vqtcxDrmSl50m/3g6Iwv1dtRSKHGy VE3pzroP5SnSPtoQxEcniL+Nnyo6yafrodHNS4PZBYa/p32rIqkRFZkIL+RymDU3jlGZ 3X6fG+McjmSAAoSthT4J1UEEFqXkzkvcgSNajeoZSmzU2354xmunSt/NXwomf2l9LucS eX8A== X-Gm-Message-State: APjAAAUORiZJHqSUgpnha8/858fGEWpfhA5oG+Xqbq+qsuEl3n72FyHT HOwkYpmWW8S8GlGJkarFoZj5aHT3 X-Google-Smtp-Source: APXvYqyDpeSiC51t3tRs8f3xMeVsibe31MLsb8h80qG2+dqX5Cj3zFku4iw5EEWeCoaT9V6o51j58w== X-Received: by 2002:a65:68c2:: with SMTP id k2mr2887244pgt.241.1571739618631; Tue, 22 Oct 2019 03:20:18 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id q7sm1839434pff.19.2019.10.22.03.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:17 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:16 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 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 Tue Oct 22 10:20:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204211 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 386341747 for ; Tue, 22 Oct 2019 10:20:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C82C21783 for ; Tue, 22 Oct 2019 10:20:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YKHI/mJd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731825AbfJVKUY (ORCPT ); Tue, 22 Oct 2019 06:20:24 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45509 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUX (ORCPT ); Tue, 22 Oct 2019 06:20:23 -0400 Received: by mail-pf1-f193.google.com with SMTP id b4so1440401pfr.12 for ; Tue, 22 Oct 2019 03:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZhOYPrM26X7WYQMAus0BzhVV83522X2JX0y+YeRW2P0=; b=YKHI/mJdDEB+ohoLkTR0RJd59qiFvFGaTULjI90W76mC9tASzYGQZfAvHgfJU91Ejy YFYXSkVZSh3EsfpYxY4PYFyRqg6KSN1gTAYex1K0FIyIeFU+Re/1M1bO4PId3jHbsjSk ieRZEcs3VzZr9eYm2bAv4e0YnTJvaVyjFt9eiPkmC5hoYhK4lYjud2f/i69/0yZg/9Om bY6TmdImSV+5aC75z7U6tQ6eCQFCqEUl5vHnzeOzVzoRGa1rKJFjOPoW85oIrv1raxhP OFVo7WGryI1l2BcK44KM4WQQ0YteYhdOxT79f+CMa6laUhMuswYlu6Xi2IUg+Al8vhya UJLA== 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=ZhOYPrM26X7WYQMAus0BzhVV83522X2JX0y+YeRW2P0=; b=oj8Mh03Q83/OemeJS6928qrc/Oq5f5C7fq9Ia3pR3H+sXkRnphygIBLjUGta+eFgs1 sC7MURyElS4b4BQ6pT7Uvits7ZlfXxt/yU6qHEK/HRRVTvaKHIashP64VbYnWXlKX3gy mHIfwss7wRUedjs3JMqBhMXBAeo505lEyf21R/6kFCt3nDBXmq5ommoEPK7MKSxQMOqs 9VlpBgIWM2EUUlnUoOGxTRR4nzHXFaBofljJhKVY7h06B1ewXyjhfNxC4Q46oAuKJCg/ WMF2hlE8p2Ha2DmVCoLt8hnLWrXdX92j1nkq0Kr6QgSr0Q68Sse2fTXmmcBN1OxdQqsz ZkNg== X-Gm-Message-State: APjAAAX5aOQZBZRZyYePeQAtb99gKQRkcBT62JV863dnsXFvcUi+2m62 374SQziAAvf9RfSIbQzzsqvl0bz1 X-Google-Smtp-Source: APXvYqzQ+9m7r89dIPJimgqqbwfx4rdW5YwgVIh/PSpdSxPKJGCBq/ZtI7jMk5uMuc9LnOIQs0Ny4w== X-Received: by 2002:a63:4d0d:: with SMTP id a13mr2844661pgb.451.1571739621820; Tue, 22 Oct 2019 03:20:21 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id 206sm17264266pge.80.2019.10.22.03.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:20 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:18 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 10/14] t5520: test single-line files by git 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 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 Tue Oct 22 10:20:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204213 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 D0A43139A for ; Tue, 22 Oct 2019 10:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE6C921783 for ; Tue, 22 Oct 2019 10:20:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lMx88pyt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731828AbfJVKU1 (ORCPT ); Tue, 22 Oct 2019 06:20:27 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43309 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKU0 (ORCPT ); Tue, 22 Oct 2019 06:20:26 -0400 Received: by mail-pf1-f196.google.com with SMTP id a2so10360502pfo.10 for ; Tue, 22 Oct 2019 03:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xTSof9GFWiSeHeRpOf+sfGfJD9gluHEsIe8LRxX6pSY=; b=lMx88pyt9XIOWgc/hpIYwtGHV53F9gwyQnBLChCOoGab0pJM+YUEJdQWIc3Suw0MBA MiUh198iA8+GFgD6ri7yqRm1oFk9obUfchx7U4zvGfPM8EGQNq5DkcDb4xFlyeTSf9d4 lqQM+2Guy49/wl2HyXR84aweLxaZHKHLG1bK7BfMGLdGyudGjw0bNM8AjerUe3f135GJ fN7YuL6H9NJeugATojGJ+zzqa7OnregclL5okuF8S7ZEkS/1K0tlsqxF0rbDkVTI1RQB kG2oTg7Anb5dIm/qTTmfkHW4V7jr827LP4hbkmD0bMKTQVQf4cY+OwGrHUb5BrhC6ahY hkZg== 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=xTSof9GFWiSeHeRpOf+sfGfJD9gluHEsIe8LRxX6pSY=; b=sM5DeAkmTSCz6xJkANnK/TEyP6I1HBWa6zTnLwUniOCzCnlzMWf8IEaFHqB0tZwKp0 323NNVQdOqrz19V49ZVqrcjaj7kqoMKRhJslaj6SyyBqq2iD65urDFa169qt+ba//3Tp 18+0IER85dLhbIlvK1POJS/me75nl0FoKEWnx58HH10owawQ/qKN0lUelGlI8/xaLjWY YHGhLsJ6AvfvE+5CVo4r81MLDDfozElpC4Xppr2n2b8owl5/UIjpH6SreXwkNkEkW7cF mGsKHDUWSog67XZbzQJC1ttMxwOt/0C0wQhlRN16qVr5z8F/jduTziLggPJw9/0PR2Cj IZGg== X-Gm-Message-State: APjAAAVWNQ2Htv2B8SxA1vzgRykBD1k/IX61Plpha8ob/wqIaRJU1KG1 6qaBtje7KS4legoeOqVAfymTnTos X-Google-Smtp-Source: APXvYqy11/fM3yl3/Ck4ujCUocxjo8o7JaMROR25tzUj9XibSstYk7hLwM8pGZDSBMMNjZDvqrfowQ== X-Received: by 2002:a63:df42:: with SMTP id h2mr2756262pgj.405.1571739624421; Tue, 22 Oct 2019 03:20:24 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id z63sm3590378pgb.75.2019.10.22.03.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:23 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:22 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 11/14] t5520: don't put git in upstream of pipe Message-ID: <56bcbf304792676aa4f61b37122467eda0f2a184.1571739459.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, if the invocation of git failed, it would be masked by the pipe since only the return code of the last element of a pipe is used. Rewrite the test to put the Git command on its own line so its return code is not masked. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 8b7e7ae55d..8ddf89e550 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' ( cd corrupt && test_commit one && - obj=$(git rev-parse --verify HEAD | sed "s#^..#&/#") && + git rev-parse --verify HEAD >head && + obj=$(sed "s#^..#&/#" head) && rm -f .git/objects/$obj && test_must_fail git pull --rebase ) From patchwork Tue Oct 22 10:20: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: 11204215 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 E0FA5139A for ; Tue, 22 Oct 2019 10:20:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5C2D21783 for ; Tue, 22 Oct 2019 10:20:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GwqX2ngB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731830AbfJVKU2 (ORCPT ); Tue, 22 Oct 2019 06:20:28 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43313 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKU2 (ORCPT ); Tue, 22 Oct 2019 06:20:28 -0400 Received: by mail-pf1-f196.google.com with SMTP id a2so10360566pfo.10 for ; Tue, 22 Oct 2019 03:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=M9Hfm7uzFXViHISjTnjItbxuE130vBvXPRHVPtuj7yk=; b=GwqX2ngBL2uFq8GRkdA4C8pFGBs4wiTRC/kcVNYxeM5ZjQnnYq40vhS66EGlxsH+NE wfjECN4qKGFuDK2/WvLUMjS3tvAMHTbefIE/LDhKCig0ir/4iC0LmIGf8nPRVJbWourX vx7E6tzlUzAYsPyMZHPX4KfPtzfIBQ+1QS6hPILlXerCCPfelhtjgf02QMpi/67qOhf0 vjM0Nn33PYGgiK8XQriQys0wLy5G89PtDaB1g67BXyyNJckyv4+iuV42+0iBPrPFv0zE zkLoNwwDbgojnK+z3U05vRVrMV3u+/IjLtBaQP/XzkmjccSKisKOIDiIVv0S4/C8Mei4 7T3Q== 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=M9Hfm7uzFXViHISjTnjItbxuE130vBvXPRHVPtuj7yk=; b=racjVLkfDBIc3vzbaDOzeJMUBxtdvG73tbqGu6NO+Ia8xe/XWMr2FkEoFhxuiTaJho 7QrRmS1UXkngndGZhgwlJ5WVq1ZnCYc7UtocFds/Scr1+JqJHHF38GBC4EiHC4ZmcjP4 gLSiCNfEjTflYjyxfONxvcEtScGoLqlm9gigxLEizFIbNfGsh/hmN4DPzA+WHtXSY4gq pZ1ci53DHVscnIw5iSUyd4pyF14GoUBaHUDECaNhhoAmIETGy7xWAO3Cm2HMCKQy0GxC 5ywQcygUy55Sbh0VoGaow/hYFJiRLQNStxRjttNG/9E9TV2yTtWP3fllD204F/Y/0deC YyYQ== X-Gm-Message-State: APjAAAV/Bdvy+lPTnxMFjiWomL1NTdYG49MpkXwyeoStZhetCxJ5bEU0 PqljpIaEL7TTUIaAssTmR1LogSF7 X-Google-Smtp-Source: APXvYqwKEzC0+IE+B1Zz4lWn0zt60rIhfh5synKD0ihaRlOUhtRCMlxz7Q7bOzxJXxjy/fYSQT8hbg== X-Received: by 2002:a63:4625:: with SMTP id t37mr2904612pga.261.1571739626885; Tue, 22 Oct 2019 03:20:26 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id v68sm18935943pfv.47.2019.10.22.03.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:26 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:24 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 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 Tue Oct 22 10:20:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204217 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 17F371747 for ; Tue, 22 Oct 2019 10:20:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB51C2184C for ; Tue, 22 Oct 2019 10:20:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NCxXiN/u" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731833AbfJVKUb (ORCPT ); Tue, 22 Oct 2019 06:20:31 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35240 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUa (ORCPT ); Tue, 22 Oct 2019 06:20:30 -0400 Received: by mail-pf1-f196.google.com with SMTP id 205so10371334pfw.2 for ; Tue, 22 Oct 2019 03:20:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yuqv96I8DjEjL+pOqyR5tndhP7o7H1MzQUYkONRYwjc=; b=NCxXiN/u9Wv+btIwvtiy4Q+avl5wU14v0Gptv1O0YoSrMt9oCv2c0LB9ykobKh+lgF GM+vCKQA8xJdGXIshhiEskFOCXza+WGN65bhhMO4wz6iKiYDjec+6q49YREMrelLr4q+ 6UlupGU5a9DUW3KX9sCnZrW1uq+06WSHRmUKWiFFaCtg9XX7cH9g5Eg/sLk8i9erb5Kq 76gO91NaWcKBa/vRnQZH5WXky2ZliNPMr6vKRnolGcjJj/p2YcH0Kvjb7oGZPdueajI1 CzWA3XePU+90znBzrWBmZEDQ1UE5hHkWVjCVd7uDDUHaqqLx5s8WNK3YxozHRXQeCuaH MdTg== 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=yuqv96I8DjEjL+pOqyR5tndhP7o7H1MzQUYkONRYwjc=; b=dPTE8SOxAUoivMU4RVMi+B3D31gYMeiJUXm2Zy4DeJt9tS0tEWdScq7Em0Ki+hcYBD /P6UPF937XhEv3zQTEi3G3/tAR2hr22ioP4aAEo+lSKjJBPJHEcHhNwhvl5/YkHZEfSM hL8FIdxMCQ6Rbg2PazlTgK0h5ol9Zx491KbGEohl+OvpSikAzPXwy0HvEl6a4wC3VLz3 EkFobZRs6g65xJWsI76p8ErPd/Dq8PQDZ0ytjdBp6jvvXLGc8vsf0lqS/em8hItK4TRR RvEjYvVO/IAgSZaprhlQJzGCoDm18CIoXjrb+QhW6Xpr59T805iwWUc9G1VGK0cdIpO9 SCaQ== X-Gm-Message-State: APjAAAWfLig88uEoc80V5Oenb4STUqCpTnmHdT9QfqkDAUNj/+16ctAe FkrXMDIKAEeGh8a68N4L/K7Ofv8O X-Google-Smtp-Source: APXvYqxx1iqvqDk8VSLxLo1Yp62H0Itj04Cz1BHqKWYJglJ8u6j/Z8rwtB+Cj0L3DdIeMsDSPHJpgw== X-Received: by 2002:a63:1f25:: with SMTP id f37mr2959577pgf.50.1571739629222; Tue, 22 Oct 2019 03:20:29 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id t13sm19666148pfh.12.2019.10.22.03.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:28 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:27 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 13/14] t5520: remove redundant lines in test cases Message-ID: <9db0fc2156ea8fcdf060932967a6ea989922c989.1571739459.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the previous patches, the mechanical application of changes left some duplicate statements in the test case which were not strictly incorrect but were redundant and possibly misleading. Remove these duplicate statements so that it is clear that the intent behind the tests are that the content of the file stays the same throughout the whole test case. Signed-off-by: Denton Liu --- t/t5520-pull.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index c9e4eec004..ef3dbc201a 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' ' test_cmp expect file && test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err && test_i18ngrep "no candidates for merging" err && - echo file >expect && test_cmp expect file ' @@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' ' test_config branch.test.remote origin && test_must_fail git pull test_remote 2>err && test_i18ngrep "specify a branch on the command line" err && - echo file >expect && test_cmp expect file ' @@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "not currently on a branch" err && - echo file >expect && test_cmp expect file ' @@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no tracking information" err && - echo file >expect && test_cmp expect file ' @@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' ' test_cmp expect file && test_must_fail git pull --all 2>err && test_i18ngrep "There is no tracking information" err && - echo file >expect && test_cmp expect file ' @@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' ' test_cmp expect file && test_must_fail git pull 2>err && test_i18ngrep "no such ref was fetched" err && - echo file >expect && test_cmp expect file ' @@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' git ls-files >actual && test_cmp expect actual && test_must_fail git pull --rebase .. master 2>err && - echo staged-file >expect && git ls-files >actual && test_cmp expect actual && - echo staged-file >expect && git show :staged-file >actual && test_cmp expect actual && test_i18ngrep "unborn branch with changes added to the index" err From patchwork Tue Oct 22 10:20:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204219 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 2A0E01747 for ; Tue, 22 Oct 2019 10:20:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08E2E2184C for ; Tue, 22 Oct 2019 10:20:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RpC39L0b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731837AbfJVKUd (ORCPT ); Tue, 22 Oct 2019 06:20:33 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41912 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUc (ORCPT ); Tue, 22 Oct 2019 06:20:32 -0400 Received: by mail-pg1-f196.google.com with SMTP id t3so9659018pga.8 for ; Tue, 22 Oct 2019 03:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YIiffT/wTCLcDiOOUgSgbOKq+qcZ+pfAGNxqb45C5s8=; b=RpC39L0b96f4ZCwh978V1GR1Q+L0OWdUwBt3N0QRIQgYmQ41pb9W8qPFGVyatbhGqu WopQOtmlKjrAjQvzKINTfRK1EmeEQ9g3GN55+Yy7/rbq/4YqUMbC4glLl6kglUOXS6J0 eLcxu4N4gqzM8e4Wdh+cFdatr6NUuRkUgmxBn4SG03eMHoLJILyPfLA1SUEFxc65uG0a y5+IU8WZFNx/oOFkOT36OIYD3o3auGNBIdWBVO3j6bRb+/5TzHjQbsgXD/222X4itILv ZEEHIOaKq9Ep4OAoptoRTQsKpKbVkwvjmoCaAprt/6mMbFfXR7c2f5DcR3+xNCwJzFcn H93g== 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=YIiffT/wTCLcDiOOUgSgbOKq+qcZ+pfAGNxqb45C5s8=; b=HV35LrAxgVV34T7ysENY9VsmZvBigjQCrcxx5nr1/k05BJNYwVjqRWSJd6umZ6isE8 DjNbGghR8gGjNSVbHvaeJKyOpjhGF8+lLoWeqjlBSTXNb+WLfmY5SMPt/U8A8BsLpf96 s4MSonWQaQLdEoWrDpl466K8xde+3T/1T7U3nOrXiPOIhuQQVbl2lReccI7Y84M5v5nI IEVxqPJ6Q5anSDaK6SyxXIj9hOl0rr9HCslHOxsC5QrtSw0YH5cTMauB8R9z8D6duaci 1XdanKq5+VTu0jv8cqlMCL7XGCxc3MSs2ulVp1vyCPydw83R+BhMEkJclca74apEB/ce 4IBg== X-Gm-Message-State: APjAAAUPoHw4MqX1mdsSLhg5cafUcQI5mFO2ubhW1CpPS8B5rfTVZJxz pI4cC9NMIjgA9Z3X697N2xpaESRF X-Google-Smtp-Source: APXvYqxTGG4kTTDCGyuI18Wfij5BbmibWQeM592KYMZKIViY6pV8ML43pJAW+FS27kcptUHGBb5UHQ== X-Received: by 2002:a65:4189:: with SMTP id a9mr2904334pgq.380.1571739631558; Tue, 22 Oct 2019 03:20:31 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id m2sm23850443pff.154.2019.10.22.03.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:30 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:29 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 14/14] t5520: replace `! git` with `test_must_fail git` 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 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' '