From patchwork Mon Feb 21 08:02:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 12753221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 084BEC433F5 for ; Mon, 21 Feb 2022 08:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346734AbiBUICg (ORCPT ); Mon, 21 Feb 2022 03:02:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346752AbiBUICe (ORCPT ); Mon, 21 Feb 2022 03:02:34 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B6010B2 for ; Mon, 21 Feb 2022 00:02:10 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D2A485C01BF; Mon, 21 Feb 2022 03:02:09 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 21 Feb 2022 03:02:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=L5sf1+E2guc0MvxSxr4t6Zp5fqGHAjXfebxyEO ljLk4=; b=DId0Sjqx9TScR19B3KNIc0lb8sOrGjiPnoyq0xJGrPNjpFrSsz6svk GGiOshAdRSrkuY2frwbh9gu2EyyB+7cnJLm7MK80GmEXW6KtFswS7Toq11/yYx6z kKtX2lfYExHDkp1s1YmChrgrpg6UZFoNa7ljAWXakZHhdcQFWEbSZrLoyQ+sx8aR gl65R3mpQ0zJDQoUbsxefVa4y5rj8c6l8i3nrO6vDVZxEFAVdlLXTUiQsBMItBGB mQJe7jeME8bAeBmeaEJTh6fAGyK/exfBaWwyqUW+jiPKV84pTSHEDDXMr0XioxEV fLalxI/vh1hS1idsQOxkoBp/0haTHjqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=L5sf1+E2guc0MvxSx r4t6Zp5fqGHAjXfebxyEOljLk4=; b=dxkAkLtd+Rf+i2nzi71VvrALGfgg8jhaX zmrKT94HZW8FDjGOveRRAr/vRwxg1yPcgTD37TWZPbVL7QJXO+Bo5pdWj1YR9Wgo wHJPPQpv02LUCgXUm/YfOE2PZ3WqkGTkx7WdF0WRRWOhsUCoNyT0Aah9Xp/CAc4o IX8BOK+dOuxSCr6+pRaIASPe4OVcNIV/6t1FmdFXDedcG89JCS3v1drujLasMYmD U3dletypB/DBpzNYEukaC0CoiRbu8scCCSIPiV0WOd8k55bcrUlkqA9f8XY8ewcM QV7ZOGnPxH95U4VLBO7KQiLVn8NCa8a/nV3eEGxgdQz1XRUD5hydg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrkeehgdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeehgefhtdefueffheekgfffudelffejtdfhvdejkedthfehvdelgfetgfdvtedthfen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Feb 2022 03:02:08 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 6d21c55b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 21 Feb 2022 08:02:07 +0000 (UTC) Date: Mon, 21 Feb 2022 09:02:06 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Christian Couder , Jonathan Tan , Elijah Newren , Junio C Hamano Subject: [PATCH v3 0/7] fetch: improve atomicity of `--atomic` flag Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi, in c7b190dabd (fetch: implement support for atomic reference updates, 2021-01-12), I have added a new `--atomic` flag to git-fetch(1) which is supposed to make it an all-or-nothing operation: either all refs are updated, or none is. I have recently discovered though that there were two oversights: neither pruning of refs via `--prune` nor the tag backfill mechanism are currently covered by this flag, which breaks the promise. This is the third version of this patch series fixing these issues. The only change compared to v2 is a clarification in a comment to better point out which type of backfilling is being tested. Patrick Patrick Steinhardt (7): fetch: increase test coverage of fetches fetch: backfill tags before setting upstream fetch: control lifecycle of FETCH_HEAD in a single place fetch: report errors when backfilling tags fails refs: add interface to iterate over queued transactional updates fetch: make `--atomic` flag cover backfilling of tags fetch: make `--atomic` flag cover pruning of refs builtin/fetch.c | 192 +++++++++++++++++++++++++++++-------------- refs.c | 16 ++++ refs.h | 14 ++++ t/t5503-tagfollow.sh | 74 +++++++++++++++++ t/t5510-fetch.sh | 29 +++++++ 5 files changed, 263 insertions(+), 62 deletions(-) Range-diff against v2: 1: b4ca3f1f3b ! 1: 081174b7a0 fetch: increase test coverage of fetches @@ t/t5503-tagfollow.sh: test_expect_success 'new clone fetch main and tags' ' +test_expect_success 'atomic fetch with failing backfill' ' + git init clone3 && + -+ # We want to test whether a failure when backfilling tags correctly ++ # We want to test whether a failure in `backfill_tags()` correctly + # aborts the complete transaction when `--atomic` is passed: we should + # neither create the branch nor should we create the tag when either + # one of both fails to update correctly. 2: b0a067bbc1 = 2: 9867e76ac7 fetch: backfill tags before setting upstream 3: 0b9d04622d = 3: 7c36ecbcf4 fetch: control lifecycle of FETCH_HEAD in a single place 4: bc1e396ae0 = 4: a7e005dd48 fetch: report errors when backfilling tags fails 5: fac2e3555a = 5: 0316d770e9 refs: add interface to iterate over queued transactional updates 6: 331ee40e57 = 6: 2f98e34c84 fetch: make `--atomic` flag cover backfilling of tags 7: 2ad16530e5 = 7: 7292de826b fetch: make `--atomic` flag cover pruning of refs