From patchwork Thu Aug 8 07:35:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13757055 Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D967F7464 for ; Thu, 8 Aug 2024 07:35:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723102530; cv=none; b=JouGtr62AaZVM1F8AZnIo21VxE5Hlx43G/a0LVnW9gf4Vy054UPWA4NZ1NRN6oHOvPsT93XjDukrJg3OgnAd23//K4LEzd9lwxqEcyHMzK/0AYu1lHFjJMJNgy28J8BXj21wm7O+NNZOZZ7UuFD0TK479R3120Cpytf6Op/N/2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723102530; c=relaxed/simple; bh=HfHLwuAEZWPKqpak2WKZ6Y132n2WzT1WomPdsK+U2/U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BFpxEzFRP2R0xCDSBiHQwYjy7uLwXLU0GedxpQqOn6tNxZgPjJ+ap0MuHQOhKmKLkBrcnNxUwZyjBSSB2JBIori8AQwjmz5djZM2qLa3aMQTPuacp8STWbwh3r3RIfZSXNCjfwy4amR8vBGSvxThq+klnwH5HZLe+QcYG0KcsKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=VYVd2skH; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DW7WcRUF; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="VYVd2skH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DW7WcRUF" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 149861151BAE; Thu, 8 Aug 2024 03:35:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 08 Aug 2024 03:35:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1723102528; x=1723188928; bh=XKCrQ9PHad DSKtewgataac+qot8twtv+f8tln45QNHc=; b=VYVd2skHUBPbNhZeClX0G8/TM+ ZuqEpldlSUXnUW6isrncGIDdnHKkhhpUgUbPSZlnQgYbyPl/DjcMwuKHlowYoW2D qkNPIeKshirl4MJepqqNhuQP5OlU/DS5rRnyaPiwMTPIrgtjcDDFNmHKMrVqukYR hw0nShD5La9WOdi+UrdUKoTxQ5bWGy+7ykWiT4MG16du/HRUjjUKWMBrPRa/UFfv AHi6KDDVqfI6kWsjn9Uo4nStTvk3GLW+ImIHGLSap8y4fW5BNVsC+xm0v3gpFG52 v5Awwvx43gvSzVFbouC15J6t4TKVmn9I6964fC0SaYx9aYyIo8SfX6lXe4Aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1723102528; x=1723188928; bh=XKCrQ9PHadDSKtewgataac+qot8t wtv+f8tln45QNHc=; b=DW7WcRUF587rz/TdTPIeC0qYhVkPWRTh/L6AOsnHMQhC L3xETWZQqSuC4Ftzkr/N8gLRcnCesI3UdJc1dj+NMAw7xFSGAn1HfqxZ1IVQfEX1 X2m0tEIMUpGpJxPmkjoiBEOyvfjCT1Q9zfx03scb094w0OiwJSwdWxJFyqQLHAmX Qwk1oyih7UWExCCa8NjVuxrgGkflb2f3yUmJFLlS1YfzXXdho+HE/coBt2DkzNQw r2uJ016krFZCNjvtSBpN0PR1jLe1+OEBQ5BPXMxuaAlpJsa2sIxn3RELdk2LLKGv Duf4oicXYfcyvUeg/GJeVLfAXQrW2vreAW2VLG7xag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrledugdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtjeen ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepteeuvefhhfdufedvgeeiueeileegtdfhgeeftdeuveej jedtgfejhedujeeutddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthht ohepjhholhgrnhgusehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithhsthgvrhesph hosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 Aug 2024 03:35:26 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e90a98ed (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 8 Aug 2024 07:35:18 +0000 (UTC) Date: Thu, 8 Aug 2024 09:35:21 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eric Sunshine , Jeppe =?utf-8?b?w5hsYW5k?= , Junio C Hamano Subject: [PATCH v2 0/8] Improvements for ref storage formats with submodules Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Hi, this is the second version of my patch series that aims to improve interaction of ref storage formats with submodules. Changes compared to v1: - I noticed that `git submodule add` also used to fail when used with a preexisting repository that uses a different ref format. - Add a preparatory refactoring that wraps overly long command lines in "git-submodule.sh". - Wire up support for `--ref-format=` in `git submodule add`. Notably not included is a change to make `git submodule add/clone` honor the ref storage format of the parent repository. I think it is somewhat orthogonal to the changes I do in this series, and it is not entirely obvious whether it is a good idea or not. We can still do this in a future patch series, if we ever hear good arguments for it. Thanks! Patrick Steinhardt (8): git-submodule.sh: break overly long command lines builtin/submodule: allow cloning with different ref storage format builtin/clone: propagate ref storage format to submodules refs: fix ref storage format for submodule ref stores builtin/submodule: allow "add" to use different ref storage format submodule: fix leaking fetch tasks submodule: fix leaking seen submodule names object: fix leaking packfiles when closing object store Documentation/git-submodule.txt | 10 +- builtin/clone.c | 10 +- builtin/submodule--helper.c | 46 +++++++- git-submodule.sh | 82 ++++++++++++-- object.c | 9 ++ refs.c | 2 +- submodule.c | 18 ++-- t/t5572-pull-submodule.sh | 1 + t/t7418-submodule-sparse-gitmodules.sh | 1 + t/t7424-submodule-mixed-ref-formats.sh | 144 +++++++++++++++++++++++++ 10 files changed, 298 insertions(+), 25 deletions(-) create mode 100755 t/t7424-submodule-mixed-ref-formats.sh Range-diff against v1: -: ---------- > 1: 6513c6b17d git-submodule.sh: break overly long command lines 1: a450759bd1 = 2: e6cda43878 builtin/submodule: allow cloning with different ref storage format 2: e5923c0b33 = 3: ed314f5333 builtin/clone: propagate ref storage format to submodules 3: aaff9134ed ! 4: f13356581e refs: fix ref storage format for submodule ref stores @@ Commit message $ git pull --recursive fatal: Unable to find current revision in submodule path 'path/to/sub' - Fix the bug by using the submodule repository's ref storage format - instead. + The same issue occurs when adding a repository contained in the working + tree with a different ref storage format via `git submodule add`. - Note that only the second added test fails without this fix. The other - one is included regardless as it exercises other parts where we might - end up accessing submodule ref stores. + Fix the bug by using the submodule repository's ref storage format + instead and add some tests. Note that the test for `git submodule + status` was included as a precaution, only. The command worked alright + even without the bugfix. Reported-by: Jeppe Øland Signed-off-by: Patrick Steinhardt @@ t/t7424-submodule-mixed-ref-formats.sh: do + # Some tests migrate the ref storage format, which does not work with + # reflogs at the time of writing these tests. + git config set --global core.logAllRefUpdates false ++' ++ ++test_expect_success 'add existing repository with different ref storage format' ' ++ test_when_finished "rm -rf parent" && ++ ++ git init parent && ++ ( ++ cd parent && ++ test_commit parent && ++ git init --ref-format=$OTHER_FORMAT submodule && ++ test_commit -C submodule submodule && ++ git submodule add ./submodule ++ ) ' test_expect_success 'recursive clone propagates ref storage format' ' -: ---------- > 5: 4ce17e44a1 builtin/submodule: allow "add" to use different ref storage format 4: 8f8371c18a = 6: d92770290f submodule: fix leaking fetch tasks 5: 732142aaa6 = 7: e9421189ca submodule: fix leaking seen submodule names 6: 8dc7cc76d5 = 8: d05737c75f object: fix leaking packfiles when closing object store