From patchwork Wed Jan 17 19:52:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522149 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B7E924A00 for ; Wed, 17 Jan 2024 19:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521160; cv=none; b=Ds0Uh2J0S/4XeodML2ihH0/RsmkfbwstOaaimXflB4mt1oM/HVLA41aAjyvB81PR9uWMYHrh6zVnP4/pXswP4d0fIluaf5d45oIzODcdZaEyXeiMsirtPWeLht7wKdJv1iVRvLXq+KCHDpW96e+E0wM9ZOZkv/7Y3SDOGN7ACIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521160; c=relaxed/simple; bh=RoxdyeC6cpOQLjPIp6RXwh6Y/LLzeAzU8RMOZR2wtUI=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=L7nYMBWigst+WQ9j25gGWekOM7XVx91OKnC1YzlRp8kMUvvVHuvzdn0vwW0ymjHB0O3cEQF4ydLi8AVHFvLQsr3hNQ7ht6inTif0TgILJuYk3attG16lfLOw4EeoDoODV7HJGkcmqscQcvGnHEKaAznlz6anQU486wjQZfLk9oU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AEBwp+Yv; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AEBwp+Yv" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40e884de7b9so14958615e9.0 for ; Wed, 17 Jan 2024 11:52:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521157; x=1706125957; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=KUk5maxfA9DavACZ1/BEbKnbdW5wjnD8zLg2BFTrtDU=; b=AEBwp+YvWrJHrfCIL0VwaC8Bt9VHI77K4D4bEjx+cfCG98knKYQvsWCHYkx7JUXVmM VzacOcMU2krT2rKoO/WVUls83/tDZmZzkRVYQUP9jqhPOF1z1bdew6Bnu8Irtbd/NlNQ Jq3ybb34IR6fVstHUZI4N6sKwzMCwvEeEEAKpmCVrJLryCQZwcwCmMEMIr2YB/lNCOgI m5C/JLuZ/OhHWYOCY/uGHrIe6soLPrfPi7W+zcAIAbogSRrbsScT0xsPJjOYROSrsm9F Fl7ZBD9zRNhvd+6n9/rU8BU5CRhYkTyszD1/E9ksiHwxYYL4Yb6dpPdJMGOJFkKnT3zw YHmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521157; x=1706125957; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KUk5maxfA9DavACZ1/BEbKnbdW5wjnD8zLg2BFTrtDU=; b=JdCKEMJDhFIwWrJgnwc8+5GTfrWwI0SlY8MPVeV5Lli+52gUM9HULQ6av9ffQbLbTY JH/+o897/3CubyYah7K365FkD+gJ31Qd/1c5jQv34iznyCFIweTJF96AnazYabLy/tsc 2jcJDgPM1viYpK5VXipDMNHTz79qY3VAz2GIuafarUqvTTRMYHsweDT9uprMOGIuiGls sCX0hTVN5YoXcqKR/mFgPFJoZNzemj83w/zgHjq8Uzc2LwUKBE5JlHPvWR8UjXoznNhz l2c+hAAqJFPWMRnZ/MgZTfsS5l7gyQUNJw0jdaD2zcfX8tBroWDTtHQ5d7RskyvLNwoi SL4A== X-Gm-Message-State: AOJu0YzjPuHK7PUdvBE1QQ+tXvuRRkqjcJ6+LPHa6tMAUsM7qU4RGZbL d4MKkJDOBMQw413dvmTExdGTX8KJKU0= X-Google-Smtp-Source: AGHT+IEwI5hMz5Rk83Gc41hIcDE1dS97SZY+QOp3DhOYHqXVy8+Uc2DZcm4VpOfoneC6WatTNvJEcA== X-Received: by 2002:a05:600c:a297:b0:40e:4a29:d267 with SMTP id hu23-20020a05600ca29700b0040e4a29d267mr5002368wmb.227.1705521156948; Wed, 17 Jan 2024 11:52:36 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i17-20020a05600c355100b0040d5f466deesm23331022wmq.38.2024.01.17.11.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:36 -0800 (PST) Message-ID: <0e2b6e197ab2fbfc81a42fd601b6aaf41e38929f.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:24 +0000 Subject: [PATCH 01/12] t3210: move to t0602 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move t3210 to t0602, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together. Signed-off-by: John Cai --- t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%) diff --git a/t/t3210-pack-refs.sh b/t/t0602-reffiles-pack-refs.sh similarity index 100% rename from t/t3210-pack-refs.sh rename to t/t0602-reffiles-pack-refs.sh From patchwork Wed Jan 17 19:52:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522150 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6018A24A09 for ; Wed, 17 Jan 2024 19:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521161; cv=none; b=VbKuqRGcAgj9xNIFhUddJxeoEULYvCxKpBDGLNLbDUsOamkoPTwHwPMbw8obYRm5o8or907nyJeXn9JyLUKSzujwMqiCdJmLzfh9okr89JxgXiYe6t4fwhxVhHuEEPxEKeL7uZmgUS2RHQCcLqp83vbqTxeKGcQqw9eHkfX0CiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521161; c=relaxed/simple; bh=qqeW7FfDVUj0Y3gcEWk/8RFiUXNet/jy8hCdyPo5DHM=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=rG0JZSkSDsmjoA/q8ABuFCczgYJ3N/IalahvdFaeSp2JAyZMLDZxGZppwvbBBhZ0MndND7msasRlWrqzWaTDW/2v/LqeteAFhREmeZ9a0Kyq1xy4/RDsnV04Q0mvXwGM5WFKhPiDne7IevUflLUc8a4wSwfNko/wooMP0LovjIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z3gSjz4D; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z3gSjz4D" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-337ae00f39dso2749839f8f.2 for ; Wed, 17 Jan 2024 11:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521158; x=1706125958; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=q4M4p1N9Ou2dX7NzeOr283F7e11ubLppf5hvcSTlVWY=; b=Z3gSjz4DDbTaVp0tZPNSC3Hw9TB5JDWeckzkQ97esUpnS7/D94utOe383g5dbCDt9I fjaKd/a1442VuTNXR1qE04z+3yiVGFsqlCjNO0zVW3mPl+JqzO2PoU1rT03qoPO/rabN jToljY/95Dz2ecNPmMZrbHpii8NNviIQmAi/jiLUB7JDEv+BR52bHOiG1suKsg+dJZbR 3WMvH8KLQBs8UFD17ANG6iZOk93UXPaLx3KPQiWCx+M0sBm6KOmGhyzfFhwtFftJN2X0 2EHDxWTQmJ3SZwyWs3wx9lmjqnfCVgSohc/GY9P+90zO+ulyV0uvI7QDXui1cV/7iG9Z r8mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521158; x=1706125958; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q4M4p1N9Ou2dX7NzeOr283F7e11ubLppf5hvcSTlVWY=; b=icJuU4b/cMQuzNkuYmGo8qAWFwsatnv9pAGFlMqvBb2rEfiZtk5zoJR3hpDMMzN5bJ 75oEcglE0jA+8xldGDSpN+4ZjdAnOVy5O6jIAOZYEMoIViRRjA//7AcGegSQ1dVBczvn ycn3GKQlXZyL6ud6m/yUTwRuRNpFlRLSQlOXwledxn72lng7s43/x4CAQbZMqZt7aDBU Jaz2okgcqSKH8XOOyrSPIY3MPPiNB5p4aS0CFaqqESv7VWW4GT3KhHPcGOtpRGNbMBrw V/B9MQ7Pw3EYm6FarhmDAn/vhnSpHLmd/RS59iWhr1m6gYjoMu502maoaWUxPNVMnAZV 2KWQ== X-Gm-Message-State: AOJu0YzVntjWVycnoo7uw0PrDL/r4pg2vgYK9Osp9hsedEga2R569WpO 3sll0H4lTtoTu98aJ/uOUKAqNRr64KA= X-Google-Smtp-Source: AGHT+IFS8gL4ksSdNsKnYym+CQixkUGT4wFViT2Q13E6oQePzeFww1wPpkBSrcfCg21c8Mh9ILQGsA== X-Received: by 2002:adf:f745:0:b0:337:b636:8e3 with SMTP id z5-20020adff745000000b00337b63608e3mr1735777wrp.47.1705521158138; Wed, 17 Jan 2024 11:52:38 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id dw15-20020a0560000dcf00b00337beb77c86sm2329172wrb.67.2024.01.17.11.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:37 -0800 (PST) Message-ID: <624ad202305138c312e9db7d9cc590baf4e576ab.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:25 +0000 Subject: [PATCH 02/12] remove REFFILES prerequisite Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai These tests are compatible with the reftable backend and thus do not need the REFFILES prerequisite. Signed-off-by: John Cai --- t/t1405-main-ref-store.sh | 2 +- t/t2017-checkout-orphan.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh index e4627cf1b61..62c1eadb190 100755 --- a/t/t1405-main-ref-store.sh +++ b/t/t1405-main-ref-store.sh @@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' ' test_must_fail git reflog exists HEAD ' -test_expect_success REFFILES 'create-reflog(HEAD)' ' +test_expect_success 'create-reflog(HEAD)' ' $RUN create-reflog HEAD && git reflog exists HEAD ' diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh index 947d1587ac8..a5c7358eeab 100755 --- a/t/t2017-checkout-orphan.sh +++ b/t/t2017-checkout-orphan.sh @@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' ' git rev-parse --verify delta@{0} ' -test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' ' +test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' ' git checkout main && git config core.logAllRefUpdates false && git checkout --orphan epsilon && From patchwork Wed Jan 17 19:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522151 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23BA124A11 for ; Wed, 17 Jan 2024 19:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521162; cv=none; b=AUYKXl9orsEvLLsvEBnn8cdjfEHO9HRZyt7QQavkQ2m1hlMMD6y4TqYWw17sLmVNFK9VBwSChr42fyxbtle6vRsvB4T1fbyWcO1TcPMdkh1e79bxMdvNVzf/13kIcldJfd65vVatrLSORX/HltIUHoWtVROb7OX/zk6sHeZMHs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521162; c=relaxed/simple; bh=ZzbY28CwqaZwaMZqIUhgA9LhakYqhQq628R6/hmEOnQ=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=Sk8YjliCOSrw69zs+ufgamAjZ5a6znA4soBkUUUGyZAkUmiJL7vVLYSHBzvFNVMubFNuYRuhAgSGN5/s484E/xO1vgMf/A8WnGgy4h0r6QG6pUCDWChkLavAwzSawCq1koSY7cEdOTUJUdiFUmtXhM8ADIADbdWRrwyrcV2M4OU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XcMQgY5H; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XcMQgY5H" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3376d424a79so9219481f8f.1 for ; Wed, 17 Jan 2024 11:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521159; x=1706125959; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xLJOK4Mu4tFYInlshWjwiKh3Bm4HtBZmFXowJuGacKY=; b=XcMQgY5HflOrMbbxlPoifjbivuifKkhbz7MMLb0iRM1knU6jD4jYgpPR9X9/nT/WE2 9/WK1z1ITUkZSSkHNQxYS8Kgq4cHlB6VvhAnhL4wSna6ajxaIfhPwyIwi3WjcGrLXQcr 6bng4+TPvkDqEjvnhmJtb4i1iw1rkGYJEJd05jeqE7Z9kTjNmIcDT4LE8rg2rkwt8lAi T7AijMtvPcJydgus2IyI/LBX712jTqFi+z2IgrBetfw30ycRS5hRZU6s97EZWzPY3lCX hROWyVLl8WLWyYN2Pb4txKtjgC7XMMPrhmE2Q/SL2lZBEGwcqJkazjx3iK1LNx90AtiW HJaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521159; x=1706125959; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xLJOK4Mu4tFYInlshWjwiKh3Bm4HtBZmFXowJuGacKY=; b=Q2DM8zuLqRoMBWe7n8ZlsQOR5ocPeekBoOtU0+Ll355tolOrAMGWe6dSdDog8f6hpJ /mnKDGPkDdl7+WRuIFCmebGFGgIMwj0AF30F8/6GO9sUVUvkvYlkdc03P3PLVBRKAkW0 rT9bVne6EoWwHcTcvocCnT8EIfblvLlq40e0/SsnC+SNwH/XSJjAayWGuHHJeMT6LxCC Q4J31H5JZ1pLhSn5wfHjpVeOQG2xZXcCdkeN1yTop3S7uxmsL5i713q31kvXYWwNdl/a 9UN+gv+51hiB2nRfmFHVWK7Ukbqk8FGXrhBgQj9u5Q5/s7+l0qEQzlMLq+MYq1JgaGbi B34Q== X-Gm-Message-State: AOJu0Yzprx2vqaZlmWXEM3CbmAR23Ef/0fKs7647xFmQxTBKWX8MZZaR 1DhtucdncqDDhhyIvZqwOAbM9b4Dd9g= X-Google-Smtp-Source: AGHT+IFKynMBoAAgrYewiH9UiAan63ib93mTMX4xZsORtdnq+IUdaSj7BISMjQu/fnkjSEtAPPikMA== X-Received: by 2002:a5d:530c:0:b0:337:bcdf:2dd5 with SMTP id e12-20020a5d530c000000b00337bcdf2dd5mr1697690wrv.16.1705521158716; Wed, 17 Jan 2024 11:52:38 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q8-20020adff788000000b003367a51217csm2336334wrp.34.2024.01.17.11.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:38 -0800 (PST) Message-ID: <19233aa0d4496b66d67fbee82fb8d9b6b35a03cb.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:26 +0000 Subject: [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai This test can be re-written to use Git commands rather than writing a manual ref in the reflog. This way this test no longer needs the REFFILES prerequisite. Signed-off-by: John Cai --- t/t1414-reflog-walk.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/t/t1414-reflog-walk.sh b/t/t1414-reflog-walk.sh index ea64cecf47b..c7b3817d3bd 100755 --- a/t/t1414-reflog-walk.sh +++ b/t/t1414-reflog-walk.sh @@ -121,13 +121,14 @@ test_expect_success 'min/max age uses entry date to limit' ' # Create a situation where the reflog and ref database disagree about the latest # state of HEAD. -test_expect_success REFFILES 'walk prefers reflog to ref tip' ' +test_expect_success 'walk prefers reflog to ref tip' ' + test_commit A && + test_commit B && + git reflog delete HEAD@{0} && head=$(git rev-parse HEAD) && - one=$(git rev-parse one) && - ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && - echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD && + A=$(git rev-parse A) && - echo $one >expect && + echo $A >expect && git log -g --format=%H -1 >actual && test_cmp expect actual ' From patchwork Wed Jan 17 19:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522153 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F81A24B2B for ; Wed, 17 Jan 2024 19:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521165; cv=none; b=kxILbOMlcFxot8ERt9/ISVQiK3RoOqEmK2rcZqPGEEB/LWfDjODGKwgCHPzGjN0fiGq6XKWzQVOWuLIhSCfiQwDkSP7RI1wJi3vOhuvFS05yDDz1LA/ODUhNU5k7L+02QZpnXS+e7vo1Mr2oIQDgNuhXTVDq5/L969biyxgBIyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521165; c=relaxed/simple; bh=J5bjVRF+NHYuNX+EPpvY5M5mrtGoYUIQTinpKvrZ/vI=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=R1VEU4FmJRzafzxDidxt0K9Dr2hZmcV6/N0hf4htJFAo0M9wAjXVr8hPRujg+cbP4lJbv3r2ah90BqaWOAJYYmW0HDw7/oBXmuZvMgi2sDKoAF1V2tcYAuU9wNzQam5fgnfzT7HVom1Gf/Zttuu7gb7SyJ2xeH2LeRPrsxvy2CA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YoqchjIm; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YoqchjIm" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-337c962d6b0so19157f8f.1 for ; Wed, 17 Jan 2024 11:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521160; x=1706125960; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=VrLQMrgB7QwTiRahwQ4FZYRHCMt//Q4GbFxCACLPcvI=; b=YoqchjImnD6qaH5s0sJH0YErIPk1BeRL2RsKAVJyctDeK0tH09YuzDybyfKDRoCMBr v9GcEYSYpv5MGprWZx7VXCLUO+44QXXfFAUEuVWkEE/vpDv+ByQdLLCxQbUi9V7wwr70 8zNylc9+6sfvI4U5jTtHld6vfB+2xI8dnc2lJpdyZ0Y3e6M7hD+OU2q85EGG7r3hD1Bv VXuoT7Dtp1bCRiC0MvprCHMu3nrKtge1OWAIjr6Iar18dcVuROXLr36h4W8bpUC4Zul5 CKilFDf0e/S0kXpomRnldDBmi3iXyvRwhvlytJVA2I8TWfpaCJ7P0WBXnDqxjXVFu80f PUGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521160; x=1706125960; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VrLQMrgB7QwTiRahwQ4FZYRHCMt//Q4GbFxCACLPcvI=; b=WO5GBQSqHeA2nzVZMZb+m9L9NL70ONrNSG8O/iFsnhAuqScsaHE/4W1KMKZ63pbMxt So2xiOkjyOa8llDoXfWnMG/P2D39ONaHKNEejhWpo8afLXRVbZ4LPp3NZduc3da2TEq3 5R2GwRjhxCdIIFyz0d9VRiMteSMaaYAxNEoxnRMmae5lBu/Zth2ubfZ9Rk2y2XJfnweH nvmPtkOyFjweFZey8weoAKQAVKHcufviu9FQUkqm/3pEdlL95wz5gKC1NI56T9GJPv0d e5oMTJkvNBe26nM/jWJCqeO41kwfSCpR6xuoywT8mC0knl4cZf3iS0ZDc2VaN0V1rN5G 6O8w== X-Gm-Message-State: AOJu0Yxa/hSFxZTAaUlwFYrg69eDdBbhRbV1Q1qdv4yszirTgI7ypNKQ qJObT5kXsj3klZWZI2RkBlE2UXYVSl4= X-Google-Smtp-Source: AGHT+IFRWTBufN3YRvQQjnuYPew2e2Lfj2EA4GD7pmxRo67dXD/vF8IvZ10jCjk7J0hyJoLLJLlYcw== X-Received: by 2002:adf:f30b:0:b0:337:5555:e5ea with SMTP id i11-20020adff30b000000b003375555e5eamr4652855wro.38.1705521159837; Wed, 17 Jan 2024 11:52:39 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n7-20020adff087000000b00337bb0f370dsm2363428wro.40.2024.01.17.11.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:39 -0800 (PST) Message-ID: <0f6fea6d32d242db772fbee0b4aaec044087f53d.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:27 +0000 Subject: [PATCH 04/12] t1404: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai These tests modify loose refs manually and are specific to the reffiles backend. Move these to t0600 to be part of a test suite of reffiles specific tests. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 398 +++++++++++++++++++++++++++++++++++ t/t1404-update-ref-errors.sh | 378 --------------------------------- 2 files changed, 398 insertions(+), 378 deletions(-) create mode 100755 t/t0600-reffiles-backend.sh diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh new file mode 100755 index 00000000000..332c8cbc004 --- /dev/null +++ b/t/t0600-reffiles-backend.sh @@ -0,0 +1,398 @@ +#!/bin/sh + +test_description='Test reffiles backend' + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +# Test adding and deleting D/F-conflicting references in a single +# transaction. +df_test() { + prefix="$1" + pack=: symadd=false symdel=false add_del=false addref= delref= + shift + while test $# -gt 0 + do + case "$1" in + --pack) + pack="git pack-refs --all" + shift + ;; + --sym-add) + # Perform the add via a symbolic reference + symadd=true + shift + ;; + --sym-del) + # Perform the del via a symbolic reference + symdel=true + shift + ;; + --del-add) + # Delete first reference then add second + add_del=false + delref="$prefix/r/$2" + addref="$prefix/r/$3" + shift 3 + ;; + --add-del) + # Add first reference then delete second + add_del=true + addref="$prefix/r/$2" + delref="$prefix/r/$3" + shift 3 + ;; + *) + echo 1>&2 "Extra args to df_test: $*" + return 1 + ;; + esac + done + git update-ref "$delref" $C && + if $symadd + then + addname="$prefix/s/symadd" && + git symbolic-ref "$addname" "$addref" + else + addname="$addref" + fi && + if $symdel + then + delname="$prefix/s/symdel" && + git symbolic-ref "$delname" "$delref" + else + delname="$delref" + fi && + cat >expected-err <<-EOF && + fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ + EOF + $pack && + if $add_del + then + printf "%s\n" "create $addname $D" "delete $delname" + else + printf "%s\n" "delete $delname" "create $addname $D" + fi >commands && + test_must_fail git update-ref --stdin output.err && + test_cmp expected-err output.err && + printf "%s\n" "$C $delref" >expected-refs && + git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && + test_cmp expected-refs actual-refs +} + +test_expect_success 'setup' ' + git commit --allow-empty -m Initial && + C=$(git rev-parse HEAD) && + git commit --allow-empty -m Second && + D=$(git rev-parse HEAD) && + git commit --allow-empty -m Third && + E=$(git rev-parse HEAD) +' + +test_expect_success 'empty directory should not fool rev-parse' ' + prefix=refs/e-rev-parse && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + echo "$C" >expected && + git rev-parse $prefix/foo >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool for-each-ref' ' + prefix=refs/e-for-each-ref && + git update-ref $prefix/foo $C && + git for-each-ref $prefix >expected && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + git for-each-ref $prefix >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool create' ' + prefix=refs/e-create && + mkdir -p .git/$prefix/foo/bar/baz && + printf "create %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool verify' ' + prefix=refs/e-verify && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "verify %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg update' ' + prefix=refs/e-update-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 2-arg update' ' + prefix=refs/e-update-2 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 0-arg delete' ' + prefix=refs/e-delete-0 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg delete' ' + prefix=refs/e-delete-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'D/F conflict prevents add long + delete short' ' + df_test refs/df-al-ds --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add short + delete long' ' + df_test refs/df-as-dl --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents delete long + add short' ' + df_test refs/df-dl-as --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents delete short + add long' ' + df_test refs/df-ds-al --del-add foo foo/bar +' + +test_expect_success 'D/F conflict prevents add long + delete short packed' ' + df_test refs/df-al-dsp --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add short + delete long packed' ' + df_test refs/df-as-dlp --pack --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents delete long packed + add short' ' + df_test refs/df-dlp-as --pack --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents delete short packed + add long' ' + df_test refs/df-dsp-al --pack --del-add foo foo/bar +' + +# Try some combinations involving symbolic refs... + +test_expect_success 'D/F conflict prevents indirect add long + delete short' ' + df_test refs/df-ial-ds --sym-add --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' ' + df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' ' + df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' ' + df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + delete short packed' ' + df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' ' + df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add long + indirect delete short packed' ' + df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' ' + df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo +' + +test_expect_success 'non-empty directory blocks create' ' + prefix=refs/ne-create && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks create' ' + prefix=refs/broken-create && + mkdir -p .git/$prefix && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'non-empty directory blocks indirect create' ' + prefix=refs/ne-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks indirect create' ' + prefix=refs/broken-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'no bogus intermediate values during delete' ' + prefix=refs/slow-transaction && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + # Now try to update the reference, but hold the `packed-refs` lock + # for a while to see what happens while the process is blocked: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + { + # Note: the following command is intentionally run in the + # background. We increase the timeout so that `update-ref` + # attempts to acquire the `packed-refs` lock for much longer + # than it takes for us to do the check then delete it: + git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo & + } && + pid2=$! && + # Give update-ref plenty of time to get to the point where it tries + # to lock packed-refs: + sleep 1 && + # Make sure that update-ref did not complete despite the lock: + kill -0 $pid2 && + # Verify that the reference still has its old value: + sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) && + case "$sha1" in + $D) + # This is what we hope for; it means that nothing + # user-visible has changed yet. + : ;; + undefined) + # This is not correct; it means the deletion has happened + # already even though update-ref should not have been + # able to acquire the lock yet. + echo "$prefix/foo deleted prematurely" && + break + ;; + $C) + # This value should never be seen. Probably the loose + # reference has been deleted but the packed reference + # is still there: + echo "$prefix/foo incorrectly observed to be C" && + break + ;; + *) + # WTF? + echo "unexpected value observed for $prefix/foo: $sha1" && + break + ;; + esac >out && + rm -f .git/packed-refs.lock && + wait $pid2 && + test_must_be_empty out && + test_must_fail git rev-parse --verify --quiet $prefix/foo +' + +test_expect_success 'delete fails cleanly if packed-refs file is locked' ' + prefix=refs/locked-packed-refs && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # Now try to delete it while the `packed-refs` lock is held: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + test_must_fail git update-ref -d $prefix/foo >out 2>err && + git for-each-ref $prefix >actual && + test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err && + test_cmp unchanged actual +' + +test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' + # Setup and expectations are similar to the test above. + prefix=refs/failed-packed-refs && + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # This should not happen in practice, but it is an easy way to get a + # reliable error (we open with create_tempfile(), which uses O_EXCL). + : >.git/packed-refs.new && + test_when_finished "rm -f .git/packed-refs.new" && + test_must_fail git update-ref -d $prefix/foo && + git for-each-ref $prefix >actual && + test_cmp unchanged actual +' + +test_done diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh index 0369beea33b..6edf3dca9d5 100755 --- a/t/t1404-update-ref-errors.sh +++ b/t/t1404-update-ref-errors.sh @@ -34,81 +34,6 @@ test_update_rejected () { test_cmp unchanged actual } -# Test adding and deleting D/F-conflicting references in a single -# transaction. -df_test() { - prefix="$1" - pack=: symadd=false symdel=false add_del=false addref= delref= - shift - while test $# -gt 0 - do - case "$1" in - --pack) - pack="git pack-refs --all" - shift - ;; - --sym-add) - # Perform the add via a symbolic reference - symadd=true - shift - ;; - --sym-del) - # Perform the del via a symbolic reference - symdel=true - shift - ;; - --del-add) - # Delete first reference then add second - add_del=false - delref="$prefix/r/$2" - addref="$prefix/r/$3" - shift 3 - ;; - --add-del) - # Add first reference then delete second - add_del=true - addref="$prefix/r/$2" - delref="$prefix/r/$3" - shift 3 - ;; - *) - echo 1>&2 "Extra args to df_test: $*" - return 1 - ;; - esac - done - git update-ref "$delref" $C && - if $symadd - then - addname="$prefix/s/symadd" && - git symbolic-ref "$addname" "$addref" - else - addname="$addref" - fi && - if $symdel - then - delname="$prefix/s/symdel" && - git symbolic-ref "$delname" "$delref" - else - delname="$delref" - fi && - cat >expected-err <<-EOF && - fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ - EOF - $pack && - if $add_del - then - printf "%s\n" "create $addname $D" "delete $delname" - else - printf "%s\n" "delete $delname" "create $addname $D" - fi >commands && - test_must_fail git update-ref --stdin output.err && - test_cmp expected-err output.err && - printf "%s\n" "$C $delref" >expected-refs && - git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && - test_cmp expected-refs actual-refs -} - test_expect_success 'setup' ' git commit --allow-empty -m Initial && @@ -191,144 +116,6 @@ test_expect_success 'one new ref is a simple prefix of another' ' ' -test_expect_success REFFILES 'empty directory should not fool rev-parse' ' - prefix=refs/e-rev-parse && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - echo "$C" >expected && - git rev-parse $prefix/foo >actual && - test_cmp expected actual -' - -test_expect_success REFFILES 'empty directory should not fool for-each-ref' ' - prefix=refs/e-for-each-ref && - git update-ref $prefix/foo $C && - git for-each-ref $prefix >expected && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - git for-each-ref $prefix >actual && - test_cmp expected actual -' - -test_expect_success REFFILES 'empty directory should not fool create' ' - prefix=refs/e-create && - mkdir -p .git/$prefix/foo/bar/baz && - printf "create %s $C\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'empty directory should not fool verify' ' - prefix=refs/e-verify && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - printf "verify %s $C\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'empty directory should not fool 1-arg update' ' - prefix=refs/e-update-1 && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - printf "update %s $D\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'empty directory should not fool 2-arg update' ' - prefix=refs/e-update-2 && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - printf "update %s $D $C\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'empty directory should not fool 0-arg delete' ' - prefix=refs/e-delete-0 && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - printf "delete %s\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'empty directory should not fool 1-arg delete' ' - prefix=refs/e-delete-1 && - git update-ref $prefix/foo $C && - git pack-refs --all && - mkdir -p .git/$prefix/foo/bar/baz && - printf "delete %s $C\n" $prefix/foo | - git update-ref --stdin -' - -test_expect_success REFFILES 'D/F conflict prevents add long + delete short' ' - df_test refs/df-al-ds --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents add short + delete long' ' - df_test refs/df-as-dl --add-del foo foo/bar -' - -test_expect_success REFFILES 'D/F conflict prevents delete long + add short' ' - df_test refs/df-dl-as --del-add foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents delete short + add long' ' - df_test refs/df-ds-al --del-add foo foo/bar -' - -test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' ' - df_test refs/df-al-dsp --pack --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' ' - df_test refs/df-as-dlp --pack --add-del foo foo/bar -' - -test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' ' - df_test refs/df-dlp-as --pack --del-add foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' ' - df_test refs/df-dsp-al --pack --del-add foo foo/bar -' - -# Try some combinations involving symbolic refs... - -test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' ' - df_test refs/df-ial-ds --sym-add --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' ' - df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' ' - df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar -' - -test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' ' - df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' ' - df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' ' - df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' ' - df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo -' - -test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' ' - df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo -' - # Test various errors when reading the old values of references... test_expect_success 'missing old value blocks update' ' @@ -468,169 +255,4 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' ' test_cmp expected output.err ' -test_expect_success REFFILES 'non-empty directory blocks create' ' - prefix=refs/ne-create && - mkdir -p .git/$prefix/foo/bar && - : >.git/$prefix/foo/bar/baz.lock && - test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ - EOF - printf "%s\n" "update $prefix/foo $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ - EOF - printf "%s\n" "update $prefix/foo $D $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err -' - -test_expect_success REFFILES 'broken reference blocks create' ' - prefix=refs/broken-create && - mkdir -p .git/$prefix && - echo "gobbledigook" >.git/$prefix/foo && - test_when_finished "rm -f .git/$prefix/foo" && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken - EOF - printf "%s\n" "update $prefix/foo $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken - EOF - printf "%s\n" "update $prefix/foo $D $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err -' - -test_expect_success REFFILES 'non-empty directory blocks indirect create' ' - prefix=refs/ne-indirect-create && - git symbolic-ref $prefix/symref $prefix/foo && - mkdir -p .git/$prefix/foo/bar && - : >.git/$prefix/foo/bar/baz.lock && - test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ - EOF - printf "%s\n" "update $prefix/symref $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ - EOF - printf "%s\n" "update $prefix/symref $D $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err -' - -test_expect_success REFFILES 'broken reference blocks indirect create' ' - prefix=refs/broken-indirect-create && - git symbolic-ref $prefix/symref $prefix/foo && - echo "gobbledigook" >.git/$prefix/foo && - test_when_finished "rm -f .git/$prefix/foo" && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken - EOF - printf "%s\n" "update $prefix/symref $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err && - cat >expected <<-EOF && - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken - EOF - printf "%s\n" "update $prefix/symref $D $C" | - test_must_fail git update-ref --stdin 2>output.err && - test_cmp expected output.err -' - -test_expect_success REFFILES 'no bogus intermediate values during delete' ' - prefix=refs/slow-transaction && - # Set up a reference with differing loose and packed versions: - git update-ref $prefix/foo $C && - git pack-refs --all && - git update-ref $prefix/foo $D && - # Now try to update the reference, but hold the `packed-refs` lock - # for a while to see what happens while the process is blocked: - : >.git/packed-refs.lock && - test_when_finished "rm -f .git/packed-refs.lock" && - { - # Note: the following command is intentionally run in the - # background. We increase the timeout so that `update-ref` - # attempts to acquire the `packed-refs` lock for much longer - # than it takes for us to do the check then delete it: - git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo & - } && - pid2=$! && - # Give update-ref plenty of time to get to the point where it tries - # to lock packed-refs: - sleep 1 && - # Make sure that update-ref did not complete despite the lock: - kill -0 $pid2 && - # Verify that the reference still has its old value: - sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) && - case "$sha1" in - $D) - # This is what we hope for; it means that nothing - # user-visible has changed yet. - : ;; - undefined) - # This is not correct; it means the deletion has happened - # already even though update-ref should not have been - # able to acquire the lock yet. - echo "$prefix/foo deleted prematurely" && - break - ;; - $C) - # This value should never be seen. Probably the loose - # reference has been deleted but the packed reference - # is still there: - echo "$prefix/foo incorrectly observed to be C" && - break - ;; - *) - # WTF? - echo "unexpected value observed for $prefix/foo: $sha1" && - break - ;; - esac >out && - rm -f .git/packed-refs.lock && - wait $pid2 && - test_must_be_empty out && - test_must_fail git rev-parse --verify --quiet $prefix/foo -' - -test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked' ' - prefix=refs/locked-packed-refs && - # Set up a reference with differing loose and packed versions: - git update-ref $prefix/foo $C && - git pack-refs --all && - git update-ref $prefix/foo $D && - git for-each-ref $prefix >unchanged && - # Now try to delete it while the `packed-refs` lock is held: - : >.git/packed-refs.lock && - test_when_finished "rm -f .git/packed-refs.lock" && - test_must_fail git update-ref -d $prefix/foo >out 2>err && - git for-each-ref $prefix >actual && - test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err && - test_cmp unchanged actual -' - -test_expect_success REFFILES 'delete fails cleanly if packed-refs.new write fails' ' - # Setup and expectations are similar to the test above. - prefix=refs/failed-packed-refs && - git update-ref $prefix/foo $C && - git pack-refs --all && - git update-ref $prefix/foo $D && - git for-each-ref $prefix >unchanged && - # This should not happen in practice, but it is an easy way to get a - # reliable error (we open with create_tempfile(), which uses O_EXCL). - : >.git/packed-refs.new && - test_when_finished "rm -f .git/packed-refs.new" && - test_must_fail git update-ref -d $prefix/foo && - git for-each-ref $prefix >actual && - test_cmp unchanged actual -' - test_done From patchwork Wed Jan 17 19:52:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522152 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 880D024B2F for ; Wed, 17 Jan 2024 19:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521164; cv=none; b=Np8ynrkPwhGXrDais/xObj4t/ItR/IC4J1F5D/kySMwNIfldF2g1ID/U8rABs2qaFTEQc8mnZ9h8wcPR7SPVjVUTtStoRwgXQa3zXo5jlrRqqrkwq6WBuMHBbCXGDXmkqNmDI0G/H75jQ2lpNLFqNEWKxcVnO8vjpENbKqYWZGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521164; c=relaxed/simple; bh=tJRDbKp8I1ffYLNxQFy6BO/pFx+b2M7vKetBPub960U=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=pX2eNrOuH+5hm+JpcKR4DKdU13zdgeU27cHmf6bnSn/qEwbS1Jk9D97Os5pr8D8SBlEYTakqp0UUP5lcIEIgumIvRxh7/DhVpLwzdOpHq173cw1/mdmmimuwmPppkcbTDkAK6o1HGds8CEfVFUqV5zu8BmzAxabGhuZiPnreyQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cwhiE+7S; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cwhiE+7S" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso65497785e9.0 for ; Wed, 17 Jan 2024 11:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521160; x=1706125960; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=vZ/83xS30W1Jg7QtE801kZwkX4lkJ4PyWhx7zuIeaWs=; b=cwhiE+7SZKDDhbcorYo+9lPNV2KqIsVomFcUtUq/BCPln5aiD1cM2qOQf0/1MgS5vd 8hINa0oyzvBGYXj/soiXIDV/qQFnOPSvg8VF8ImNWYN588gaP4TXel28UCIci8AocpaW pfdQUkcmi7zoBtbQ9gQCU80h1wsey94oLIoYninE31EsevM/E6sZul9fj+aYcYUPmcsw kxOTnC3QHa73EoUwVhqJhNHHfWa5FfPMmfvfEGkpkT2cV3epn4QeN2ybH5HEQNykq0tu 8fB6Q3TUnK+JWBtG0gM4Y7HHR+lqVsNnAheaL+/2WQ6RSiCnMww/eydG0nAex7961zkw /F4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521160; x=1706125960; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vZ/83xS30W1Jg7QtE801kZwkX4lkJ4PyWhx7zuIeaWs=; b=wqAhhWsgJ79XWKelM0idbom6NWMqvh2p5QzAwqjwdS823FRxk+M91X6Tj44iDRRGYN ZYQ/c0S86bNx2v1CpSpfHDfn56GFv3aEBeb8zvBqRMmFhw6WoOV6p4rte50njmSXKyoR i5a5RDncp9g6EJ4XwKtuGrefKmVuAfeSVHgHCfQzMcNFpM1x974fkhy4WO7bsUMvaK4a BhzCnbMDH7yMBRVS+Q9xKzzS60A8HRVCRTDDdVRFg9H7tFTxCduDcbL8aVZPQ6/3+Le4 p4+vGQMWnXRRIRSlyIQl1Thf42Q4Qwvy4YOi65uB1+tsey7SodtmdU+qI0YacFTxb4F8 7LaA== X-Gm-Message-State: AOJu0YyZdoYXuMGCrQ6949sbNiorN1Bt6ipDVFtOjldFJ4xOG2FsU2lj DyzP1fZ0r4wPdXqsbEppnqz3oNZEIo4= X-Google-Smtp-Source: AGHT+IFksD/Qi7K0W7gExvK1TPuOlHluseHm5oijSbp58PfksjIxQOem5hTLoAcUE1bp/XLv1k6nWA== X-Received: by 2002:a05:600c:2112:b0:40e:7f2c:9dbd with SMTP id u18-20020a05600c211200b0040e7f2c9dbdmr2713994wml.13.1705521160380; Wed, 17 Jan 2024 11:52:40 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q20-20020a05600c46d400b0040e395cd20bsm27309141wmo.7.2024.01.17.11.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:40 -0800 (PST) Message-ID: In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:28 +0000 Subject: [PATCH 05/12] t1405: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move this test to t0600 with other reffiles specific tests since it is reffiles specific in that it looks into the loose refs directory for an assertion. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 8 ++++++++ t/t1405-main-ref-store.sh | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 332c8cbc004..53ac4b9b5b8 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -92,6 +92,14 @@ test_expect_success 'setup' ' E=$(git rev-parse HEAD) ' +test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' + N=`find .git/refs -type f | wc -l` && + test "$N" != 0 && + test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && + N=`find .git/refs -type f` && + test -z "$N" +' + test_expect_success 'empty directory should not fool rev-parse' ' prefix=refs/e-rev-parse && git update-ref $prefix/foo $C && diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh index 62c1eadb190..976bd71efb5 100755 --- a/t/t1405-main-ref-store.sh +++ b/t/t1405-main-ref-store.sh @@ -15,14 +15,6 @@ test_expect_success 'setup' ' test_commit one ' -test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' - N=`find .git/refs -type f | wc -l` && - test "$N" != 0 && - $RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && - N=`find .git/refs -type f` && - test -z "$N" -' - test_expect_success 'create_symref(FOO, refs/heads/main)' ' $RUN create-symref FOO refs/heads/main nothing && echo refs/heads/main >expected && From patchwork Wed Jan 17 19:52:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522154 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80B6124B40 for ; Wed, 17 Jan 2024 19:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521165; cv=none; b=HBtigaqbWP1OB229wQ7F2KgKYzqLFGwByssR17JYbwffi/3diNr7NqekzOZBeRL5CVmJ2rGHEX9FEasho2DDtLDmO6PaudmRl8G/ujRph7dq1M9CslQaMaG4Wq80pJ7a6EM7UIJOiiuHO6cdvZJN5CPNk+BnqwIPCLAfdR2cDpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521165; c=relaxed/simple; bh=1HSOHyQ/l11TKAcuGtDViYeP8tpKwaFCXb6al3axu+g=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=A4SIk/3B38BkXm9D9VKqPyGykPeEFL2QPWQVkwEZOyyuyVNfRaafe4tryVREknsQ6xcaxRET4yYQEYapr/d4Xl1Y5pPfx73XLYR+5FZdlCYjIKK+DmvBxNz7DPLF/+BcBLEnBQd6KdMk9llSAa37pFoGNgY0QBDRRaaSwVhZuDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kK2JLgHH; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kK2JLgHH" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e76109cdeso38189705e9.0 for ; Wed, 17 Jan 2024 11:52:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521161; x=1706125961; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=1GdHP0Sc3gqgTyfjFlunSX5dRJ9gdpUAN4uPYSDyH34=; b=kK2JLgHHgJIJbbJnf2g2iUKh1m1JnDghRUM6dzZNIKat8GIfwl0f3Rd6jGdxX1iGAf JP9Y2w0q5AZ+DxVbbJ8InSnYP/MTRJ2i5L7OyPesMljb2vyrxR0sAX1EqJ4vp9j5Pzgm LNlamNu0D29NVc325/FfOcrBZxSFogAdK0aYRrGab5OR8+tuEVRpX/xgjpJ/OQWbYape wRkLaFkSBWFtY8W08d6EqrS2/0E6YpPaS4FZRL+3YXW0+d5Yjr+Ai930uxYXEkP8FNf+ 6TbLxCO69gaolQfqlkcFKel4gYlv+CRtBww7BrrPkS0/SOefGju7mHScaqs5ssVao12m y5Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521161; x=1706125961; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1GdHP0Sc3gqgTyfjFlunSX5dRJ9gdpUAN4uPYSDyH34=; b=f3ykft4bZR15asiV8sh4tHaw/6e+CswIdYy17KW3KlaMcTT9cgJoGwJfakypcvlMEh s7v9/KtLv6qd5D1bhoUHznntdu9iyjiSj69RQkaOi/W1kPqX00myot8Tkfy1EhpbQZ1D nW2nUzAJNt5DkdVlk/jiV38CqvTUwkhxRFDSWWmrfyp2eg0fPCCh+6nyrhp9Elky8++l /dJtobdcoERT7o0vSJvEgRAqj6RchNMrZTC0brQuz50l1jOStsN8ouQ+GUlvCf3qM0wx XCex/ddHXYNtmgVQlGw+ri0F2r8euPUidLMgWP4rHPdif9o196+gLiBV3flqjucbu6Tj xkqA== X-Gm-Message-State: AOJu0YwMaCtWKNHHoNXk7dKNGm2jgNIvdP7L3BLDyMUeEtV3P2/uA3ng BoTjiDjFrdq+ClBhCsyvhYn7EtXaZ/U= X-Google-Smtp-Source: AGHT+IH0zGL5SZVT93cgJINeI2stMFpgXampy4aS8cJdBD5eYpDxbL/3Dd3rgdkjKGxtKVG75B+itQ== X-Received: by 2002:a05:600c:4d8f:b0:40e:6d7a:f9dd with SMTP id v15-20020a05600c4d8f00b0040e6d7af9ddmr3912657wmp.47.1705521161258; Wed, 17 Jan 2024 11:52:41 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n16-20020a05600c4f9000b0040d62f97e3csm27366072wmq.10.2024.01.17.11.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:40 -0800 (PST) Message-ID: <69ea950cfeacbd2830f216505cdf0de24b108b19.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:29 +0000 Subject: [PATCH 06/12] t1406: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move this test to t0600 with the rest of the tests that are specific to reffiles. This test reaches into reflog directories manually, and so are specific to reffiles. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 48 +++++++++++++++++++++++++++++++++++ t/t1407-worktree-ref-store.sh | 37 --------------------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 53ac4b9b5b8..09fbe312092 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -403,4 +403,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' test_cmp unchanged actual ' +RWT="test-tool ref-store worktree:wt" +RMAIN="test-tool ref-store worktree:main" + +test_expect_success 'setup worktree' ' + test_commit first && + git worktree add -b wt-main wt && + ( + cd wt && + test_commit second + ) +' + +# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should +# only appear in the for-each-reflog output if it is called from the correct +# worktree, which is exercised in this test. This test is poorly written for +# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses +# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random +# do not create reflogs by default, so it is not testing a realistic scenario. +test_expect_success 'for_each_reflog()' ' + echo $ZERO_OID > .git/logs/PSEUDO-MAIN && + mkdir -p .git/logs/refs/bisect && + echo $ZERO_OID > .git/logs/refs/bisect/random && + + echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && + mkdir -p .git/worktrees/wt/logs/refs/bisect && + echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && + + $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-WT 0x0 + refs/bisect/wt-random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual && + + $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-MAIN 0x0 + refs/bisect/random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual +' + test_done diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh index 05b1881c591..48b1c92a414 100755 --- a/t/t1407-worktree-ref-store.sh +++ b/t/t1407-worktree-ref-store.sh @@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' ' test_cmp expected actual ' -# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should -# only appear in the for-each-reflog output if it is called from the correct -# worktree, which is exercised in this test. This test is poorly written (and -# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly -# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3) -# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is -# not testing a realistic scenario. -test_expect_success REFFILES 'for_each_reflog()' ' - echo $ZERO_OID > .git/logs/PSEUDO-MAIN && - mkdir -p .git/logs/refs/bisect && - echo $ZERO_OID > .git/logs/refs/bisect/random && - - echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && - mkdir -p .git/worktrees/wt/logs/refs/bisect && - echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && - - $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-WT 0x0 - refs/bisect/wt-random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual && - - $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-MAIN 0x0 - refs/bisect/random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual -' - test_done From patchwork Wed Jan 17 19:52:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522155 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1D7E24B4C for ; Wed, 17 Jan 2024 19:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521166; cv=none; b=DS/07lZWajPMC66WamxhNJhO9bC1cl9255taOR0SZ1qVSTCJBeHInZbRAiymstf8k8K55hkwd7L8fU0yTxdopZi0w2ejq+t6jK3qaKTg8gr9VimaeOCKPEjsHc4UFs34c/FrB7o1R75BAZuxuuiA5yWKUPQd+xTogF3M9QfpNkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521166; c=relaxed/simple; bh=pzzLF160L2R7OIVX0GoG+9fWRDYbcYfdmdjn/1g/Qz0=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=NJeTVURunKRwvPqM7U1BE3m9hQtsm6Q0i4buwLvnkbEBBv89hrMS5UzRzIy6rIzAV0JcKu/oDgmJuMhxBYTKYjuJiaUmazB1mToQyYRHmikyK+nIUdRRwR9kNH5wx1HI57QG5XRHuBt9KdeR0OOuCU/QlPqckdOmdJlBXNuLhQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fDWziGFP; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fDWziGFP" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-337c40fde20so844542f8f.0 for ; Wed, 17 Jan 2024 11:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521162; x=1706125962; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=OmMUzd0U48IbGgsQJ+mxAzAkYCyXDeFTYCcsjSpdWxo=; b=fDWziGFPXBu0nCH2xStpK24tKFXZlXmGvyfkNDgiW70oPEM3Y93faSryG08hxveNGQ NUzgq/5OvxsD4Uy8XZ1SHrQU8ADASh4BBsnT2ofm75JdafcgXjlelRR/xH8JzYbGcquT uydw/+gt13nzL7uPONbz6jttxanXZzyGmBuojaGowCMXAAvZOfDGKXBHJuIVWRvEYbCQ A4lWNSdeHeBhSCf00xhoLOmXTz4fbfI8PSb8jURsxJOEbeXwFqu6CaG/Tub/sAOXpfkD dM+chtj3uLy8zGVLtgISDEkRe1zqVG6EslNeJig77CAjn+MT2v4mn7gacPMddcG6Y5ye XqQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521162; x=1706125962; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OmMUzd0U48IbGgsQJ+mxAzAkYCyXDeFTYCcsjSpdWxo=; b=Nk8UquL6mr7loMVdHMQ/C/p1OsN1kuQduhWw1jKHFRggo9QIgmR8k/sATgItjVG9lU e3rYvF5uU1A2r2lca8cNIa/iCEoGTWlXVXWw0xdbVScxEtoq57TN7ZTklpKqUZAIum7V H8mp2fNY6SVYG3/+pVMmf3NAr4sCMmzDFullGZvxHLahQ4IEi9zFoyK3XwWNpHr0CaPG Zf89yioVbMdxuVeANK8d8PrvxrH+3ZDy54B+VInDSOT6U3QczAtSKgdg3kLVizrFvPpG pIW8etvBGNgOI8O13nnKosQuNDWWBppcjL/A+EZQAuMPeuZ9WSE/fa5JV9PWXA/aLSqV vM0w== X-Gm-Message-State: AOJu0YwuWnfa8BpggW6f+Jed7Fe0+CtIB5PDccO5ap/NO90x2RaaS1wn +/aSF1l+/j+e2spHEpxGjx9rqFV3AF4= X-Google-Smtp-Source: AGHT+IFKKnzKA2IqV2ezJJuB7EkMJW0fiMW5RRtg2USyBT2k6GY+D3P7mhwnI7kKgMSffEnwX1IZmQ== X-Received: by 2002:a5d:6d4c:0:b0:337:5bdf:57a with SMTP id k12-20020a5d6d4c000000b003375bdf057amr5356517wri.118.1705521162294; Wed, 17 Jan 2024 11:52:42 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p1-20020adfe601000000b00337bf461385sm2347376wrm.26.2024.01.17.11.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:41 -0800 (PST) Message-ID: In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:30 +0000 Subject: [PATCH 07/12] t1410: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move these tests to t0600 with other reffiles specific tests since they do things like take a lock on an individual ref, and write directly into the reflog refs Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 51 +++++++++++++++++++++++++++++++++++++ t/t1410-reflog.sh | 42 ------------------------------ 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 09fbe312092..0b28a2cc5ea 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -451,4 +451,55 @@ test_expect_success 'for_each_reflog()' ' test_cmp expected actual ' +# Triggering the bug detected by this test requires a newline to fall +# exactly BUFSIZ-1 bytes from the end of the file. We don't know +# what that value is, since it's platform dependent. However, if +# we choose some value N, we also catch any D which divides N evenly +# (since we will read backwards in chunks of D). So we choose 8K, +# which catches glibc (with an 8K BUFSIZ) and *BSD (1K). +# +# Each line is 114 characters, so we need 75 to still have a few before the +# last 8K. The 89-character padding on the final entry lines up our +# newline exactly. +test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' + git checkout -b reflogskip && + zf=$(test_oid zero_2) && + ident="abc 0000000001 +0000" && + for i in $(test_seq 1 75); do + printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && + if test $i = 75; then + for j in $(test_seq 1 89); do + printf X || return 1 + done + else + printf X + fi && + printf "\n" || return 1 + done >.git/logs/refs/heads/reflogskip && + git rev-parse reflogskip@{73} >actual && + echo ${zf}03 >expect && + test_cmp expect actual +' + +# This test takes a lock on an individual ref; this is not supported in +# reftable. +test_expect_success 'reflog expire operates on symref not referrent' ' + git branch --create-reflog the_symref && + git branch --create-reflog referrent && + git update-ref referrent HEAD && + git symbolic-ref refs/heads/the_symref refs/heads/referrent && + test_when_finished "rm -f .git/refs/heads/referrent.lock" && + touch .git/refs/heads/referrent.lock && + git reflog expire --expire=all the_symref +' + +test_expect_success 'empty reflog' ' + test_when_finished "rm -rf empty" && + git init empty && + test_commit -C empty A && + >empty/.git/logs/refs/heads/foo && + git -C empty reflog expire --all 2>err && + test_must_be_empty err +' + test_done diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index a0ff8d51f04..d2f5f42e674 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -354,36 +354,6 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' ' test_must_be_empty actual ' -# Triggering the bug detected by this test requires a newline to fall -# exactly BUFSIZ-1 bytes from the end of the file. We don't know -# what that value is, since it's platform dependent. However, if -# we choose some value N, we also catch any D which divides N evenly -# (since we will read backwards in chunks of D). So we choose 8K, -# which catches glibc (with an 8K BUFSIZ) and *BSD (1K). -# -# Each line is 114 characters, so we need 75 to still have a few before the -# last 8K. The 89-character padding on the final entry lines up our -# newline exactly. -test_expect_success REFFILES,SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' - git checkout -b reflogskip && - zf=$(test_oid zero_2) && - ident="abc 0000000001 +0000" && - for i in $(test_seq 1 75); do - printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && - if test $i = 75; then - for j in $(test_seq 1 89); do - printf X || return 1 - done - else - printf X - fi && - printf "\n" || return 1 - done >.git/logs/refs/heads/reflogskip && - git rev-parse reflogskip@{73} >actual && - echo ${zf}03 >expect && - test_cmp expect actual -' - test_expect_success 'no segfaults for reflog containing non-commit sha1s' ' git update-ref --create-reflog -m "Creating ref" \ refs/tests/tree-in-reflog HEAD && @@ -397,18 +367,6 @@ test_expect_failure 'reflog with non-commit entries displays all entries' ' test_line_count = 3 actual ' -# This test takes a lock on an individual ref; this is not supported in -# reftable. -test_expect_success REFFILES 'reflog expire operates on symref not referrent' ' - git branch --create-reflog the_symref && - git branch --create-reflog referrent && - git update-ref referrent HEAD && - git symbolic-ref refs/heads/the_symref refs/heads/referrent && - test_when_finished "rm -f .git/refs/heads/referrent.lock" && - touch .git/refs/heads/referrent.lock && - git reflog expire --expire=all the_symref -' - test_expect_success 'continue walking past root commits' ' git init orphanage && ( From patchwork Wed Jan 17 19:52:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522156 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39D6224B55 for ; Wed, 17 Jan 2024 19:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521166; cv=none; b=QBGhZfk9gQiG9RzXh/AkJrKgK6e1RstNnX3XDISb6fNJsMEOqFXsSL2x0jZKptK42zEt2IFwgSuprxLO9DbYFL0NVBFHXQB/D3y5tORydjctLTc+wXEieFZWgSANR7yii7ihVzhx/5We4vPrRm4GD79s/6TsyLBY2PU+6mJ+mxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521166; c=relaxed/simple; bh=erGpIszHwp0vYEDydQr/N3eGDGwcoKRwW1aFitRqpnY=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=L0LLirV2Vg6VPA2rA4Y/Bysk6K+c7pPDVGCpBJCO33mgmT2wjlau32jU5X5DU+T7Cd1o6pxuMbdUT28WbQXd16ca9JlFxt0RSlCsERlniBlxPDBDZJqTU0Y7h0VvJDOlSUSGPbXXiqCQ5dbucJ3v0gn8EKjjDjKzuodA8QylGGA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T9sJuIDI; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T9sJuIDI" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e76626170so37964625e9.2 for ; Wed, 17 Jan 2024 11:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521163; x=1706125963; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=RBsFD9LirYNHxYh0GogWEmWJgi6tlI+7WuMM5cqm1Fg=; b=T9sJuIDIdASwxRoALGY02IB2qr3u2wP+LFPoWancAeKvMhxV7cSqQsM9RNN9dTmAaQ G3mpEeYVWnztia33A9VobiuQo24hoVVVL3RqYSkflfnVsEO7d7PsM5KdQIdHQqkQYNRG n/y33pJAkRL0PCqmGqef24iVAjmTx7/RfdWxmtKLGpnZy7TQwZlkdbAuJ4vDurPHnGmZ 9yOFYUAj+HlYcB2vOauKGiW+xRuxUj43sOC8Bbe4pQL3UCug0OJTrJDly+1xEyGyiW+H hDWOU/X9+zXuhO4I7LAyfbwSn2xt8j/g6krgPYnQLN/Ld1AiPaqbP2FI09p3TBJvkQ0a 6gOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521163; x=1706125963; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RBsFD9LirYNHxYh0GogWEmWJgi6tlI+7WuMM5cqm1Fg=; b=osHrewuWP7hsl4tfok/J+PcmjF2WXg9arZ2jKxFP3LCmcue94GzmHeQWDADCXDk0gz h9bEIrGc7bmlM8khCvupCKQOh0rzgnu7dbqMZbfTwkfc/GemN/MGAhaLBPr8728nYn4Z SzhdzHP6NVHd7Oi1dwgiF6YYQX2i8a9ujYRtei2Nsp8zV8Y+gWoLy8p3JHo7hLhG2M33 dIGdSLr7wrxkMWdHR/PMZCC5pWtKH3H7ql9ackd9L7Tw8X+lgPI3rwVV3F9n7xKVn+6g iElgtfPGqYZnK2cPCEp7IV6/5qI1LowdrbweejWgHO93/IXZFiJ3e2NQm0y/Y9rpN7jp SZ8A== X-Gm-Message-State: AOJu0YwIfREJazq492MaO3UhIbbkrQLWHiFJRgz8/IDEHhQTCpxWw7Rv 3hL1zAtIspR234uJe/kbiMjGOUewNa8= X-Google-Smtp-Source: AGHT+IFw1gtvPXg2zFTTlGxBxCiVi2jnx8R7JY/N1NuJHI4PiVKzgZOKrnw/FskcgOnXVYndQ0witg== X-Received: by 2002:a05:600c:3585:b0:40e:499c:f332 with SMTP id p5-20020a05600c358500b0040e499cf332mr5361180wmq.108.1705521163400; Wed, 17 Jan 2024 11:52:43 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l13-20020a05600c4f0d00b0040e85f86515sm5630458wmq.29.2024.01.17.11.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:42 -0800 (PST) Message-ID: <9d10526369525a0ceee2d75742399130ccf885ce.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:31 +0000 Subject: [PATCH 08/12] t1415: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move this test into t0600 with other reffiles specific tests since it checks for individua loose refs and thus is specific to the reffiles backend. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 20 ++++++++++++++++++++ t/t1415-worktree-refs.sh | 11 ----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 0b28a2cc5ea..8526e5cf987 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -502,4 +502,24 @@ test_expect_success 'empty reflog' ' test_must_be_empty err ' +# The 'packed-refs' file is stored directly in .git/. This means it is global +# to the repository, and can only contain refs that are shared across all +# worktrees. +test_expect_success 'refs/worktree must not be packed' ' + test_commit initial && + test_commit wt1 && + test_commit wt2 && + git worktree add wt1 wt1 && + git worktree add wt2 wt2 && + git checkout initial && + git update-ref refs/worktree/foo HEAD && + git -C wt1 update-ref refs/worktree/foo HEAD && + git -C wt2 update-ref refs/worktree/foo HEAD && + git pack-refs --all && + test_path_is_missing .git/refs/tags/wt1 && + test_path_is_file .git/refs/worktree/foo && + test_path_is_file .git/worktrees/wt1/refs/worktree/foo && + test_path_is_file .git/worktrees/wt2/refs/worktree/foo +' + test_done diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh index 3b531842dd4..eb4eec8becb 100755 --- a/t/t1415-worktree-refs.sh +++ b/t/t1415-worktree-refs.sh @@ -17,17 +17,6 @@ test_expect_success 'setup' ' git -C wt2 update-ref refs/worktree/foo HEAD ' -# The 'packed-refs' file is stored directly in .git/. This means it is global -# to the repository, and can only contain refs that are shared across all -# worktrees. -test_expect_success REFFILES 'refs/worktree must not be packed' ' - git pack-refs --all && - test_path_is_missing .git/refs/tags/wt1 && - test_path_is_file .git/refs/worktree/foo && - test_path_is_file .git/worktrees/wt1/refs/worktree/foo && - test_path_is_file .git/worktrees/wt2/refs/worktree/foo -' - test_expect_success 'refs/worktree are per-worktree' ' test_cmp_rev worktree/foo initial && ( cd wt1 && test_cmp_rev worktree/foo wt1 ) && From patchwork Wed Jan 17 19:52:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522157 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07AEA250ED for ; Wed, 17 Jan 2024 19:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521167; cv=none; b=ZRQT2oQCuAmQ0UneVs5lINbn6V1pQZe7YiPoRydUys0hYh1LLD9ugGN/yThAzzTwz+rTTGVsvxi42rkuoPib3BjjsBJcV0Sbpamg9rW+Gv7Mh9Lj/bvccIfDyezuvgZw34yWoe5uoBhbjAS/c50kwrj+wwH9F1YyiGwoRCxQBD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521167; c=relaxed/simple; bh=2AVRJUnv5FG9qdXXhD2voc5n2a+ZHNzQPULWoIKmfAg=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=IvsAsfB7LqB6rq1iwFGm3dP3b0R4oyvtweU7vBR77VNUD/0DXz0I1JqRbMrQjxlCfwrtZ3mrdS3IGcuCoaKxb4O7mQDEo/t1YpOrUWHQwBJb+tZ1QhZ2UlTAIPjPiyuL5Zd7o56zu5yFgLpxaLwZTAdBNYv01YBE7/gOPE/0dqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c7NT8j+v; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c7NT8j+v" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-337be1326e3so1871476f8f.2 for ; Wed, 17 Jan 2024 11:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521164; x=1706125964; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/Ecjz1VzHaWr91sVTBWAyAlNQiO1X6dU1IsIua5EH4E=; b=c7NT8j+v1bqGn04+nfG/08M1ApKfcP9F+SHanwNEWH08XS9q2iWtZi9MllbKYjOfW+ JI6p8Bu2TeSzGlJEYBp66ZJFoU7x4Rm9WXx7zZeQ9C17gQktCF61ynOpoF8Qx+/w3f4t 0W0EjKjGtqUwxOPlyHHMk1Eoy5hk4XsEfyk45Ez0gmd3q2LxdVxjoYWs/WkJ9wFXtIIL SVJDCoIyc9dFYMIDyJY+r5/Rwd7GIte0HdIOyB2Wj7434Kg4IQYVUri8yLj0YQgxG+ZX pzoig6RGiouNhFaMYpC6ZVLJslpdtfGr51RFpqP1Cb7mqzLe09qRLeM3JZtFUi2H1Oh0 QwBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521164; x=1706125964; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Ecjz1VzHaWr91sVTBWAyAlNQiO1X6dU1IsIua5EH4E=; b=GgMzs06iJxW0mrBBYJdiYMHGNcFxrlHtMBRfG24z4uQI2SPc8wHuJqqzR4r7jfsIN8 FPoyxpXRaSAJiYwxmWiIT2eSMA2DflxrI1RvnCzUl0nif/uEXGMOHq8T5O2QYZcIOyZ4 x/kZvLalRGkArbigEq+wOG99uEWjgG2ZpupHu8FZzqW2Wqj4b97JoNzfQrMvmpQ7Wv5A F8iRbwrOVuOceN6d/HryC6+hwMTZzibyW6RSbtPHkbNW3bJJ3y2A3LT4UPVim7CUwbso wh5VVLX44/XGuQzwtBDKLx0hkPtiZdfycGfIYTxu7UZEGKTFc1+nWlyTWlvvcHz1fwYT R0Kg== X-Gm-Message-State: AOJu0YwWjbBJsIdhtexZbNicVjMUha6vEYBQXLxXy0pSwPlLrlhXkY4u tvCKCkCnP19QgE1twHs4iSDHr3a05fU= X-Google-Smtp-Source: AGHT+IGFxlmsbKAGJFv439asZ+TCsiAWMfWXNyQXyogHbgE2kp13zt0fRdZDIjpqaqLyXwhJaAFgYw== X-Received: by 2002:a5d:488b:0:b0:337:afb7:1acb with SMTP id g11-20020a5d488b000000b00337afb71acbmr2135616wrq.114.1705521164120; Wed, 17 Jan 2024 11:52:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z12-20020a5d640c000000b00337bcef9193sm2353816wru.44.2024.01.17.11.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:43 -0800 (PST) Message-ID: In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:32 +0000 Subject: [PATCH 09/12] t1503: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move this test to t0600 with other reffiles specific tests since it checks for loose refs and is specific to the reffiles backend. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 5 +++++ t/t1503-rev-parse-verify.sh | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 8526e5cf987..704b73fdc54 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -522,4 +522,9 @@ test_expect_success 'refs/worktree must not be packed' ' test_path_is_file .git/worktrees/wt2/refs/worktree/foo ' +test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' + ln -s does-not-exist .git/refs/heads/broken && + test_must_fail git rev-parse --verify broken +' + test_done diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh index bc136833c10..79df65ec7f6 100755 --- a/t/t1503-rev-parse-verify.sh +++ b/t/t1503-rev-parse-verify.sh @@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' ' test_must_fail git rev-parse --verify main@{$Np1} ' -test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' ' - ln -s does-not-exist .git/refs/heads/broken && - test_must_fail git rev-parse --verify broken -' - test_expect_success 'options can appear after --verify' ' git rev-parse --verify HEAD >expect && git rev-parse --verify -q HEAD >actual && From patchwork Wed Jan 17 19:52:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522158 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DD7025108 for ; Wed, 17 Jan 2024 19:52:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521168; cv=none; b=sxoSN1chYI5yNvIMlFVKWtqlk0n8tWcb9IURIzXgd1ZlRNw28bLA5tRqqXqgMXYb6vOBIJDjYhoN8tktxdYe6JItkZnigpSnDwzyMKHOMshLJSdAagcyRJ2VQ5HV8Vg4lDreiN64fqzCYKxG663KiMtZPRgAx2i0+wrsnyd30Ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521168; c=relaxed/simple; bh=kVBWg0FrE1EkJ8+I5HaO6rlFyN/QYxi2uO0NTIL0Arw=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=Gm2klxeKOg91HC4wyzAAteGKlB+gWlJcoVpgQwF1xPHH2r5f1hLHEJwvBqZsdJZYKYCr1lB3BW1lKfNM3aZldXd6FwatyUtU3vFu/kbO5vJMrCyJPjaUErvv2fZeyy4CAdhLg66jUIL26uX/Poox19a1kixtsmqrOUtsJO9RZC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e4ctK0da; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e4ctK0da" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-337c5eb1bddso628747f8f.3 for ; Wed, 17 Jan 2024 11:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521165; x=1706125965; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=e0bQEqAyF1h03Cm8B3/26JgNIdeTN4kBfNthesT/pps=; b=e4ctK0daBfuEE04t5aEduMqCgqDWNo0Tp7ha81uuH/4ehT0y7BsSuZ12OfONIvzyXa hLUwhD/9TVDMtSe6jX3oOuK/tLNOs0g1gQu5P6czAx99eUZ1bT1K9f2vrZQwDl9dbUH5 Z08PW7OUoQeyvPRCpuiqnymOSMJKkJO0msZOF8jNrrRqNgTn7hd0cVHeD5VJHg7Qb/PZ /hVoA/n9qe4n4puuM+bteEzYQLTeI5iBBkFaEFAEe/PLCgkT9FInrQw3aqO4/6B5ZX2G PdKQ6UgeKjoL/JwmVjN7io4gwIm4YZw1jv9z4WCjMJrZEPp/Vc1zvBFgvEbk+O9/QCjO Laew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521165; x=1706125965; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e0bQEqAyF1h03Cm8B3/26JgNIdeTN4kBfNthesT/pps=; b=Ht/1aKxW6Mb+B1zqgzlu5UOzM9OmjMM2U6MIJsVyRzPbk1UEm6q7mAOgfB0TP+uGMU 7DSs1rt/0uEADbov15cpSytBMWJ1EYeuu8mseCP7iGySFGKO6QlOC6RHvjDhDgj7VgHO 9hG+ucxICi3RP0nbppEkkqFkC3x9qIJfcaMya35tX5ZGEUhT8wul6CEq5QNRyMZuejs5 tVwMYxVK0nrMQOqxa1Pj13N2bQhL2S1q7ZwBuLEmxFiOaZEA6qhRWof4xy6Xa57GKNFV 1bFxP3ykYh6lEdDTh/DH2zXjZs+IpX1iGT4ZnVhgWHfpNJc1tZgJ3qqStdvgopDEWFBW Lrmg== X-Gm-Message-State: AOJu0YyyejmMdg8CZIwihSaagUugmHzJytDXHa5ZHj9DcLlbAOtLypkl oLBeZSf6MV36bWdM3kW7ClPPcoouRi0= X-Google-Smtp-Source: AGHT+IF66xHuSCjg07kN2M7G51e8l/6ZJsSmscuQQMNYeMaQrXyfG+pGmdl1GaK677hZM3cFRa4GAQ== X-Received: by 2002:adf:ed04:0:b0:337:c3cc:5b80 with SMTP id a4-20020adfed04000000b00337c3cc5b80mr687544wro.123.1705521164729; Wed, 17 Jan 2024 11:52:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q7-20020a5d5747000000b00337be1c7d2fsm2360890wrw.58.2024.01.17.11.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:44 -0800 (PST) Message-ID: <56a9c8f20dd7c8f3e9401b2bd3929fb9c53c7d27.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:33 +0000 Subject: [PATCH 10/12] t3903: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move this test into t0600 with other reffiles specific tests since it modifies reflog refs manually and thus is specific to the reffiles backend. This change also consolidates setup_stash() into test-lib-functions.sh Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++ t/t3903-stash.sh | 43 ------------------------------------- t/test-lib-functions.sh | 16 ++++++++++++++ 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 704b73fdc54..bee61b2d19d 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' test_must_fail git rev-parse --verify broken ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' + git init repo && + ( + cd repo && + setup_stash + ) && + echo 9 >repo/file && + + old_oid="$(git -C repo rev-parse stash@{0})" && + git -C repo stash && + new_oid="$(git -C repo rev-parse stash@{0})" && + + cat >expect <<-EOF && + $(test_oid zero) $old_oid + $old_oid $new_oid + EOF + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + test_cmp expect actual && + + git -C repo stash drop stash@{1} && + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + cat >expect <<-EOF && + $(test_oid zero) $new_oid + EOF + test_cmp expect actual +' + test_done diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 34faeac3f1c..0b0e7b19fdc 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -42,22 +42,6 @@ diff_cmp () { rm -f "$1.compare" "$2.compare" } -setup_stash() { - echo 1 >file && - git add file && - echo unrelated >other-file && - git add other-file && - test_tick && - git commit -m initial && - echo 2 >file && - git add file && - echo 3 >file && - test_tick && - git stash && - git diff-files --quiet && - git diff-index --cached --quiet HEAD -} - test_expect_success 'stash some dirty working directory' ' setup_stash ' @@ -200,33 +184,6 @@ test_expect_success 'drop stash reflog updates refs/stash' ' test_cmp expect actual ' -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' ' - git init repo && - ( - cd repo && - setup_stash - ) && - echo 9 >repo/file && - - old_oid="$(git -C repo rev-parse stash@{0})" && - git -C repo stash && - new_oid="$(git -C repo rev-parse stash@{0})" && - - cat >expect <<-EOF && - $(test_oid zero) $old_oid - $old_oid $new_oid - EOF - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && - test_cmp expect actual && - - git -C repo stash drop stash@{1} && - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && - cat >expect <<-EOF && - $(test_oid zero) $new_oid - EOF - test_cmp expect actual -' - test_expect_success 'stash pop' ' git reset --hard && git stash pop && diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index b5eaf7fdc11..68a6c8402d0 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1958,3 +1958,19 @@ test_trailing_hash () { test-tool hexdump | sed "s/ //g" } + +# Stash some changes +setup_stash() { echo 1 >file && + git add file && + echo unrelated >other-file && + git add other-file && + test_tick && + git commit -m initial && + echo 2 >file && + git add file && + echo 3 >file && + test_tick && + git stash && + git diff-files --quiet && + git diff-index --cached --quiet HEAD +} From patchwork Wed Jan 17 19:52:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522159 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E8E325542 for ; Wed, 17 Jan 2024 19:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521169; cv=none; b=i0pUzx2wi0RJ+kezrKVtCHGIMTBxb3j0ZfTSgwY7cyNI6HJj/dNwX9ZdBM6N3zkaDe9GWP9ZYb65YGmyPIF66vZJmNTwdhQd+lmx7H20DILc2hHMjhUixwEq0xJoMrdQmloHcOvI2a0znoMwebWgzr18SOAdQnfn2kihW7Xsr2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521169; c=relaxed/simple; bh=8o6c5kDp3IFlRDQTeaCJWSQLMR/7sacTRvvCdfh2+2s=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=FBjwpb6c3S6rE+lY5o++jFnn1lA8kbfJciJ60YkP0SCR4+Aib6GPzTIaWoYJ5N+W+pM2yphghMmpXaM7CIHtMq7Vqp/kkkvU+UnMzys6+MJYKNcI54wDYlWSInAU1skG8vT9ld1h+DYlVHKyWwFYn8QBrcBZfRWeNyM4u7hVv1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OcHry+vi; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OcHry+vi" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-337c62b5f11so610098f8f.3 for ; Wed, 17 Jan 2024 11:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521166; x=1706125966; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=o7tqBQDP5QKxdWXO3TjkanPjtuLJiHEPrFW6EKmv97g=; b=OcHry+vi/vbVdFU+gFDO0m/feDGN+wj1wNCOkDtSFXH6dTVA5RIcxANcSGWq900hkN sc7XXEBIoaaCMU+0H1ELF13DV8WsRWk212nR5K3j+CJbx2APqQ85gvNLaQQdBnNNAPvu xSOPclA2bk0+l00ONPVQB6+BKQx6iRmfvWFh2BKjbB+cPGRsW5Mhqtp2tRkNqacAHhrl jxQTHnAV7P104hWTB2WwLnoDul0USxBjmJE3KodpnsmG5avEaRDqykm5QeNABl1tvO+Q wPYExN8/zfBi5hYBFVD3vjfNe94vm4W41mVWZNslX6nWDH6PH4suhu1lYMcUY8RLwNsk 1Vmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521166; x=1706125966; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o7tqBQDP5QKxdWXO3TjkanPjtuLJiHEPrFW6EKmv97g=; b=Qj6m4fw0kdGTRbaDBtMWCXpLNOVQBzqBA5yoqYizvP6hHCxCkt64EJUFfZQwZxhzPQ ffXzaQyRJ+JlMuZbW1FXwwxyzsd4f1ibJB+CyJ6kwBAJb4bK9CcLlHNn0T0bN/sos7U/ 4bRyzt9h3I2OT8x5rFDaEsNPF2fW3SPOmwscXPr2O5+tidIl8rWymFlxEPBXGmFGXUPx GeEi6VuAI4NPmBFW5ywnGcO3yT1SG3yTRy4wGVXJk9a2mmtOQ7kHtWZtYNAsxviTjB67 CV6FtfsdSFLJ3cZf066t90LpjiykpIKxFvbglB8rH5PUj4NN/06y6RXLyOT2LDc5yIQU 7pdA== X-Gm-Message-State: AOJu0YwfF3bWlk148UCptv4ReYXv9COpIoE7ACFA2RD6gr7OF6+AzYha Xn4X3duOwnGePZJR+BGNQL2ydNaqrys= X-Google-Smtp-Source: AGHT+IF7k1hGZvaXAZF8+8lw3G3PwL42FqaQHkvr6We0FDiziwpM14TqIv8zJIYkiOxibsfRm5RMfg== X-Received: by 2002:adf:b1de:0:b0:337:b479:8177 with SMTP id r30-20020adfb1de000000b00337b4798177mr1692995wra.123.1705521165761; Wed, 17 Jan 2024 11:52:45 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n18-20020a5d4012000000b00337c485f1d2sm1976800wrp.82.2024.01.17.11.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:45 -0800 (PST) Message-ID: <39e69fde3d70220e03e3e103f46bc7c089cf2136.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:34 +0000 Subject: [PATCH 11/12] t4202: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move two tests into t0600 since they write loose reflog refs manually and thus are specific to the reffiles backend. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 17 +++++++++++++++++ t/t4202-log.sh | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index bee61b2d19d..c88576dfea5 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -554,4 +554,21 @@ test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' test_cmp expect actual ' +test_expect_success 'log diagnoses bogus HEAD hash' ' + git init empty && + test_when_finished "rm -rf empty" && + echo 1234abcd >empty/.git/refs/heads/main && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr +' + +test_expect_success 'log diagnoses bogus HEAD symref' ' + git init empty && + test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr && + test_must_fail git -C empty log --default totally-bogus 2>stderr && + test_grep broken stderr +' + test_done diff --git a/t/t4202-log.sh b/t/t4202-log.sh index ddd205f98ab..60fe60d7610 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -2255,23 +2255,6 @@ test_expect_success 'log on empty repo fails' ' test_grep does.not.have.any.commits stderr ' -test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' - git init empty && - test_when_finished "rm -rf empty" && - echo 1234abcd >empty/.git/refs/heads/main && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr -' - -test_expect_success REFFILES 'log diagnoses bogus HEAD symref' ' - git init empty && - test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr && - test_must_fail git -C empty log --default totally-bogus 2>stderr && - test_grep broken stderr -' - test_expect_success 'log does not default to HEAD when rev input is given' ' git log --branches=does-not-exist >actual && test_must_be_empty actual From patchwork Wed Jan 17 19:52:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13522160 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 332022554F for ; Wed, 17 Jan 2024 19:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521169; cv=none; b=oPnloa3KtNHSHccWdYypSJuaYi5123W7tF8sJn+SvwZhlKfbeVUNajInsKf8sC3ew5/nKizrQrEtmzKHz0ScvtSsa/HQ4+HKnG4+gbMd2pt5ro9xTrP/o6lHwYTtL9ZX+By3uEAXcGWNULQkEwyStFsha4fO9k+FeOYkz6bCpks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705521169; c=relaxed/simple; bh=lYbOF+XQYbZ0gkhsGc1XFVu0O6FgMVM+GK4CJm8T4cM=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received: Message-ID:In-Reply-To:References:From:Date:Subject:Fcc: Content-Type:Content-Transfer-Encoding:MIME-Version:To:Cc; b=uktMCpqXC+2UOtAseJbcHw/3hviDHm5/FUOYR8AXB5dox3rIXFjaVmhQbnKHhEyKSlVSk4pRsxbPZpveWMq1oTUHgeoXJsz4c3aWJv/cjoiJcx1mLgsNkk5TKIMj6EZXgcp7YPD7OlZ9pZWXrKk0Xc6ys2kZeYVEHHhpK/OxIII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aEIoI3WI; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aEIoI3WI" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40e86a9fbd9so17863775e9.1 for ; Wed, 17 Jan 2024 11:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705521166; x=1706125966; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=yIbwUXZ7G89WTCGS+QskcTfeUNnIdBAGc/HhL+OpOug=; b=aEIoI3WI4rede6VyENoKPEVml5Lw/AtIsAS/5bajEojncl21SSyldTbVwKnJ7wgBEN EZ+3jZGsrEEZ50Fhdn3T1R+Le0AkUhfjcX3QgZIFGNzpCrdxk+KfuO0hsbwxPJMdqO1G ht4fvG8+zO1d5BhHHm08253B8HggfcRuEkfgbvcUduGwsiekdAXdAvPLKf0xCe/VJMrD MgSqdSU1pK+0Vk8rWiUsmKrZr1c1qovCXt3epYQgo44RyMDIWSSSQ3K+D0KSR16KKhU2 4LkcAVxIeeAiOFho/6HBFTNLI1mPMeO8+H9RbpeTswJcl5f5qd8jZmnpf91whaBTEjHA fwCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705521166; x=1706125966; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yIbwUXZ7G89WTCGS+QskcTfeUNnIdBAGc/HhL+OpOug=; b=ebb6IlvzZ56VuSrBJFs8TbBicEbggwEbTDDlIYXCAorTwfNRDNAc6CPxVdvGV9ksSh sO+7j++pqicj4UmOo9zogMVUzZgyI4OJLxnNuVaBMmqxryoBJl4R9VHYVavtR8+QwqrD Ec+lvD8YU14YyyuWx2BO6+78bLzWoJ7qiazfkPCGVibWkFYheZDmBlkQRj/l5uwoQHI9 V89iB9Cf95AjaLhThEocSs/9odSE887+FfVdPuKIan8vU0kzc+DWbIiGk7EOqYyiZ2Ri voJLbf5Ln5SvBIsB/GFWNwLTotM9Nw5YXgh1nK2t+vbWk3DPsjenuhpi02sq3OXIIgUX cnhA== X-Gm-Message-State: AOJu0YzFlQLgLjtF3h4/XynhdCf9PrvMmZfDDXmT6CZGBRFxcG4AFBH6 C3iepIq/Lu6Dk7vddrTwZPp5TYYtuAg= X-Google-Smtp-Source: AGHT+IFjQ+2Co4uKUAcLM9wSTOCkRyIghQk8djAc4x/yCFV1kV72aVy2CzHcs4x15uPO940/Di+FKw== X-Received: by 2002:a05:600c:4715:b0:40e:5759:bcbe with SMTP id v21-20020a05600c471500b0040e5759bcbemr5016891wmo.113.1705521166314; Wed, 17 Jan 2024 11:52:46 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c315400b0040e63226f6dsm5602226wmo.1.2024.01.17.11.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 11:52:46 -0800 (PST) Message-ID: <316a20ed17950e4e45d7ea13d8f6e8d4e064821e.1705521155.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Jan 2024 19:52:35 +0000 Subject: [PATCH 12/12] t5312: move reffiles specific tests to t0600 Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Move a few tests into t0600 since they specifically test the packed-refs file and thus are specific to the reffiles backend. Signed-off-by: John Cai --- t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++ t/t5312-prune-corruption.sh | 26 -------------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index c88576dfea5..190155f592d 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' ' test_grep broken stderr ' +# we do not want to count on running pack-refs to +# actually pack it, as it is perfectly reasonable to +# skip processing a broken ref +test_expect_success 'create packed-refs file with broken ref' ' + test_tick && git commit --allow-empty -m one && + recoverable=$(git rev-parse HEAD) && + test_tick && git commit --allow-empty -m two && + missing=$(git rev-parse HEAD) && + rm -f .git/refs/heads/main && + cat >.git/packed-refs <<-EOF && + $missing refs/heads/main + $recoverable refs/heads/other + EOF + echo $missing >expect && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not silently delete broken packed ref' ' + git pack-refs --all --prune && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not drop broken refs during deletion' ' + git update-ref -d refs/heads/other && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + test_done diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh index 230cb387122..d8d2e304687 100755 --- a/t/t5312-prune-corruption.sh +++ b/t/t5312-prune-corruption.sh @@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' ' test_cmp expect actual ' -# we do not want to count on running pack-refs to -# actually pack it, as it is perfectly reasonable to -# skip processing a broken ref -test_expect_success REFFILES 'create packed-refs file with broken ref' ' - rm -f .git/refs/heads/main && - cat >.git/packed-refs <<-EOF && - $missing refs/heads/main - $recoverable refs/heads/other - EOF - echo $missing >expect && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' ' - git pack-refs --all --prune && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' ' - git update-ref -d refs/heads/other && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - test_done