From patchwork Fri Dec 27 13:47: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: 11311183 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 92A3913A4 for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 675BD20882 for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BWee/0Mo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726933AbfL0Nrh (ORCPT ); Fri, 27 Dec 2019 08:47:37 -0500 Received: from mail-qt1-f172.google.com ([209.85.160.172]:41790 "EHLO mail-qt1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726920AbfL0Nrh (ORCPT ); Fri, 27 Dec 2019 08:47:37 -0500 Received: by mail-qt1-f172.google.com with SMTP id k40so24586800qtk.8 for ; Fri, 27 Dec 2019 05:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OqXpG21GOUk4EeE47+9cV+f1Ev9L9weVvt0UqtPUdOs=; b=BWee/0MoGCMnAcSBc1Re8YNnFHy6AwPJHPZJ5LYR0fLUbwgPfAhSsRpEyWqtMK4Vkf lycug/EXnMVqeldpNDaBr4EdCsTdprUOoPXB58vSTRRn54c4oXGWBz0JXlL7OEVmqTpx Ie3pMYjunbA/M5UGaj3sweTE+K9H8Nj+Kl0liP8DToiy5xBcaQt9Z0bipfuL67i8DgqH 7HrUtq+jn20vCPqWBIVQaIHZ72AIJmCgGD+zEgrCcdBCE+PjH2fbtMdZj59ArjqTiPD6 HYWP0fjQ0T5t4+WN2+nYOIUym4WZvFHsafTqIxqiqStKjlVgvpIIXrim0WEYX//MFOam jTpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OqXpG21GOUk4EeE47+9cV+f1Ev9L9weVvt0UqtPUdOs=; b=TtvLEMJJ/kU54uI1Iel6KKKELgBv0g/c8TjkdgRcJglhmVn0YyyaoKaHyoOQD7q4EL VhtKzMucEnyAD/jttXTBqyCfpF3J86oHpuKvnUahme8IA+QAds+V8JfQDedFfiWJmTtS 4tFDJqxzl2c80EA1yTm4P1F6fvVBMqsu9Gqeal4HxgdmkmP5w9M4mE8CIgA1/iulO5eR fLqXNC2qdkn4/J2RGurzHWNJxwpvHhn/apdBnvCP3lCZ1LkJRZ5p3OUqkBkm8ubSPqT5 gkkbkEE0cYovbAMcX2epvYUBxZcaEkEVFLHHGF9oUMlOrg5plilADYLkMX+W6dXHfUt+ hfSQ== X-Gm-Message-State: APjAAAVmO7LvhuoFk+Mc8wWo0+ErJ+qs711ISQRis3jGxEbo8SVrpayg Jm8IkH95DxTl5xwbSSUZokfReroh X-Google-Smtp-Source: APXvYqytrVp3t8AVXQrh3+aqBuYxCrPhbEPyXugUZ8lcffoLtyYRTyLvtLgYYWOpUmKmmRXdsjvFyw== X-Received: by 2002:aed:218f:: with SMTP id l15mr31603742qtc.247.1577454456113; Fri, 27 Dec 2019 05:47:36 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:35 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 01/16] t2018: remove trailing space from test description Date: Fri, 27 Dec 2019 08:47:10 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 822381dd9d..e18abce3d2 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='checkout ' +test_description='checkout' . ./test-lib.sh From patchwork Fri Dec 27 13:47:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311185 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 BCBDB184C for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B9C721582 for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HoaiYiGM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbfL0Nri (ORCPT ); Fri, 27 Dec 2019 08:47:38 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43866 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726920AbfL0Nri (ORCPT ); Fri, 27 Dec 2019 08:47:38 -0500 Received: by mail-qt1-f195.google.com with SMTP id d18so21895992qtj.10 for ; Fri, 27 Dec 2019 05:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Pp7Dl0Gu4TqqiuksI/FRtAqn/pmHfsRgMB+1F8YfIvE=; b=HoaiYiGMBXOdliHGbpyXDf1dUTGc03woOve/1+bym5nBOu2Rm6X4KPNC7+qri+5pUy dALvNY7ZNV4HtGtGNPgd08pmV9CNnRv2gMlbpHVOKvxhT2RIpZ8uzMNDqVqUeN+OgluR p+Mt4BV7ET0EuMlkAQ27xyDL9xeZC980fBBGBhPPMe5JoRCYNP08UM54qqbKe+bAaX8M MOkkoNGJprtLgDyLVNLV8R8FgvxZe9B0kXrI9hYmNybVaXh22hPAjWb9xLhCG1xCX10p sYTCmUrAYVIHzQOL9cijP8CKQN1rKvQrEhj+j7oMAk3vlJmZiRCFnainkbN4X8XKJrjL 30Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pp7Dl0Gu4TqqiuksI/FRtAqn/pmHfsRgMB+1F8YfIvE=; b=a99eEXLPu23zdtxvQwPXoMh/iYqAH9FbNi266LeoOHgHd103D2C3vy0oR1yBp4f7Lz 2PoxO2igDxZL01rYS4CqR/XhK7QA2Rdcqs2T3mi2nHio3NVCxBd1j49JmbC0UMGhUZ1V //vswcCjjdQirkZuDC4YaLK+9nmbMuo0KQwxC01PF+7ZNeoApCGzkCoKVD17rNlt3ZOJ G7LWEVTfi5Ez3wrAvQwikbI5S2sah5b0f1Qv/gQYkaZRnjVeDQbB9pYos94YRXtefDx0 T4L7WnLoJg3uJZrHDskWzMSIS3wzua6+DpeKjqBZoKaiBH4Nstf9Y16pWcBDFz1hYN0j gXUw== X-Gm-Message-State: APjAAAWLksILe98aVA7N9v/SJrhLYvk4u2cor5Me9js392mLiJqCEIkA ues2rxXKnBDGBJfoeNHKSnfHG8Po X-Google-Smtp-Source: APXvYqzNWcPdy4Hz5sujdIEXO8QpNG4O07AoyQvzvox20GTzJ+hvM3CSMOkWe0Z8Sfie3mzmYTzDwQ== X-Received: by 2002:aed:2f62:: with SMTP id l89mr37817998qtd.358.1577454457330; Fri, 27 Dec 2019 05:47:37 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:36 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 02/16] t2018: add space between function name and () Date: Fri, 27 Dec 2019 08:47:11 -0500 Message-Id: <9558d2491fa8dc68603426c1528154b4fe352650.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index e18abce3d2..79b16e4677 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -12,7 +12,7 @@ test_description='checkout' # 2) HEAD is ; if is not specified, the old HEAD is used. # # If is not specified, "git checkout" is run with -b. -do_checkout() { +do_checkout () { exp_branch=$1 && exp_ref="refs/heads/$exp_branch" && @@ -32,19 +32,19 @@ do_checkout() { test $exp_sha = $(git rev-parse --verify HEAD) } -test_dirty_unmergeable() { +test_dirty_unmergeable () { ! git diff --exit-code >/dev/null } -setup_dirty_unmergeable() { +setup_dirty_unmergeable () { echo >>file1 change2 } -test_dirty_mergeable() { +test_dirty_mergeable () { ! git diff --cached --exit-code >/dev/null } -setup_dirty_mergeable() { +setup_dirty_mergeable () { echo >file2 file2 && git add file2 } From patchwork Fri Dec 27 13:47:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311187 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 E79CF17EE for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C67F82173E for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sntb6oKJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726981AbfL0Nrk (ORCPT ); Fri, 27 Dec 2019 08:47:40 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:36754 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726920AbfL0Nrj (ORCPT ); Fri, 27 Dec 2019 08:47:39 -0500 Received: by mail-qv1-f67.google.com with SMTP id m14so10070601qvl.3 for ; Fri, 27 Dec 2019 05:47:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gDx4jk7LmV5Dr657wmr4gME5FAhHx6/hzJkxqQnqu98=; b=sntb6oKJjrsSgiGcxhPAUgKkmfqcaNxoA2+r/9qU56m5LW5VUg64B+Q4bB2I6ToA6T EnCk1qjXYxGsNyBSlWcN+mWMiNeOz05fnHXjBowtZoJH4m3W9iI1/C9UADprkGiTy8/S v2OLog9MKmoDbU9sq4XMZadqVt7jgKhfktYpQX14NhUHy/748xQsSz51b+ozE6qN0EfL 7a1XAJq+GX6HfeY5uYDAs8toVZGuriJSisIkXk7uhbEVB/uNKSIGpNoHepklrG18jiBs 60ompWh5QZJnL7Zi1PyBtNgC38fduu44nQwUBiRfDeqShF+6pEoj+etd/TIsB3wPe9eq PiMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gDx4jk7LmV5Dr657wmr4gME5FAhHx6/hzJkxqQnqu98=; b=h4TlfSL70wcHA4z5wZtUgGphbFFp7I8d8WchQYFE7yuyEEgHcZuGoc7eoGrZjN2dK7 IGMTQe4QCa8VWJPfSGG+8E5kgbU1u9Djk8mODRIJDWIn+50H/oEdP8yYAn/kskO0o11k /yxbjaP8n9Y44d+jmrN5j1Xuv7tejUBLV1q5j2lt+/eceXRdpRycrQDSSehJwJd4onbN L1AEJWZ1AkHXtp2WfJ7MfqvbgGgpzdlWJShM/jMj8SFO2IV9S79j+0Tm33onf0b5sYtE QTleE47WJgemBBIriLroNkFgVNvDjA6SZ75/RFBVUEar+2nQfPJIkMG0uMYuee1Hwgv2 I28A== X-Gm-Message-State: APjAAAWdnV2P+f1rgJgRQRKo1mvSjUm8O9eR6ZddsS0jvYAXfyuHhjD/ D8oVnjYWBVslv9zAFx2pMCmnlhKK X-Google-Smtp-Source: APXvYqwQS98/ygI+Rl+gGBsgmaeJTTosM6Gf84G8m+9s/n4DSqet4DWD+CeIc8IML42It6h0L18cig== X-Received: by 2002:a0c:904b:: with SMTP id o69mr39943860qvo.218.1577454458224; Fri, 27 Dec 2019 05:47:38 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:37 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 03/16] t2018: use test_must_fail for failing git commands Date: Fri, 27 Dec 2019 08:47:12 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, when we expected `git diff` to fail, we negated its status with `!`. However, if git ever exits unexpectedly, say due to a segfault, we would not be able to tell the difference between that and a controlled failure. Use `test_must_fail git diff` instead so that if an unepxected failure occurs, we can catch it. We had some instances of `test_must_fail test_dirty_{un,}mergable`. However, `test_must_fail` should only be used on git commands. Teach test_dirty_{un,}mergable() to accept `!` as a potential first argument which will run the git command without test_must_fail(). This prevents the double-negation where we were effectively running `test_must_fail test_must_fail git diff ...`. While we're at it, remove redirections to /dev/null since output is silenced when running without `-v` and debugging output is useful with `-v`, remove redirections to /dev/null as it is not useful. Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 79b16e4677..e6b852939c 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -33,7 +33,12 @@ do_checkout () { } test_dirty_unmergeable () { - ! git diff --exit-code >/dev/null + should_fail="test_expect_code 1" && + if test "x$1" = "x!" + then + should_fail= + fi && + $should_fail git diff --exit-code } setup_dirty_unmergeable () { @@ -41,7 +46,12 @@ setup_dirty_unmergeable () { } test_dirty_mergeable () { - ! git diff --cached --exit-code >/dev/null + should_fail="test_expect_code 1" && + if test "x$1" = "x!" + then + should_fail= + fi && + $should_fail git diff --cached --exit-code } setup_dirty_mergeable () { @@ -93,7 +103,7 @@ test_expect_success 'checkout -f -b to a new branch with unmergeable changes dis # still dirty and on branch1 do_checkout branch2 $HEAD1 "-f -b" && - test_must_fail test_dirty_unmergeable + test_dirty_unmergeable ! ' test_expect_success 'checkout -b to a new branch preserves mergeable changes' ' @@ -111,7 +121,7 @@ test_expect_success 'checkout -f -b to a new branch with mergeable changes disca test_when_finished git reset --hard HEAD && setup_dirty_mergeable && do_checkout branch2 $HEAD1 "-f -b" && - test_must_fail test_dirty_mergeable + test_dirty_mergeable ! ' test_expect_success 'checkout -b to an existing branch fails' ' @@ -162,7 +172,7 @@ test_expect_success 'checkout -B to an existing branch with unmergeable changes test_expect_success 'checkout -f -B to an existing branch with unmergeable changes discards changes' ' # still dirty and on branch1 do_checkout branch2 $HEAD1 "-f -B" && - test_must_fail test_dirty_unmergeable + test_dirty_unmergeable ! ' test_expect_success 'checkout -B to an existing branch preserves mergeable changes' ' @@ -179,7 +189,7 @@ test_expect_success 'checkout -f -B to an existing branch with mergeable changes setup_dirty_mergeable && do_checkout branch2 $HEAD1 "-f -B" && - test_must_fail test_dirty_mergeable + test_dirty_mergeable ! ' test_expect_success 'checkout -b ' ' From patchwork Fri Dec 27 13:47: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: 11311189 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 27C9B139A for ; Fri, 27 Dec 2019 13:47:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F11CD20882 for ; Fri, 27 Dec 2019 13:47:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="grQUvmpT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726994AbfL0Nrl (ORCPT ); Fri, 27 Dec 2019 08:47:41 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:41807 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbfL0Nrk (ORCPT ); Fri, 27 Dec 2019 08:47:40 -0500 Received: by mail-qv1-f65.google.com with SMTP id x1so10053872qvr.8 for ; Fri, 27 Dec 2019 05:47:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EQtUtvk0AIv97glR8qlAjrNj9xKQXSc7sXN9og5/4T0=; b=grQUvmpTftD4hbXmkVZNs1CUZcLNR6mndu2hiUDgXUwcUD1atg215QG0h6qgS4KwRH esKPrh3CjhjJS+Afu0sxuBbFNaS+9UW7xE7qcWpl9B4MOiw0yoDP0LjLJ5VjvtpwqqRn yFjcdoLLxlgT9Wmm/0T6L9+VFGTlv1rYPjj7BJjYFB6NVRxkhaB9jiL3vzRb9y+vFRJD 1JE2jE7meSQgkteXrsDyIUQ4QBULO1VF7KvE8MRUcEV1VQiPo4hpl69TyNQZBmEtg04o ZDnvzg2OrofEII5oleVETxWBoszLRZgLV/DjWLQ2GZxnRRS7ZDpJdDIBBV3XCDJ7V0w8 Qw2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EQtUtvk0AIv97glR8qlAjrNj9xKQXSc7sXN9og5/4T0=; b=uT0d5u/yjvWfvn11dMcYCKr45+sZY+CLSzfga5nm3Oq/OrX48lPrcxX9yFpOsW8iTW y+CZ5Rvc41voPJw3WCA4eCl1gLRzGd4x1xFXPdxqEhA70p6HHqwjQuTd+w04Lyoqohe2 ITn5Fvml1jzSweeu9K00JGtWUvI6nUEGIPo9CI9RiukiqziOVkpKXNAQGvN6jcFxxn6/ xhU1HPFD4QoyU4+lLbw8AFUsq7JmpO0Qhd5KcT6jkyudXIdOcX0AXKAc9X1CTyM8/oaR IWF/ZhOM4g7QJ4f1vUtFMRx1iF07f5YWNb8HZzUNRwfCrH+njAigKX1uCuQnsAPRZF7R CyWQ== X-Gm-Message-State: APjAAAV448lIvJjmV1vHJtvRQNHrU1SxXTCu6NZnmfw2vJkZMSgcLnGi TypIrnpV1tosmIw+e3+/A/O29LgV X-Google-Smtp-Source: APXvYqxCIFRPj5SWT15Zd9q3HufzQ77h3MdbhQ9DO/uUhJnt6UeQA04b9MeUlPcGhOzNaWZxzp5FrQ== X-Received: by 2002:ad4:450a:: with SMTP id k10mr37813493qvu.136.1577454459114; Fri, 27 Dec 2019 05:47:39 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:38 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 04/16] t2018: teach do_checkout() to accept `!` arg Date: Fri, 27 Dec 2019 08:47:13 -0500 Message-Id: <4eab751a3cf00bbffaf4b1084928dad264fa1572.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, we were running `test_must_fail do_checkout`. However, `test_must_fail` should only be used on git commands. Teach do_checkout() to accept `!` as a potential first argument which will prepend `test_must_fail` to the enclosed git command and skips the remainder of the function. This increases the granularity of the test as, instead of blindly checking that do_checkout() failed, we check that only the specific expected invocation of git fails. Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index e6b852939c..43551332ed 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -13,6 +13,12 @@ test_description='checkout' # # If is not specified, "git checkout" is run with -b. do_checkout () { + should_fail= && + if test "x$1" = "x!" + then + should_fail=test_must_fail && + shift + fi && exp_branch=$1 && exp_ref="refs/heads/$exp_branch" && @@ -26,10 +32,13 @@ do_checkout () { opts="$3" fi - git checkout $opts $exp_branch $exp_sha && + $should_fail git checkout $opts $exp_branch $exp_sha && - test $exp_ref = $(git rev-parse --symbolic-full-name HEAD) && - test $exp_sha = $(git rev-parse --verify HEAD) + if test -z "$should_fail" + then + test $exp_ref = $(git rev-parse --symbolic-full-name HEAD) && + test $exp_sha = $(git rev-parse --verify HEAD) + fi } test_dirty_unmergeable () { @@ -92,7 +101,7 @@ test_expect_success 'checkout -b to a new branch, set to an explicit ref' ' test_expect_success 'checkout -b to a new branch with unmergeable changes fails' ' setup_dirty_unmergeable && - test_must_fail do_checkout branch2 $HEAD1 && + do_checkout ! branch2 $HEAD1 && test_dirty_unmergeable ' @@ -126,7 +135,7 @@ test_expect_success 'checkout -f -b to a new branch with mergeable changes disca test_expect_success 'checkout -b to an existing branch fails' ' test_when_finished git reset --hard HEAD && - test_must_fail do_checkout branch2 $HEAD2 + do_checkout ! branch2 $HEAD2 ' test_expect_success 'checkout -b to @{-1} fails with the right branch name' ' @@ -165,7 +174,7 @@ test_expect_success 'checkout -B to an existing branch with unmergeable changes git checkout branch1 && setup_dirty_unmergeable && - test_must_fail do_checkout branch2 $HEAD1 -B && + do_checkout ! branch2 $HEAD1 -B && test_dirty_unmergeable ' From patchwork Fri Dec 27 13:47:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311193 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 2806113A4 for ; Fri, 27 Dec 2019 13:47:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06B5A20882 for ; Fri, 27 Dec 2019 13:47:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NcJ9XzFT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbfL0Nrm (ORCPT ); Fri, 27 Dec 2019 08:47:42 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:46444 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbfL0Nrl (ORCPT ); Fri, 27 Dec 2019 08:47:41 -0500 Received: by mail-qk1-f195.google.com with SMTP id r14so21504489qke.13 for ; Fri, 27 Dec 2019 05:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=XiHQuyipC06U7f1JdrTdwdShkKFIbWAMKbxCMzYKevE=; b=NcJ9XzFTWa1y33Ogys0VTIwKyyxdeF95BW2qp5lJLRZy2G7Le8RdE4G/QPmsUZvGX4 vqPZIVx1RaD8/J1YO8BL/7p/xJ+B6b0+ii2Jgd9K+SdINplzBduO1E1oNoVH5NcNSn2N wJm9WTG+babClKBGqfOCc9bWD+aiwvH8bCTGt1QWlXPBgTFz90wY5tXxOncHkNeFvbtv jFdIthIcaMntd3FMdz2y4sXLJxf2NZsFp4aWVoDI93Cj9WsuCt/lc8wusVrh3PfbyzEJ RhmO7S59nPGMbG/EubEkL3PZGwPm7oXgGzKjdmkqnM6GQzr8Dh5xFMsVvnWLt8Qe263s O90A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XiHQuyipC06U7f1JdrTdwdShkKFIbWAMKbxCMzYKevE=; b=pFmPgzAXNeuR1qfMdOufhQYhV2Y3x9jn4dOxlWaGz5hR7QF8jL4GrO83issKRvPI4c 1cg5JGVrI1q6WK9Nct+thaWz5wLsA7Iy1HqPhoMLpH6VWAM6lDGWAeqaEaKo7sZImfD/ dtIeOHn7w9R2nKqAKPJHU7C4nE57ZYw3GClEC60OuZ8BogJA6btXLnzGear7aKNR5NDa q3ZW4t+qlbJFg3hOTpjfsvKFDOFm8x6kNfj111cQ3LoQhJVx/xbmmcsMK4JLzCvc9m6S FdE/jUhKMdynwXehrHcPktFH7VHhTi1/noV9qpJml/wf6jDW7xnh6fcLmIfYNs193cpF z6+g== X-Gm-Message-State: APjAAAV3qCBfFnvCItHebYjsVWfA7Whttd1MPzi0vfBJzrdGx/vWpNGb q2nV1e6dssgbl3+vWgBV2wxqyb0b X-Google-Smtp-Source: APXvYqxQ21WGtb2OTKAlCrPXDHFAPAVPQCvq22DTa3WJl8QPFkdO/WWRHcpSLiY9t7n6/Co7illDSw== X-Received: by 2002:a37:4b56:: with SMTP id y83mr43509914qka.42.1577454460030; Fri, 27 Dec 2019 05:47:40 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:39 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 05/16] t2018: don't lose return code of git commands Date: Fri, 27 Dec 2019 08:47:14 -0500 Message-Id: <4fe247c09df89ebe908f366ee7c2a4ec1c209d86.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We had some git commands wrapped in non-assignment command substitutions which would result in their return codes to be lost. Rewrite these instances so that their return codes are now checked. Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 43551332ed..69758041f4 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -23,7 +23,8 @@ do_checkout () { exp_ref="refs/heads/$exp_branch" && # if is not specified, use HEAD. - exp_sha=${2:-$(git rev-parse --verify HEAD)} && + head=$(git rev-parse --verify HEAD) && + exp_sha=${2:-$head} && # default options for git checkout: -b if [ -z "$3" ]; then @@ -36,8 +37,12 @@ do_checkout () { if test -z "$should_fail" then - test $exp_ref = $(git rev-parse --symbolic-full-name HEAD) && - test $exp_sha = $(git rev-parse --verify HEAD) + echo "$exp_ref" >ref.expect && + git rev-parse --symbolic-full-name HEAD >ref.actual && + test_cmp ref.expect ref.actual && + echo "$exp_sha" >sha.expect && + git rev-parse --verify HEAD >sha.actual && + test_cmp sha.expect sha.actual fi } @@ -159,7 +164,8 @@ test_expect_success 'checkout -B to a merge base' ' ' test_expect_success 'checkout -B to an existing branch from detached HEAD resets branch to HEAD' ' - git checkout $(git rev-parse --verify HEAD) && + head=$(git rev-parse --verify HEAD) && + git checkout "$head" && do_checkout branch2 "" -B ' From patchwork Fri Dec 27 13:47:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311191 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 F2BC913A4 for ; Fri, 27 Dec 2019 13:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D182320882 for ; Fri, 27 Dec 2019 13:47:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RF599Cdh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbfL0Nrn (ORCPT ); Fri, 27 Dec 2019 08:47:43 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:35896 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbfL0Nrm (ORCPT ); Fri, 27 Dec 2019 08:47:42 -0500 Received: by mail-qk1-f195.google.com with SMTP id a203so21909604qkc.3 for ; Fri, 27 Dec 2019 05:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nMrlJmXkhSmJujxH2Sv9cx6KyoLY0vnpsh+tHoYJpzQ=; b=RF599CdhfSkQNUL4PohieudJWunJdD/FF9/M1aD0ogKgrsCf2jgiyiuuTQvqIsnhmG X7BtZl4MdX5W0ukT78sdMsIwfNvMQSDgHFnuDGfhkkv6hxhayYOb29aIQhlB8cyKUfAz U+Ryfsm64xS9A/NkyunpYy1PMmDy3MpvL5/1WomzZuNsulPsQqOJnuhBt5swK9UrET1z nUlr4pI7+Aaz24F8pJH0DYr6u8nGkfcqs0bX5/PcnbwIng8ihkJ9TaePpSrRezSN3Yo9 8UnJu93vhH3ECUa80b6LFCy6f3KfRWWUqx7amo+TVw/UDGJ/yJk7QDNINo6bIPbq1678 cAxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nMrlJmXkhSmJujxH2Sv9cx6KyoLY0vnpsh+tHoYJpzQ=; b=DqLDl4VgMxluzNsn8DZ33bLoCDy3C0VxIz3SWP6nYX+MnqHLVw8aSMin3890T6KiXu j8Kp9xGAr1vyv058r04vL2I6RLoXoSVaS029zunB1ZWcO2rqIe5ffXmim497UTp1oXMU ygI8IChUkNmhg5jo57KIWqdmzlxo4M0SUGTDyUJ5U6bDU2WBeZbZOyjxqhFZj44ubRG2 4e5OcyUp8STBLiXihIjasFd5f69cdLU/pKwKrEWP9P8vF2koj85ciGcaxKbpUR4GJ8Xp SJ3JHHrOc8Re+dyJ9Iw/23GVviLODxQ8gmKUVdzWS3VE0aN20N5kOsIy+w0Tf2a7M16r 3fIQ== X-Gm-Message-State: APjAAAXnTqEVeMYWXHz7fXWDsBh8XRmhlM3XJAjhY9OHsjQyZ9dTOire YPJU2N4PLFfwKxBF2+/WxA02chOF X-Google-Smtp-Source: APXvYqzArpMUUIewZuvs54LdqjNoVvA8ZSVcVhg31dBp53qvi+/YLoYnwFb18ZBjJX1S7vrAu7Vesg== X-Received: by 2002:a05:620a:634:: with SMTP id 20mr34022651qkv.269.1577454460902; Fri, 27 Dec 2019 05:47:40 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:40 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 06/16] t2018: replace "sha" with "oid" Date: Fri, 27 Dec 2019 08:47:15 -0500 Message-Id: <0e3072f03c3e34810acdb5f08c3fb5effc39d3a3.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As part of the effort to become more hash-agnostic, replace all instances of "sha" with "oid". Signed-off-by: Denton Liu --- t/t2018-checkout-branch.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh index 69758041f4..6b36c7800a 100755 --- a/t/t2018-checkout-branch.sh +++ b/t/t2018-checkout-branch.sh @@ -4,12 +4,12 @@ test_description='checkout' . ./test-lib.sh -# Arguments: [] +# Arguments: [] # # Runs "git checkout" to switch to , testing that # # 1) we are on the specified branch, ; -# 2) HEAD is ; if is not specified, the old HEAD is used. +# 2) HEAD is ; if is not specified, the old HEAD is used. # # If is not specified, "git checkout" is run with -b. do_checkout () { @@ -22,9 +22,9 @@ do_checkout () { exp_branch=$1 && exp_ref="refs/heads/$exp_branch" && - # if is not specified, use HEAD. + # if is not specified, use HEAD. head=$(git rev-parse --verify HEAD) && - exp_sha=${2:-$head} && + exp_oid=${2:-$head} && # default options for git checkout: -b if [ -z "$3" ]; then @@ -33,16 +33,16 @@ do_checkout () { opts="$3" fi - $should_fail git checkout $opts $exp_branch $exp_sha && + $should_fail git checkout $opts $exp_branch $exp_oid && if test -z "$should_fail" then echo "$exp_ref" >ref.expect && git rev-parse --symbolic-full-name HEAD >ref.actual && test_cmp ref.expect ref.actual && - echo "$exp_sha" >sha.expect && - git rev-parse --verify HEAD >sha.actual && - test_cmp sha.expect sha.actual + echo "$exp_oid" >oid.expect && + git rev-parse --verify HEAD >oid.actual && + test_cmp oid.expect oid.actual fi } From patchwork Fri Dec 27 13:47: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: 11311195 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 52F17139A for ; Fri, 27 Dec 2019 13:47:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 315AB20882 for ; Fri, 27 Dec 2019 13:47:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qFfZjVZq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727030AbfL0Nro (ORCPT ); Fri, 27 Dec 2019 08:47:44 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:42193 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726999AbfL0Nrm (ORCPT ); Fri, 27 Dec 2019 08:47:42 -0500 Received: by mail-qv1-f68.google.com with SMTP id dc14so10054515qvb.9 for ; Fri, 27 Dec 2019 05:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=d7hQBM8aYSWYDp+gYPVX5nvfL0SvXrbvxbv8P0yEBm8=; b=qFfZjVZq1x1RFBQbR3DdBQc5U4tERh21SHxW5gsWEOIYimDVIp+SLBBNqhcu5cBfkZ fkgkuHczrGpKZNOTpmyKTW1fBLmxFW7dobds6UoaMKnBguT17+Ez8/HOJGkvmMyTtIgz ATO1qX1Tl+rmjv4WyR6PSSsO0AQpI9OQH0vRl5PzazHMNFVkQg95fvgTlQ3pTyHf0j1D /TxfrOwrtp39YDAnHZ7TwI/XIqKV7tZ/9rXE++lA6TJaQlKf5XK8ueSqCwNXrPX3FIYu GJXXElxIl9upi9ILVeWSDfJDTesVItXwBFhhjDESaYKCO8XhDGGZgTCzjBLcGMvbDSiJ LsPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d7hQBM8aYSWYDp+gYPVX5nvfL0SvXrbvxbv8P0yEBm8=; b=DmtmRlDdcxQbT4XIWXhBISf7XnrmHtyLWWVDEmIa1SIK+kPw9ICXZEBx2reTIfj62d KrEV5AertmV0BYZYtL4rJmsrWRH1YprkZrhjz93Yn++CbZFmBR3x9URELL4/IpFEUqMI 1F9138byCY+yKnAxYylUrBoToQI7VlGuP1GklAjrGPY9fWuG3/xDsHFC1dMT+cbQmKiw nHMAns6M9g0z8oqvJZz+HspOVxCRGN8gAlFX5sMa21oBrXhfWcw5nVrhRAR6YedLke8o 0WcE5296ipsnE5/+q+qryj64uIGEtTCAXtIh8xkqT20KWkcKCu698VJNKvn/qcISdwkx 4S0A== X-Gm-Message-State: APjAAAWaNPA4iRy5ylQcKA2Rh63Rt/JzVuplqVMPNLUyiJRAnbJRAOpq 94VbRsXg0S6ZVc3pXVbLleGNd4/1 X-Google-Smtp-Source: APXvYqw72w67AGSR4nWPZZE/Ghy9yIwJN60Dt3u2ta0z9PuviMUorOmiqffdE4YzrdpRmy9b73KYZg== X-Received: by 2002:a0c:acc2:: with SMTP id n2mr39344946qvc.225.1577454461769; Fri, 27 Dec 2019 05:47:41 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:41 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 07/16] t3030: use test_path_is_missing() Date: Fri, 27 Dec 2019 08:47:16 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Previously, we would use `test_must_fail test -d` to ensure that the directory is removed. However, test_must_fail() should only be used for git commands. Use test_path_is_missing() instead to check that the directory has been removed. Signed-off-by: Denton Liu --- t/t3030-merge-recursive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 2170758e38..d48d211a95 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -604,7 +604,7 @@ test_expect_success 'merge removes empty directories' ' git commit -mremoved-d/e && git checkout master && git merge -s recursive rm && - test_must_fail test -d d + test_path_is_missing d ' test_expect_success 'merge-recursive simple w/submodule' ' From patchwork Fri Dec 27 13:47:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311213 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 C409F17EE for ; Fri, 27 Dec 2019 13:48:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D4A720882 for ; Fri, 27 Dec 2019 13:48:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LMwH3Gxj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727132AbfL0NsE (ORCPT ); Fri, 27 Dec 2019 08:48:04 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:45706 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbfL0Nrn (ORCPT ); Fri, 27 Dec 2019 08:47:43 -0500 Received: by mail-qk1-f193.google.com with SMTP id x1so21498264qkl.12 for ; Fri, 27 Dec 2019 05:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UZESWUx3KrA60v6RRKj6VDQttqoC/p28mvonLMIIhQ0=; b=LMwH3GxjQAsIms7UdCDnQ4D8sY7TInsX1tTM7wx2a7qdU38NbTNndMjbZ3CwtAAzkI zsdSjTKlZAz7HnW1N/yiAkDlsWJnf8QXFmQSouX/Fxg6T7BdYfCDaKYw/TcnHvg8Qfa2 X+fDpjzuehXcQaFUzJtXL8ShkDzWrOV1i/z+x9VnVLYI9X+XslOHp4yT1cvx2XbPpksd 3CO/RdC5Elxh+f9yLa63fLCx0xZNqZ2rl5G/2/bAt0L7WFP5laz4Ec0Blif5g4k+x87L HWDnog3iofBGoZJiIk8cQdZvtC5go/7SH6unAacZvD6C3GwLRN9pMkaPrNAjFaKfHOkj 1Tiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UZESWUx3KrA60v6RRKj6VDQttqoC/p28mvonLMIIhQ0=; b=T9Bcy4a2H/TAL4TelQDVuWifbXx5ndNy6q1vcP86d8ay1dawqw2k0V5RjXvP1WOPWk zbPyvyzsUw9XDm/M9Hv/ZFGRAkBRwcTJhLDndS06Zri39A/O7GszN63+b00FaidKhWoE ZsBv49CGRMU+/b5JQzFQEXm7SxiKfGNQoKcaOjcnASCIPRrz/z37/+5jM7bU6YXTXr8R kJUOnuam0IEoapCzqdNZ0/z1LhvE2I+Ttbxvi6EGqjW64cQFly6kWOr5Jl+x1NlaVYE9 YIBXZmrIjdUSHjoQCOUdWgqUnDLP7Pk0ahYBD+itf60ZfJf7g33DK8KJIMisEKcc4Lo1 2gjA== X-Gm-Message-State: APjAAAWZKjJQfox3HnrzPtrVgidgKUGJ6m2bIBMrDa/nKcioR4W+4Ald Zhob1p/xbR1vusGd9K9hnDiU0ZqL X-Google-Smtp-Source: APXvYqwj6De2MGS8SQXeFY381vAi+ASr0u5sFU5QHePJem6UAUDdwhQ/g8JCRvajE3236UIgHjWOZw== X-Received: by 2002:a37:4f8e:: with SMTP id d136mr43080728qkb.495.1577454462595; Fri, 27 Dec 2019 05:47:42 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:42 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 08/16] t3310: extract common no_notes_merge_left() Date: Fri, 27 Dec 2019 08:47:17 -0500 Message-Id: <68eb05e10edf1f4b09bc4e02587ac5b15fd2c6e3.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We had many statements which were duplicated. Extract and replace these duplicate statements with no_notes_merge_left(). While we're at it, replace the test_might_fail(), which should only be used on git commands, with a compound command that always returns 0, even if the underlying ls fails. Also, remove the redirection from stderr to /dev/null. This is because the test scripts automatically suppress output already. Otherwise, if a developer asks for verbose output via the `-v` flag, the stderr output may be useful for debugging. Signed-off-by: Denton Liu --- t/t3310-notes-merge-manual-resolve.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh index 2dea846e25..1950764694 100755 --- a/t/t3310-notes-merge-manual-resolve.sh +++ b/t/t3310-notes-merge-manual-resolve.sh @@ -32,6 +32,11 @@ verify_notes () { test_cmp "expect_log_$notes_ref" "output_log_$notes_ref" } +no_notes_merge_left () { + { ls .git/NOTES_MERGE_* >output || :; } && + test_must_be_empty output +} + cat <expect_notes_x 6e8e3febca3c2bb896704335cc4d0c34cb2f8715 $commit_sha4 e5388c10860456ee60673025345fe2e153eb8cf8 $commit_sha3 @@ -335,9 +340,7 @@ EOF y and z notes on 4th commit EOF git notes merge --commit && - # No .git/NOTES_MERGE_* files left - test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && - test_must_be_empty output && + no_notes_merge_left && # Merge commit has pre-merge y and pre-merge z as parents test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" && test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" && @@ -397,9 +400,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol test_expect_success 'abort notes merge' ' git notes merge --abort && - # No .git/NOTES_MERGE_* files left - test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && - test_must_be_empty output && + no_notes_merge_left && # m has not moved (still == y) test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" && # Verify that other notes refs has not changed (w, x, y and z) @@ -464,9 +465,7 @@ EOF echo "new note on 5th commit" > .git/NOTES_MERGE_WORKTREE/$commit_sha5 && # Finalize merge git notes merge --commit && - # No .git/NOTES_MERGE_* files left - test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && - test_must_be_empty output && + no_notes_merge_left && # Merge commit has pre-merge y and pre-merge z as parents test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" && test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" && @@ -553,9 +552,7 @@ EOF test_expect_success 'resolve situation by aborting the notes merge' ' git notes merge --abort && - # No .git/NOTES_MERGE_* files left - test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null && - test_must_be_empty output && + no_notes_merge_left && # m has not moved (still == w) test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" && # Verify that other notes refs has not changed (w, x, y and z) From patchwork Fri Dec 27 13:47: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: 11311199 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 7E5D013A4 for ; Fri, 27 Dec 2019 13:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 534972173E for ; Fri, 27 Dec 2019 13:47:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Cw9caz8G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbfL0Nrs (ORCPT ); Fri, 27 Dec 2019 08:47:48 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:43395 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727028AbfL0Nro (ORCPT ); Fri, 27 Dec 2019 08:47:44 -0500 Received: by mail-qv1-f67.google.com with SMTP id p2so10043698qvo.10 for ; Fri, 27 Dec 2019 05:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PawHWGrxbMZYN9kc0TxDmBtdHl4h3CO7sjQEZdlsvLA=; b=Cw9caz8G+MpcBfaIEVSK0fCo8O6mPwZOpTeDDQu+irjmqqQzwkPCApkwaL38sRTm+j 0kbbd98cbR28NQAGl1UPBd0jsQ5GTjCzEyL0x3CifmFHqUn7U5JQ5t/M4aMlG5wlFwIB rYcLopagu+hxLz5YlaIYdo+ZoLJ82KLCljMOQ0zlQV/4t3swLXmDXiCosV8nHaKTOWEn 5To1jyjS1RPjCnjgZ50z0Ck7eincpZRfM6x9J/rOvWnTYwtb/6ZmUYaIGFc5R47OeyAK rLY2SNn3grVTLDx8ILbrBjU9/X0ldQBoqhZpIR1YYD0JatvRSFrvQGu/GHrIGXz6i85j XMgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PawHWGrxbMZYN9kc0TxDmBtdHl4h3CO7sjQEZdlsvLA=; b=O+uUztUyKrkoe9GJ1Y27HDbufALE7yI5J/oeAIowloBnkwfZdosOHiQIFDm8WBontT uLDyVqFgVYJbO09KCScoPB/QE0ZLIR9hLacRduQl+JqHF4NUkeOvsW8i1C3GF3cJG8wR d/M8mMDRuJGxDINUiGDcY6b0VbqOLWZX1CXeaw9fw3f2qqc6B8buCGxI8anhwTGNOiqU BqpKtg69+/LltCkaTY1VxEPbrnR9J2pEQyGIpIrT3Kr8ARRYaZPwhZSnDJ9ZRvBurOVi 3AyNo7zShxMD+yys4ZnglcFjmL+lgCsN+IDwluAIaXyWjCOSwPJByaa5QrwK1F8FCJhP w+jQ== X-Gm-Message-State: APjAAAV4+ECS5SddjvLA//Qd4Jp2MQpt1PoIncncxUMZbq2AwHqgoVt2 u5GQJoKHbX07wr24KDG1MlJ3T7xo X-Google-Smtp-Source: APXvYqyPPiqlrh+UZjQI1ni8rq+t63NXK5PfzHNq0UV0j5TI/fwae4AQg4fjDeNReIFKcK/dMbtK8w== X-Received: by 2002:a0c:e1cd:: with SMTP id v13mr38113971qvl.115.1577454463390; Fri, 27 Dec 2019 05:47:43 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:43 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 09/16] t3415: stop losing return codes of git commands Date: Fri, 27 Dec 2019 08:47:18 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When a command is in a non-assignment subshell, the return code will be lost in favour of the surrounding command's. Rewrite instances of this such that the return code of git commands is no longer lost. Signed-off-by: Denton Liu --- t/t3415-rebase-autosquash.sh | 113 +++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 31 deletions(-) diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index 22d218698e..b0add36f82 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -37,8 +37,12 @@ test_auto_fixup () { git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code $1 && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 1 = $(git cat-file commit HEAD^ | grep first | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && + test_line_count = 1 actual } test_expect_success 'auto fixup (option)' ' @@ -66,8 +70,12 @@ test_auto_squash () { git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code $1 && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 2 = $(git cat-file commit HEAD^ | grep first | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && + test_line_count = 2 actual } test_expect_success 'auto squash (option)' ' @@ -94,7 +102,8 @@ test_expect_success 'misspelled auto squash' ' git log --oneline >actual && test_line_count = 4 actual && git diff --exit-code final-missquash && - test 0 = $(git rev-list final-missquash...HEAD | wc -l) + git rev-list final-missquash...HEAD >list && + test_must_be_empty list ' test_expect_success 'auto squash that matches 2 commits' ' @@ -113,9 +122,15 @@ test_expect_success 'auto squash that matches 2 commits' ' git log --oneline >actual && test_line_count = 4 actual && git diff --exit-code final-multisquash && - test 1 = "$(git cat-file blob HEAD^^:file1)" && - test 2 = $(git cat-file commit HEAD^^ | grep first | wc -l) && - test 1 = $(git cat-file commit HEAD | grep first | wc -l) + echo 1 >expect && + git cat-file blob HEAD^^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^^ >commit && + grep first commit >actual && + test_line_count = 2 actual && + git cat-file commit HEAD >commit && + grep first commit >actual && + test_line_count = 1 actual ' test_expect_success 'auto squash that matches a commit after the squash' ' @@ -134,25 +149,38 @@ test_expect_success 'auto squash that matches a commit after the squash' ' git log --oneline >actual && test_line_count = 5 actual && git diff --exit-code final-presquash && - test 0 = "$(git cat-file blob HEAD^^:file1)" && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 1 = $(git cat-file commit HEAD | grep third | wc -l) && - test 1 = $(git cat-file commit HEAD^ | grep third | wc -l) + echo 0 >expect && + git cat-file blob HEAD^^:file1 >actual && + test_cmp expect actual && + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD >commit && + grep third commit >actual && + test_line_count = 1 actual && + git cat-file commit HEAD^ >commit && + grep third commit >actual && + test_line_count = 1 actual ' test_expect_success 'auto squash that matches a sha1' ' git reset --hard base && echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! $(git rev-parse --short HEAD^)" && + oid=$(git rev-parse --short HEAD^) && + git commit -m "squash! $oid" && git tag final-shasquash && test_tick && git rebase --autosquash -i HEAD^^^ && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-shasquash && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep squash commit >actual && + test_line_count = 1 actual ' test_expect_success 'auto squash that matches longer sha1' ' @@ -160,15 +188,20 @@ test_expect_success 'auto squash that matches longer sha1' ' echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! $(git rev-parse --short=11 HEAD^)" && + oid=$(git rev-parse --short=11 HEAD^) && + git commit -m "squash! $oid" && git tag final-longshasquash && test_tick && git rebase --autosquash -i HEAD^^^ && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-longshasquash && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep squash commit >actual && + test_line_count = 1 actual ' test_auto_commit_flags () { @@ -183,8 +216,12 @@ test_auto_commit_flags () { git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-commit-$1 && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test $2 = $(git cat-file commit HEAD^ | grep first | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && + test_line_count = $2 actual } test_expect_success 'use commit --fixup' ' @@ -210,11 +247,15 @@ test_auto_fixup_fixup () { ( set_cat_todo_editor && test_must_fail git rebase --autosquash -i HEAD^^^^ >actual && + head=$(git rev-parse --short HEAD) && + parent1=$(git rev-parse --short HEAD^) && + parent2=$(git rev-parse --short HEAD^^) && + parent3=$(git rev-parse --short HEAD^^^) && cat >expected <<-EOF && - pick $(git rev-parse --short HEAD^^^) first commit - $1 $(git rev-parse --short HEAD^) $1! first - $1 $(git rev-parse --short HEAD) $1! $2! first - pick $(git rev-parse --short HEAD^^) second commit + pick $parent3 first commit + $1 $parent1 $1! first + $1 $head $1! $2! first + pick $parent2 second commit EOF test_cmp expected actual ) && @@ -222,13 +263,17 @@ test_auto_fixup_fixup () { git log --oneline >actual && test_line_count = 3 actual git diff --exit-code "final-$1-$2" && - test 2 = "$(git cat-file blob HEAD^:file1)" && + echo 2 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && if test "$1" = "fixup" then - test 1 = $(git cat-file commit HEAD^ | grep first | wc -l) + test_line_count = 1 actual elif test "$1" = "squash" then - test 3 = $(git cat-file commit HEAD^ | grep first | wc -l) + test_line_count = 3 actual else false fi @@ -256,19 +301,25 @@ test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' ' echo 2 >file1 && git add -u && test_tick && - git commit -m "squash! $(git rev-parse --short HEAD^)" && + oid=$(git rev-parse --short HEAD^) && + git commit -m "squash! $oid" && echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! $(git log -n 1 --format=%s HEAD~2)" && + subject=$(git log -n 1 --format=%s HEAD~2) && + git commit -m "squash! $subject" && git tag final-squash-instFmt && test_tick && git rebase --autosquash -i HEAD~4 && git log --oneline >actual && test_line_count = 3 actual && git diff --exit-code final-squash-instFmt && - test 1 = "$(git cat-file blob HEAD^:file1)" && - test 2 = $(git cat-file commit HEAD^ | grep squash | wc -l) + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep squash commit >actual && + test_line_count = 2 actual ' test_expect_success 'autosquash with empty custom instructionFormat' ' From patchwork Fri Dec 27 13:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311197 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 F13B3139A for ; Fri, 27 Dec 2019 13:47:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF9902173E for ; Fri, 27 Dec 2019 13:47:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="u9zNLwao" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbfL0Nrr (ORCPT ); Fri, 27 Dec 2019 08:47:47 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46227 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfL0Nrp (ORCPT ); Fri, 27 Dec 2019 08:47:45 -0500 Received: by mail-qt1-f193.google.com with SMTP id g1so17686490qtr.13 for ; Fri, 27 Dec 2019 05:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Whc5IlrY5zqdJDuhdyeykwzTk5NIvs/QmaybdZm/sHw=; b=u9zNLwao9ScjC9UHeT4CNXo8KE3Lg8g4gCVXetZ3L/IhEOoHQUCiqwo3aJDJfd6t8R Kewz3AhTsgQ2DU4YFEkCJaWFKpeM0WpnFUJFeGpFXoUZj15enlqZqn2JQ7OdZlYG5aoG Wcuzq0bPscW3nNaKIsXbz7uQ65OH+GUYsibDBxQ99dB5UTh0b77Y/dxJIF8n7rv4FjMA pjIMK23iopB8GSGTB6gdBe+VCPm/GQg65xIQpSUqZg55uEBW2/t/M6VIPrvg2zpn3pyz CwQf8ZtMm+Lq+B+pX4MEZnuEJ/r8i6xlxUlkNh7X4Ib04AcP0ElEp+noEdesTy6sl9cx ONyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Whc5IlrY5zqdJDuhdyeykwzTk5NIvs/QmaybdZm/sHw=; b=UX9iZwoJRAw6Dhz+9hhuAN6r9I0QCDqqzY3c8P3YCnZjfcxD5FGROKXjJoKKQrsxwL h/SdztQVpnvvDJxNq/kVfnm90YCVa4ySK0QxBYW8sBt9C5ESpKHuFKECQo8yVM96GgXA 9M+MG+eRSP6GWsV+l20KMRQcGwUUM78ngdYpCXhEQc6ieTXgexoGEgFEfDBs2qXH2FsH mg2aSk3mJzLOipRI33XRZDOckeHX7tR9A+XYz5MxmwP78FoZoQBrDkdg532cEGndFG5n 3taS4mzGavC/JhJWYKKs5C0Ofy5cnvZh99Vya57QETlHBQaL87tka49wJUVDFdGh9K6J /9Hw== X-Gm-Message-State: APjAAAUpQhzwu2LL0UPDeOqHxWb/TX2heeKfG++aQ+dBrfi7dFB9tOR9 UgVmPwZpgtAgHZUvYBKdD8SD76k8 X-Google-Smtp-Source: APXvYqw8ytTLE0J5uomh8jeG2zSTmclcbMtByeBKiVdFVEqo0X7Y3rmCIaFwJjieULnX1McPrzAhjA== X-Received: by 2002:ac8:6c5:: with SMTP id j5mr38985798qth.284.1577454464249; Fri, 27 Dec 2019 05:47:44 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:43 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 10/16] t3415: increase granularity of test_auto_{fixup,squash}() Date: Fri, 27 Dec 2019 08:47:19 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We used to use `test_must_fail test_auto_{fixup,squash}` which would ensure that the function failed. However, this is a little ham-fisted as there is no way of ensuring that the expected part of the function actually fails. Increase the granularity by accepting an optional `!` first argument which will check that the rebase does not squash in any commits by ensuring that there are still 4 commits. If `!` is not provided, the old logic is run. This patch may be better reviewed with `--ignore-all-space`. Signed-off-by: Denton Liu --- t/t3415-rebase-autosquash.sh | 64 +++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index b0add36f82..093de9005b 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -25,6 +25,13 @@ test_expect_success setup ' ' test_auto_fixup () { + no_squash= && + if test "x$1" = 'x!' + then + no_squash=true + shift + fi && + git reset --hard base && echo 1 >file1 && git add -u && @@ -35,14 +42,19 @@ test_auto_fixup () { test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && - test_line_count = 3 actual && - git diff --exit-code $1 && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && - test_line_count = 1 actual + if test -n "$no_squash" + then + test_line_count = 4 actual + else + test_line_count = 3 actual && + git diff --exit-code $1 && + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && + test_line_count = 1 actual + fi } test_expect_success 'auto fixup (option)' ' @@ -52,12 +64,19 @@ test_expect_success 'auto fixup (option)' ' test_expect_success 'auto fixup (config)' ' git config rebase.autosquash true && test_auto_fixup final-fixup-config-true && - test_must_fail test_auto_fixup fixup-config-true-no --no-autosquash && + test_auto_fixup ! fixup-config-true-no --no-autosquash && git config rebase.autosquash false && - test_must_fail test_auto_fixup final-fixup-config-false + test_auto_fixup ! final-fixup-config-false ' test_auto_squash () { + no_squash= && + if test "x$1" = 'x!' + then + no_squash=true + shift + fi && + git reset --hard base && echo 1 >file1 && git add -u && @@ -68,14 +87,19 @@ test_auto_squash () { test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && - test_line_count = 3 actual && - git diff --exit-code $1 && - echo 1 >expect && - git cat-file blob HEAD^:file1 >actual && - test_cmp expect actual && - git cat-file commit HEAD^ >commit && - grep first commit >actual && - test_line_count = 2 actual + if test -n "$no_squash" + then + test_line_count = 4 actual + else + test_line_count = 3 actual && + git diff --exit-code $1 && + echo 1 >expect && + git cat-file blob HEAD^:file1 >actual && + test_cmp expect actual && + git cat-file commit HEAD^ >commit && + grep first commit >actual && + test_line_count = 2 actual + fi } test_expect_success 'auto squash (option)' ' @@ -85,9 +109,9 @@ test_expect_success 'auto squash (option)' ' test_expect_success 'auto squash (config)' ' git config rebase.autosquash true && test_auto_squash final-squash-config-true && - test_must_fail test_auto_squash squash-config-true-no --no-autosquash && + test_auto_squash ! squash-config-true-no --no-autosquash && git config rebase.autosquash false && - test_must_fail test_auto_squash final-squash-config-false + test_auto_squash ! final-squash-config-false ' test_expect_success 'misspelled auto squash' ' From patchwork Fri Dec 27 13:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311209 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 A1DA8139A for ; Fri, 27 Dec 2019 13:47:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 718DE21582 for ; Fri, 27 Dec 2019 13:47:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hlnD54+i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbfL0Nru (ORCPT ); Fri, 27 Dec 2019 08:47:50 -0500 Received: from mail-qv1-f53.google.com ([209.85.219.53]:38752 "EHLO mail-qv1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726999AbfL0Nrq (ORCPT ); Fri, 27 Dec 2019 08:47:46 -0500 Received: by mail-qv1-f53.google.com with SMTP id t6so10071059qvs.5 for ; Fri, 27 Dec 2019 05:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hRHf+1abQ65c730N4vO7z7hEQYAWv5vbK/6rNYgALsQ=; b=hlnD54+iYhWcfcKBMTkXNDN2qSNwHR/76sYROoOYQJ7vP9UARwU2W4m8gi4MKHJu7H Q27z45TblENnqJO1lkiAv0F7EoIphosSxc5tk05n5+Qf2CHs6ALCSihu8C8gJJSDzfv3 ld1TaBtCsnrBCvKJyI+YR8d8mq674RnwJgoIsVciM0f+pHSrKIWaN3HPgjKNPiaAoguf f8+d0TER7GURpWvxCmYUyhauvZiK6fJX09wbFxoEUFFc3ChkHk2RwwtQr0xr+KaPJcNK 2Nxji8ebL2P2QEAWA1lHTft81PyaZcOUzVD3809u/lQqouOwdjYnsyKT+x1PO6hSsrJ0 ndug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hRHf+1abQ65c730N4vO7z7hEQYAWv5vbK/6rNYgALsQ=; b=fjqXWBzYMgfaO70MY8G0yeb7KCIN9g8nl3OAlzhXM34ObXpyUmyvqGJmnV0K0Ealmn flPLpPM2yFSTQeofz4emG5aglfz8ww7EtzJCxPa8I04Q9c+9fuz2wCZonrM1NYtr9FUC PhqCFcvMqdL1+dITZbMo2dCiY8xFQXZrCmEIilsg5J5xe+WnfrQ0YBgm58DAjf8Nihoa ph1oFzctUSTgabOypv0CVzkwBpXzFDO8X8IzUW3D2SoTyJtrTwronfW5ocLaD8hoI/ty Yd1xQE77BaHJXR/nisXrYVNlMkX/eQ2w8BTAc8htMN/hREcGy8VRUTN/Iht/qua4qhbj J/eQ== X-Gm-Message-State: APjAAAUhwLS9ecpKgAWyJekoapExHct3O+a8Wzmn+/i3z97GNDvziuOw iZvw1quLu0v9soIDzSQ3YI3kecTl X-Google-Smtp-Source: APXvYqy/FBvHLWP9QrUnlYxcGGdcvz3dmSpqXADDhCzRzgK7QXqbJRJTAGRTZr6D/6VqrLgbBVlDOw== X-Received: by 2002:ad4:4d50:: with SMTP id m16mr39964312qvm.186.1577454464916; Fri, 27 Dec 2019 05:47:44 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:44 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 11/16] t3419: stop losing return code of git command Date: Fri, 27 Dec 2019 08:47:20 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We had an instance of a git command in a non-assignment command substitution. Its return code was lost so we would not be able to detect if the command failed for some reason. Since we were testing to make sure the output of the command was empty, rewrite it in a more canonical way. Signed-off-by: Denton Liu --- t/t3419-rebase-patch-id.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh index 49f548cdb9..94552669ae 100755 --- a/t/t3419-rebase-patch-id.sh +++ b/t/t3419-rebase-patch-id.sh @@ -80,7 +80,8 @@ do_tests () { git commit -q -m "change big file again" && git checkout -q other^{} && git rebase master && - test_must_fail test -n "$(git rev-list master...HEAD~)" + git rev-list master...HEAD~ >revs && + test_must_be_empty revs ' test_expect_success $pr 'do not drop patch' ' From patchwork Fri Dec 27 13:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311201 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 BDE1A13A4 for ; Fri, 27 Dec 2019 13:47:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BCC720882 for ; Fri, 27 Dec 2019 13:47:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J0iT4Fsc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfL0Nru (ORCPT ); Fri, 27 Dec 2019 08:47:50 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:36720 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbfL0Nrq (ORCPT ); Fri, 27 Dec 2019 08:47:46 -0500 Received: by mail-qt1-f194.google.com with SMTP id q20so24595661qtp.3 for ; Fri, 27 Dec 2019 05:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xJdgq7axgBtQxrUUYGy+Eua5jxEwrdmdIsn50nui39Q=; b=J0iT4Fsc9NPOZPr3DXzkN2TmmzH5zabobwGl8U96dk+JOFMVEvWaxR1Anqvmtn5oun dQeJRUvpaUGEmDn4ykWNK421uVdQgAntseIDWpdxPZhhzInuxbD59rDujf2JMP2/Ht73 mz7jK5LcpZB4nVYfMjTi3vRs4g4wQWVVKDqfVFr5BW0jQgq8yy5VCM3G4rI7rdVDxm31 gXrPDmNWvgP6kadS6mCL/uT5KSgoHIF3z8Wr+5b9TUzjilMp7/jiM3Y5XQUAUD3KVW+Y VAPZIBGmrGuSdsdEyhGleda8swO5H1NrFKxlISlfbZg6MYzKS//r4+YNPDZqGGvI3ulM 3R4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xJdgq7axgBtQxrUUYGy+Eua5jxEwrdmdIsn50nui39Q=; b=Rc20Dg0yu5LtQxvMFWJnC9xanUNLrD2Uqhy66TQZWcpzOHQ2ISZNG7j1d6AeFvGDzh G05d+UTqzuUOe7bnyMOUlD9oL8YutF0kgkYNmbNh7mKWbzckl++v1DzyAAoIsank7wZS UBlXmoqLaSGDHwb2Pot2C9tfs6tgK+o+exue+f/u0Vy/Z+DgNMIvvsWfPH+PqWCUF/ie 8XxgFfiBDKqgO/msoYW8ahhNXCKs40fGRvvpHJQBtfZIWS4zTCtgJfN303hcFEFC4Qv7 vQHaHUhZtE7jwBLNlbKhKYaMbsuNbrmsFq5G4ePpBkeT8d4uw20ScYv0XDgCQnM78alo IGvg== X-Gm-Message-State: APjAAAUp7xV8tyeF7cfYG1UHpxu+ffE3BqhNhhEmam9eLYzonfIMwIAR ZhXRSTn0Q6J/v0AGmIQaKZzY7qDi X-Google-Smtp-Source: APXvYqy5xJIMQod8ImOFD/A3WKiq5g+/wCI3TgSxLrv5LLAxvmOUt0ZcyaqkFx76Mmq9+WBqw1732g== X-Received: by 2002:ac8:1835:: with SMTP id q50mr36740936qtj.210.1577454465874; Fri, 27 Dec 2019 05:47:45 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:45 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 12/16] t3504: don't use `test_must_fail test_cmp` Date: Fri, 27 Dec 2019 08:47:21 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since test_cmp() just wraps an external command, replace `test_must_fail test_cmp` with `! test_cmp`. Signed-off-by: Denton Liu Signed-off-by: Johannes Sixt --- t/t3504-cherry-pick-rerere.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh index a267b2d144..c31141c471 100755 --- a/t/t3504-cherry-pick-rerere.sh +++ b/t/t3504-cherry-pick-rerere.sh @@ -95,7 +95,7 @@ test_expect_success 'cherry-pick --rerere-autoupdate more than once' ' test_expect_success 'cherry-pick conflict without rerere' ' test_config rerere.enabled false && test_must_fail git cherry-pick master && - test_must_fail test_cmp expect foo + ! test_cmp expect foo ' test_done From patchwork Fri Dec 27 13:47: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: 11311203 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 F1F21139A for ; Fri, 27 Dec 2019 13:47:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CECED20CC7 for ; Fri, 27 Dec 2019 13:47:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WLUFQBOQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbfL0Nrv (ORCPT ); Fri, 27 Dec 2019 08:47:51 -0500 Received: from mail-qt1-f180.google.com ([209.85.160.180]:39505 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727047AbfL0Nrs (ORCPT ); Fri, 27 Dec 2019 08:47:48 -0500 Received: by mail-qt1-f180.google.com with SMTP id e5so24592942qtm.6 for ; Fri, 27 Dec 2019 05:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kPOpJyjIKUzUQI4LPwLVu83SnmiHvUZrpJR9Z+MuXqM=; b=WLUFQBOQnHrFtiyfqtBInaUWh1U0fJhu5oauN5byL04lVYGlGHlnpXUSjbDViD3mq6 z4kB9OjEZlNcCqTNRFxROtyn/eH1ErHbQu9t99WJ3iG2ZkONYByddYE8r+B8UAXlcwDn SvFadntmY79z1DbGL8A/DK8AUorNWPXB+DwLzJiGLRdZaHOk5EKv27UlRHprkXMq4PCe 42NAhK5TLqs085CoyO+GfetqUtCvU+6KrcVrwOsbpz89aJntrf8ezXXJMYI1iaJvRCsO AXdQxPRE48Me/jh7FnO/kI674uzs4/gvFVukd/XziL+ORBd3ua9SQe5CZyBmXpqQn2T7 sgog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kPOpJyjIKUzUQI4LPwLVu83SnmiHvUZrpJR9Z+MuXqM=; b=tpUYmCr7pfyT1sSIcXowLo7Py85rClo3jJVal3xg7OjgL4vGxLHngtZzptFKwyMPTS 1aKmeQIy4DiaPjTSJ0tYXLq5FGRSP5GJOdt9xC0mcYuCC1BUndB8y28gOB7tI05ueE6/ OfOq+YnPyWFrpQyCDTAlCqGW64xMD9xCwH5fHxCeY2b8oLJwlbIwp2ZOW5poU06+ORfr 6WXb1sWpKRENS0yS0PE7RGP8igJRYWK1smk2Wmwt38LwwbIzxkBvKlhij2ugU4Mk0WX9 cB+wUNMBFlfETc/8Svlfqa2BLC0PI0Sv7GuZEfGTRlMecv5YA4rGA7+JIx+PHCjYACXU Xk/Q== X-Gm-Message-State: APjAAAWNxeN+BVqIQMRQ8MvdxOXKScw4Gde8ioL5Bg5SubIQVGanGdEM 7Q2nmRRC3PlxV0Tg2I0L3l6r6YQh X-Google-Smtp-Source: APXvYqz+xFx0MwCkeXqDzAXGbPdLE/beTiw7a4k85mgIt2r629v5JwL1WrfmX6GWNUbdEzxpZcjeRQ== X-Received: by 2002:ac8:5357:: with SMTP id d23mr31975640qto.76.1577454466909; Fri, 27 Dec 2019 05:47:46 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:46 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 13/16] t3507: fix indentation Date: Fri, 27 Dec 2019 08:47:22 -0500 Message-Id: <0cfc46c5fd0c2a391de9185fe215344720e4413e.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We had some test cases which were indented 7-spaces instead of a tab. Fix this by reindenting with a tab instead. This patch should appear empty with `--ignore-all-space`. Signed-off-by: Denton Liu --- t/t3507-cherry-pick-conflict.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index 9b9b4ca8d4..2a0d119c8a 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -381,23 +381,23 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' ' ' test_expect_success 'successful final commit clears revert state' ' - pristine_detach picked-signed && + pristine_detach picked-signed && - test_must_fail git revert picked-signed base && - echo resolved >foo && - test_path_is_file .git/sequencer/todo && - git commit -a && - test_must_fail test_path_exists .git/sequencer + test_must_fail git revert picked-signed base && + echo resolved >foo && + test_path_is_file .git/sequencer/todo && + git commit -a && + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'reset after final pick clears revert state' ' - pristine_detach picked-signed && + pristine_detach picked-signed && - test_must_fail git revert picked-signed base && - echo resolved >foo && - test_path_is_file .git/sequencer/todo && - git reset && - test_must_fail test_path_exists .git/sequencer + test_must_fail git revert picked-signed base && + echo resolved >foo && + test_path_is_file .git/sequencer/todo && + git reset && + test_must_fail test_path_exists .git/sequencer ' test_expect_success 'revert conflict, diff3 -m style' ' From patchwork Fri Dec 27 13:47:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11311211 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 2AB2E139A for ; Fri, 27 Dec 2019 13:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0985F21582 for ; Fri, 27 Dec 2019 13:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WLxPfSOn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbfL0NsA (ORCPT ); Fri, 27 Dec 2019 08:48:00 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:46706 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbfL0Nrt (ORCPT ); Fri, 27 Dec 2019 08:47:49 -0500 Received: by mail-qv1-f66.google.com with SMTP id u1so9222610qvk.13 for ; Fri, 27 Dec 2019 05:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=aWlBZHdRpXk08WEH4QPYmOi7GcWNXddjtBkRW14UKxQ=; b=WLxPfSOnQKUH5qv3w6DSmzOJIoZu585SefWA0YfTTyFozqyNVJL3g1Og24+hvxrF6P CiPPCdB2aE0KSfUXM7dUzlkt4BN885dowg7qLmsd3vStq+SJe6uoZlpEyLxk+tV7WkCH Xk0c/GNENDuUggqQveHEg5s3FEmhwWFiCp3UoPg35MSa2erPcDt+EgEaW5Lg8IPFTSFX FTmjkUjdobspSGXyh6n7b+niS9yd0idXms+X+MsvVtVrN5hIqv5WwBT8tbojfvEpTcgR Gpj+oPLAV+epn8AU3SGxdorqQVvTmnUv5cjSNdiLpk3t++Mu0O7qD1jCvLY6xsnM9mIW 0Cug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aWlBZHdRpXk08WEH4QPYmOi7GcWNXddjtBkRW14UKxQ=; b=WVh8CocP2NkRTuLtVDjCTCoI7ML+h6hmSVba06veq8f3Elx1MQhMplaiMVXPlqaKli HjGwrmeyYQ1ivNfYpbZ1ZhJ5XH6K9VHB75MM1hjefbwopfCARK+53NyaPTlnEXBoOC3o si6mWpp8o2pyXYzSHWRAimyI3uLeupqzW7/rrxw+qvYAh+Ai71Equ2xeqb9zIPVbqVuU q2qsklCAgw0Z09c2PSCl7RFsx+grJKMBCvoaI41SSBhF01NYgevge+Our8UFTkLnKbo/ QIOr1IB+FxCHOy36rrTORCvKMCAQPXQ/8O/LVN9L+Uafx55Z362YrGN1Thwg/8HHPjfZ MxfQ== X-Gm-Message-State: APjAAAXsI64A2Hf8Wa9CgOdF9ROL9q3F/5YkA1n5agJXA6hfBcYmEgBc 00xWGKhthbXwGwKeLi0i9V5eLvhj X-Google-Smtp-Source: APXvYqzuv+v9902ypCBK4xN1hR50EKiUh+K0P2U2AcEXIi+qpx4LQH6NF0iwP0kTzUA3zALp3VaJcw== X-Received: by 2002:a05:6214:1923:: with SMTP id es3mr41147767qvb.49.1577454468326; Fri, 27 Dec 2019 05:47:48 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:47 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 14/16] t3507: use test_path_is_missing() Date: Fri, 27 Dec 2019 08:47:23 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail() function should only be used for git commands since we should assume that external commands work sanely. Replace `test_must_fail test_path_exists` with `test_path_is_missing` since we expect these paths to not exist. Signed-off-by: Denton Liu --- t/t3507-cherry-pick-conflict.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index 2a0d119c8a..9bd482ce3b 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -168,7 +168,7 @@ test_expect_success 'successful final commit clears cherry-pick state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git commit -a && - test_must_fail test_path_exists .git/sequencer + test_path_is_missing .git/sequencer ' test_expect_success 'reset after final pick clears cherry-pick state' ' @@ -178,7 +178,7 @@ test_expect_success 'reset after final pick clears cherry-pick state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git reset && - test_must_fail test_path_exists .git/sequencer + test_path_is_missing .git/sequencer ' test_expect_success 'failed cherry-pick produces dirty index' ' @@ -387,7 +387,7 @@ test_expect_success 'successful final commit clears revert state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git commit -a && - test_must_fail test_path_exists .git/sequencer + test_path_is_missing .git/sequencer ' test_expect_success 'reset after final pick clears revert state' ' @@ -397,7 +397,7 @@ test_expect_success 'reset after final pick clears revert state' ' echo resolved >foo && test_path_is_file .git/sequencer/todo && git reset && - test_must_fail test_path_exists .git/sequencer + test_path_is_missing .git/sequencer ' test_expect_success 'revert conflict, diff3 -m style' ' From patchwork Fri Dec 27 13:47: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: 11311205 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 C0D9C13A4 for ; Fri, 27 Dec 2019 13:47:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E79221582 for ; Fri, 27 Dec 2019 13:47:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QWkOdiCI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726675AbfL0Nrw (ORCPT ); Fri, 27 Dec 2019 08:47:52 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:42730 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfL0Nru (ORCPT ); Fri, 27 Dec 2019 08:47:50 -0500 Received: by mail-qk1-f194.google.com with SMTP id z14so20281934qkg.9 for ; Fri, 27 Dec 2019 05:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6+7kClIqTkX6XCzr5s1xheGNmxoBc7YbAKdesibbR3g=; b=QWkOdiCI0ibATItGgWWTMBMHZuxeoJfBWxOrMfBwfLfT715ctdFklFizLBYJw4qX11 XYZ1DwzoPJjOmHxf5tMHBW7z4KD4TqPrMOsxl6nsd/sIgbK3dZti5xGGx9lioZ3/eSoZ aC+fG4Dn5n05UWwFSZGhR/+OTHChXjk6w3yJ7RY30GeXW+Xi8OMTN94W6o+3ToiG4/s2 iDHf0geDK6mWa2TIURpDPBCRhXZEcQo6fnpAHOsL1+Fg1R8r2R+AmRHE70H4Cu0n8Gtl YhmGohb4cT0uOr/sgtaxr0VwqMGjHbsKLwbqfUFe/BJudZKtcthyilmMHpVFxay1MiBT huBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6+7kClIqTkX6XCzr5s1xheGNmxoBc7YbAKdesibbR3g=; b=NgNJ7fu/42f62yq6vAHTp+rnSjAtuy1Fy+8S8WGuwTC0PId3+WchdpxzMTwMUFy22/ Nh4WmoaVYpX+Yv5JU+KXhycCJLcFbSfgPiR9Y22r6OGagkEDmzWmq8YdAEMm4eHeOvYR k8VMOvoIm7RLh/PIqX3uST9yayCT3ON7BAMgYDO99TGA39jaNbxDMWSJQKvaFamyeK4F zHBxIcQmGidle6UiI5UfmNsDD5/ic6LjxEpF0KaQVAlZIYrSwMrqLKD4AFv51sPrwjvn hI+/18OSAGt1tflKIEuklOTqS8TcfyhHhYfcT52nZ2xQsTjkTxpVKL7HfXkW82U0xlSY EVQg== X-Gm-Message-State: APjAAAUHy0MPIY7I9xpnGKdIMSSrwSPK2tZ5t4tUbVcGrn9e5VDtaI7t Noy9O0mp4JDRbA7fB4sLlpEd6heQ X-Google-Smtp-Source: APXvYqxaF6tJcKwZhfWYm/LfMKiLJNn1HBA8LrV4E/aDaij7/6XmQFzjQ9CHZaLJu//E76s4suRl7g== X-Received: by 2002:a37:4ac6:: with SMTP id x189mr42342595qka.219.1577454469163; Fri, 27 Dec 2019 05:47:49 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:48 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 15/16] t4124: only mark git command with test_must_fail Date: Fri, 27 Dec 2019 08:47:24 -0500 Message-Id: X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since apply_patch wraps a sed and git invocation, rewrite it to accept an `!` argument which would cause only the git command to be prefixed with `test_must_fail`. Signed-off-by: Denton Liu --- t/t4124-apply-ws-rule.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh index ff51e9e789..21a4adc73a 100755 --- a/t/t4124-apply-ws-rule.sh +++ b/t/t4124-apply-ws-rule.sh @@ -35,9 +35,15 @@ prepare_test_file () { } apply_patch () { + should_fail= && + if test "x$1" = 'x!' + then + should_fail=test_must_fail && + shift + fi && >target && sed -e "s|\([ab]\)/file|\1/target|" X-Patchwork-Id: 11311207 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 0B0A113A4 for ; Fri, 27 Dec 2019 13:47:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC02020CC7 for ; Fri, 27 Dec 2019 13:47:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ENhz6GR7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727047AbfL0Nr5 (ORCPT ); Fri, 27 Dec 2019 08:47:57 -0500 Received: from mail-qk1-f181.google.com ([209.85.222.181]:40295 "EHLO mail-qk1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726579AbfL0Nry (ORCPT ); Fri, 27 Dec 2019 08:47:54 -0500 Received: by mail-qk1-f181.google.com with SMTP id c17so21534565qkg.7 for ; Fri, 27 Dec 2019 05:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+FDqB+Bs8aMrZrdg71JpMtq5tQJuDAeH091ij9TslJE=; b=ENhz6GR7HDnzA7lhhcPA9uMLCl324oyav0rs7jfpX1jzGm4iuvEhSqhmwUEwTQqubb STs7dUrtV4s1saaDFJPt+L5WYSbuv5RndswkaOt4bc27SWXYD+gJxa9tobGtqhsYbHu0 H4HDdADYFiJO94VAEocsxzZsgRAuWofbZsGGCiP3nJHDdrP4obte+aHSllpzV+cggvDo VTWO5CJ8h9ugGSTVQXI9D47sVmJUzKp+ZiNbkuYuxAsGkEodG0XrCaFCiD0I27JNTxa2 Y6BKRUfyHTsiO8s4EvnK62SEfCvibEOxzIwvnjk3elKnE3v1p/BVNUBgGNqFc8XHiGrf IKgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+FDqB+Bs8aMrZrdg71JpMtq5tQJuDAeH091ij9TslJE=; b=gUJ3fTymDX+Rq6jtY2rMYsHCC//67O9Ini16uabZVlMHTw02inetkpea1KuCd3ORwE X/B5yJ64HKpQA+x1al7U6xOVolAARmPKHPgm9CgGyfyAe3B4WvsFi3v0BkuMnTR/zeag Zcv3+7FbCMm2f6MR3Q7D/sefLhvKzvI+ZBJ+pA5n5aiLmSvfb4TzWOIH7WVjiOsF6KPE K2RCnRtlgjcMGIHruf1i7sFEeUZAcGVR/3W120UVV1uRc7y5NBuTSNUlIvXUsDwkxG3u yzs7yZfgKSE/T57kW7sl8ZR0LSMfSMrKHzfWjXf4N6T3dqjvjQMTMdiVBajALIyJ6s6V l8yQ== X-Gm-Message-State: APjAAAWMBXmfDNuWSIfnVqrmYFYRZMYdMfE48M5gxU/2/YLCWtQtZ/Rb wgoXJTL25FEdSYkiSA9BGjv9TAW7 X-Google-Smtp-Source: APXvYqyTl0TWHz4IyHcyCJcp4A1x5Cv53YqQNDhDEu57i2Ik5rq2d50vRCpathEitFIbcMi5Syjkdw== X-Received: by 2002:a37:6287:: with SMTP id w129mr42839369qkb.381.1577454472920; Fri, 27 Dec 2019 05:47:52 -0800 (PST) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id d9sm10510184qth.34.2019.12.27.05.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 05:47:52 -0800 (PST) From: Denton Liu To: Git Mailing List Subject: [PATCH 16/16] t4124: let sed open its own files Date: Fri, 27 Dec 2019 08:47:25 -0500 Message-Id: <54315fecfe373d8020f2172b9b43e02c0dae137d.1577454401.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.810.g65a2f617f4 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In one case, 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/t4124-apply-ws-rule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh index 21a4adc73a..2b19ef9811 100755 --- a/t/t4124-apply-ws-rule.sh +++ b/t/t4124-apply-ws-rule.sh @@ -42,7 +42,7 @@ apply_patch () { shift fi && >target && - sed -e "s|\([ab]\)/file|\1/target|"