From patchwork Thu Aug 15 17:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765007 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 A0E29446CF for ; Thu, 15 Aug 2024 17:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743066; cv=none; b=oCOoQFyBE5xHRT+b+5gK4oQYZMKvybbU2ucR3CAKMXNxT90RbR0UdxqXepIV/gWyLRZGibzIy2TUQr0EqSLBKLHOJMUve5MEVZgUFaGtM46yKB/MoJbONem3KqwH0CJvqKnViqIXywW47bs7gv15Bl91lgiJwBWbzYqEFwH2pAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743066; c=relaxed/simple; bh=CtODriVAFScW8TmG+duJ8zp7wBVOgHUNrJuJO76haf0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F1ne5LVRhavuTocG8B5opqQ3UsHrVqYMqFS0QE+YkXcCqEHDLvYRanFtvP207dgEBWTV8obVQwxanlqYaO4U0JKaYS6MCBXeQUakI6y+2QFTpmL+/rF4H8oGYivq+8ghiD7NtNJaQ4KdkO3eQ+xY+536uKTabaMLgeCx0WxUYjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=xn4ch6rf; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="xn4ch6rf" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-685cc5415e8so12304347b3.3 for ; Thu, 15 Aug 2024 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743061; x=1724347861; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rFKdT9p5VTOnLKtZORotBuoE9O3KxtZKM/MyGcn0tiI=; b=xn4ch6rfdlgVlqhOxwSRYiSZ73R/51P5+N7cWoqpNkxCh9BDaxl7ec85z0ldYSM0HC GKs3QdDvPugypiGnumJzNCKEsVqRBD8zZhVrDeTf0wi1BnBJ/o31egWtOZ15WgstIpmi v05+EAR0hHr5+q22197ViOWXR4KnoqZgbNDyz/ww7M4S+gy/llBWde4AR0kos8nmk/Qn UbH2oibF3v8reFfJt0L0PGK8lmgfgaGCkJhQOn1OVUmXw/BNBUosy7E0BiNX+DaPWF7w mWgtMkE6+HupDGkKKJbw3ViqsUztnlq5MOIhX79bub62Ut9GyxhWItQkN5ELvAMp2dd8 etcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743061; x=1724347861; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rFKdT9p5VTOnLKtZORotBuoE9O3KxtZKM/MyGcn0tiI=; b=ondIDrP8a7BmcuJVqGgVmvIu8yJQNF79bP0k/dNLXyObqFlxG7xIb/ieyGWO5UFRZ6 uQEYMpeFvwS1xLuQmbD+yYvRkMVvuQmG/76du6PrtpHk38FfM7eqLEGqxELogtUSzlDR PJ/5olG3TrPrxUXiUmuU2VtzAWzCw61I8c2U64sPxbkBHTb4761Mo8pRCdzzXQ941tlE YaYY+2ddUwbk1hXGKYG1eunMtPBdsYze10lJCga9B5P2P9Ih2XXC8pduj3tWUrjEPmG5 KOBT/CWH04sBQJBujR7fpyX8onXa6mgqAlT/5XkTRCAgJZQI7enE2lFLXFgu6DS5Zw3X lmdg== X-Gm-Message-State: AOJu0YyTqY2iMSmnbt8OefDme2fnhUF08K8pamCaYW7z3a52+YLzrYms SOIMEf3NyuIuPEi91bJej/iVn39ud0qIe7zP3hBzPFGh66rem8vWo5x/B8obDOxMF+W9WppisqH Y X-Google-Smtp-Source: AGHT+IHYnrZBbfil70YIIcVD2WLttzO4DIGYew8/c7Lzwu7XoQRi9XtnQEt5s4fje7IzNgriFLCo3A== X-Received: by 2002:a05:690c:4f04:b0:6af:eb0b:6544 with SMTP id 00721157ae682-6b1bb85e488mr3054747b3.35.1723743061422; Thu, 15 Aug 2024 10:31:01 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af9ce76050sm3134117b3.101.2024.08.15.10.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:01 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:00 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 1/8] pack-bitmap: initialize `bitmap_writer_init()` with packing_data Message-ID: <9d322fc5399c453913d08f35eee907b5c909ad6b.1723743050.git.me@ttaylorr.com> 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: In order to determine its object order, the pack-bitmap machinery keeps a 'struct packing_data' corresponding to the pack or pseudo-pack (when writing a MIDX bitmap) being written. The to_pack field is provided to the bitmap machinery by callers of bitmap_writer_build() and assigned to the bitmap_writer struct at that point. But a subsequent commit will want to have access to that data earlier on during commit selection. Prepare for that by adding a 'to_pack' argument to 'bitmap_writer_init()', and initializing the field during that function. Subsequent commits will clean up other functions which take now-redundant arguments (like nr_objects, which is equivalent to pdata->objects_nr, or pdata itself). Signed-off-by: Taylor Blau --- builtin/pack-objects.c | 2 +- midx-write.c | 2 +- pack-bitmap-write.c | 4 +++- pack-bitmap.h | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index f395488971..0ad533c045 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1342,7 +1342,7 @@ static void write_pack_file(void) if (write_bitmap_index) { bitmap_writer_init(&bitmap_writer, - the_repository); + the_repository, &to_pack); bitmap_writer_set_checksum(&bitmap_writer, hash); bitmap_writer_build_type_index(&bitmap_writer, &to_pack, written_list, nr_written); diff --git a/midx-write.c b/midx-write.c index a77ee73c68..62f507eb72 100644 --- a/midx-write.c +++ b/midx-write.c @@ -825,7 +825,7 @@ static int write_midx_bitmap(const char *midx_name, for (i = 0; i < pdata->nr_objects; i++) index[i] = &pdata->objects[i].idx; - bitmap_writer_init(&writer, the_repository); + bitmap_writer_init(&writer, the_repository, pdata); bitmap_writer_show_progress(&writer, flags & MIDX_PROGRESS); bitmap_writer_build_type_index(&writer, pdata, index, pdata->nr_objects); diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index bf96c80898..4a7d2d1370 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -41,13 +41,15 @@ static inline int bitmap_writer_nr_selected_commits(struct bitmap_writer *writer return writer->selected_nr - writer->pseudo_merges_nr; } -void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r) +void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r, + struct packing_data *pdata) { memset(writer, 0, sizeof(struct bitmap_writer)); if (writer->bitmaps) BUG("bitmap writer already initialized"); writer->bitmaps = kh_init_oid_map(); writer->pseudo_merge_commits = kh_init_oid_map(); + writer->to_pack = pdata; string_list_init_dup(&writer->pseudo_merge_groups); diff --git a/pack-bitmap.h b/pack-bitmap.h index 1171e6d989..ab20d6a0b6 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -123,7 +123,8 @@ struct bitmap_writer { unsigned char pack_checksum[GIT_MAX_RAWSZ]; }; -void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r); +void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r, + struct packing_data *pdata); void bitmap_writer_show_progress(struct bitmap_writer *writer, int show); void bitmap_writer_set_checksum(struct bitmap_writer *writer, const unsigned char *sha1); From patchwork Thu Aug 15 17:31:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765008 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.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 AA4781AC8AD for ; Thu, 15 Aug 2024 17:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743067; cv=none; b=hyuRK+D6ljA78N3ctZCG0B67eCKFKgBb3FTNSOYqM0TSfvb8El1t1Q5gxM0tlGX8jU8luOXy5QGC0QW7gWVLt7aiK7ozjoffXNjuPht3uN5HaMr7Xwf9bW9M4hBMyMnsheAUtDOOwnrxEgZ7uKL1jq3UaBqcGUFj/p2vRnxXumM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743067; c=relaxed/simple; bh=KjlkXMFD9nI1sOSUb3r4eFYBqy0wTtqiS9MFGW1eLx0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uLVjyqbLUtykVZ51KdNHGCkfuPVZreYHzsX1CuesKegiBEtNIQVDgNm3PsgIQY067yMszEzED38xNF3bKHGo9Tk13EoYQpC7bThgaCJ9ZJvlS0YR/ZEw+WdlhJJm/WCvABZ0Co9yWSCX4P2j2BraDAIJsZBHvOimAJ9ZskLg8fg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=GcU0ioyc; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="GcU0ioyc" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-709485aca4bso640227a34.1 for ; Thu, 15 Aug 2024 10:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743064; x=1724347864; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=dMYhr7dkRHEnVeFf1mQXi5LPv1CrbIACKnXd9MxXuaE=; b=GcU0ioycXK6eTXgqigjh0kLYBzrDOXAT4Ao87C/1pwwjRXb3tW9j6DHw0i6yDoridw yQSAn2yrT9Xv9d++B38Cag7MSHStkaj8aibQNv6p/z5uYugDN+SPUIO2UDeJKkq6kyJj KG3YLPoA1e3Ri+HW/cCIp9jwrk2TZFbij6DXoQ9Hmfik6773z4vZ0yqlhToJVgabbaJ7 Z8+iSS4L47RQR4bbvbMATogA1G1ikDSOHJfIcXDt8Qb8RWfRKZzdySXcWWhiIaNdU9gM WsC+lvv2++HSHkPJvIFwJ/zwah/IVY5viWRmPPJOhq/AhRhoJIpY0thryoRd0yM0hQTq gJxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743064; x=1724347864; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dMYhr7dkRHEnVeFf1mQXi5LPv1CrbIACKnXd9MxXuaE=; b=j3Ib/T18oMMcs7aLcXk/+cYWpTPqAQJ0N4DqpBJBi8iBLuBXq76V0H3ZOVuLNMzRnj etmdf+CbqGzkiUHhKpDH3ft6Htc9ofcsicidm+9xrjW5WyKxS0fAcFBYVRBtpPV5swin Dvp192eNt09wKo9RhYzWPnEABCjOtCL/DsDCvLiJcPVTds6RM3fBIl70wDNJo+SetRbp il+7Y9bgN4Iu/Q6cpfKxOjFdGRPy5I/ac9/pbOaSCE/Sdp3Y+iubarC/6NN6bno+5lya yHdoF39W4y7siL/HtfW+Ark6ilkDMbCqbPTyAv25EQXMApWI7HLNi1Vfe1lZroDhsQPc Lk0Q== X-Gm-Message-State: AOJu0YyVSS8bwvv8TrcPJnZs/I3QxBm8LJppvx4DVh3AuLYkaQsjg3pZ jrctok8mdJNBdzwker7fj4eBloy+s344KBDSEZYeBZ8/iHBV856+rvepZu7i8ZpTzooKACYbdPM d X-Google-Smtp-Source: AGHT+IGBysAkMSlGutwIJyZPY6CjYO8A+UYWW9/jewErcrplxq8gOHM8xNNxDgEYNq+Se7wZICobew== X-Received: by 2002:a05:6830:7006:b0:704:b58d:377a with SMTP id 46e09a7af769-70cac86f50dmr302099a34.19.1723743064450; Thu, 15 Aug 2024 10:31:04 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af9aa5ca32sm3171877b3.69.2024.08.15.10.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:04 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:03 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 2/8] pack-bitmap: drop redundant args from `bitmap_writer_build_type_index()` Message-ID: <238ca46998e936fb5d57467aeec5d9a0b187341e.1723743050.git.me@ttaylorr.com> 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: The previous commit ensures that the bitmap_writer's "to_pack" field is initialized early on, so the "to_pack" and "index_nr" arguments to `bitmap_writer_build_type_index()` are redundant. Drop them and adjust the callers accordingly. Signed-off-by: Taylor Blau --- builtin/pack-objects.c | 2 +- midx-write.c | 3 +-- pack-bitmap-write.c | 12 +++++------- pack-bitmap.h | 4 +--- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 0ad533c045..c08a62718d 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1345,7 +1345,7 @@ static void write_pack_file(void) the_repository, &to_pack); bitmap_writer_set_checksum(&bitmap_writer, hash); bitmap_writer_build_type_index(&bitmap_writer, - &to_pack, written_list, nr_written); + written_list); } if (cruft) diff --git a/midx-write.c b/midx-write.c index 62f507eb72..b3015af07f 100644 --- a/midx-write.c +++ b/midx-write.c @@ -827,8 +827,7 @@ static int write_midx_bitmap(const char *midx_name, bitmap_writer_init(&writer, the_repository, pdata); bitmap_writer_show_progress(&writer, flags & MIDX_PROGRESS); - bitmap_writer_build_type_index(&writer, pdata, index, - pdata->nr_objects); + bitmap_writer_build_type_index(&writer, index); /* * bitmap_writer_finish expects objects in lex order, but pack_order diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 4a7d2d1370..34cdf5f150 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -101,9 +101,7 @@ void bitmap_writer_show_progress(struct bitmap_writer *writer, int show) * Build the initial type index for the packfile or multi-pack-index */ void bitmap_writer_build_type_index(struct bitmap_writer *writer, - struct packing_data *to_pack, - struct pack_idx_entry **index, - uint32_t index_nr) + struct pack_idx_entry **index) { uint32_t i; @@ -111,13 +109,13 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer, writer->trees = ewah_new(); writer->blobs = ewah_new(); writer->tags = ewah_new(); - ALLOC_ARRAY(to_pack->in_pack_pos, to_pack->nr_objects); + ALLOC_ARRAY(writer->to_pack->in_pack_pos, writer->to_pack->nr_objects); - for (i = 0; i < index_nr; ++i) { + for (i = 0; i < writer->to_pack->nr_objects; ++i) { struct object_entry *entry = (struct object_entry *)index[i]; enum object_type real_type; - oe_set_in_pack_pos(to_pack, entry, i); + oe_set_in_pack_pos(writer->to_pack, entry, i); switch (oe_type(entry)) { case OBJ_COMMIT: @@ -128,7 +126,7 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer, break; default: - real_type = oid_object_info(to_pack->repo, + real_type = oid_object_info(writer->to_pack->repo, &entry->idx.oid, NULL); break; } diff --git a/pack-bitmap.h b/pack-bitmap.h index ab20d6a0b6..d2529abadc 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -129,9 +129,7 @@ void bitmap_writer_show_progress(struct bitmap_writer *writer, int show); void bitmap_writer_set_checksum(struct bitmap_writer *writer, const unsigned char *sha1); void bitmap_writer_build_type_index(struct bitmap_writer *writer, - struct packing_data *to_pack, - struct pack_idx_entry **index, - uint32_t index_nr); + struct pack_idx_entry **index); int bitmap_writer_has_bitmapped_object_id(struct bitmap_writer *writer, const struct object_id *oid); void bitmap_writer_push_commit(struct bitmap_writer *writer, From patchwork Thu Aug 15 17:31:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765009 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (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 A898D1AC8AD for ; Thu, 15 Aug 2024 17:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743070; cv=none; b=kAsVNRIECUyEhFbVUmeogPwwWrrq5BZTbIqOiVTKG1byI0p36CYtQZGuhKWBHhwMHFRuvCPPzztfa1R5EavcTQ2dpJK0soCs5jFIZ3e0Ufkq5sOj7qgmv2sTmdcEFn/ZRoUTK6uFKq7NEk1kKQVHSXcG372KVHaXi0u7J+YXqx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743070; c=relaxed/simple; bh=qsk/+ZEBfqtYOwcRYId3MIMMQ4jpX2ZmeLaYG+XHo08=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VHE7cZxcAeeSQPzZ3t1DgGRGnkugw6eWndyYQUFr2A1hPki7eJfzMx8Ze7BeLFuiicEk4wkjb3dmkEteHImURw2Ygsm43f8+zLxSo60rQM0pn9AymntT4ejtAuKaZps4FtuexVHt0xRLw8099yJW0KYb1QFTC49qdCBKmBz6elU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=bIVDKu7v; arc=none smtp.client-ip=209.85.128.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="bIVDKu7v" Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-651da7c1531so11401367b3.0 for ; Thu, 15 Aug 2024 10:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743067; x=1724347867; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/AGCuqafwp6JTN3h3USTiyPTerSi7lVscMbMQyuEqzY=; b=bIVDKu7vvooUkWLtDPJUaUiRGvH5JzpLii/+VqC4RbT8jLEiZ/y5pUMXkxjVm7xnl2 pQPbUYQuBdg7Y+WtqgrZGXvygYTOg/x1abUsZiKQwFCvD3H5xXt6Ig1w6SYs2jXxXV0r LnYtRzTUCJtmwTYqa2/S7hNFB71sZDMmGA/XOshDcQQeBqchqN+qQSqXOJoGccKAaSuP 7JfAhufK6oIj7Pf0fPWl45T5JtJ2896ccTUPOI5VxLxkgXrsz+tAmwCogY90J9qJ1HMK 1t77DHVOVqP6C95Se18x+OUDuU4EbbmEDHbEnHRcsAbwriTFnGixrK09oUFDY7YChr9s X4iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743067; x=1724347867; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/AGCuqafwp6JTN3h3USTiyPTerSi7lVscMbMQyuEqzY=; b=fzq7OdNSlboR8Buo1D+YSaa0rrYeI7q4I/7TwE0Y1V8skn2RDUKcWeV8YZhXFeHfgR LVKWZR0vEmbOJp7J32f1Fmh1sgZDD0hCnOXhWQ/GbeWgIel3mQnsQcPe59vkCGJ6rZGV 0xSpNAac6ovPDyhbUp5e5SPde1a7g6yIMB09gZfWJozxsRC4Y6UZQPzC+UbGoXKg6kFR QIGXO5FwCpSEZAdaYGTnubkvaxck8dmLAvw3d5Fzwy0Donmb0XXk2I+W0EbrodjezW7b ChSIuzXTuCB6Wk1zBRJP4+Y0szhk/ax4qetd0nV+lHHAC4KMIz5awF/kAxCHTTKXdv/W kUOA== X-Gm-Message-State: AOJu0YzPvF3I0ap00Sg1t4Qx+X5S1nZneleZ3s9UKVVF5MzeAAY0y/ET tnGbcJW/BlOoZSivdpG3HitbAjiOeI/p1Ux7VV50xXgz5xUwGJp8OOqgDO+L6ZQEqpId7A2qp6K d X-Google-Smtp-Source: AGHT+IEIkdJtQvoCouz2OTWMy9UMggVd6m+1nlZEPFfPKauSgVM+dVqare3ah+rFRCWg1DrxFmu0eQ== X-Received: by 2002:a05:690c:4183:b0:6af:125a:1c5d with SMTP id 00721157ae682-6b1bc3f6774mr2582277b3.38.1723743067395; Thu, 15 Aug 2024 10:31:07 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af9d82757esm3197037b3.104.2024.08.15.10.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:07 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:06 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 3/8] pack-bitmap: drop redundant args from `bitmap_writer_build()` Message-ID: <5e198489fa807c551c36b391c8e8ca8efb0c52b9.1723743050.git.me@ttaylorr.com> 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: In a similar fashion as the previous commit, drop a redundant argument from the `bitmap_writer_build()` function. Signed-off-by: Taylor Blau --- builtin/pack-objects.c | 2 +- midx-write.c | 2 +- pack-bitmap-write.c | 9 +++------ pack-bitmap.h | 3 +-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c08a62718d..97090433a1 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1367,7 +1367,7 @@ static void write_pack_file(void) bitmap_writer_select_commits(&bitmap_writer, indexed_commits, indexed_commits_nr); - if (bitmap_writer_build(&bitmap_writer, &to_pack) < 0) + if (bitmap_writer_build(&bitmap_writer) < 0) die(_("failed to write bitmap index")); bitmap_writer_finish(&bitmap_writer, written_list, nr_written, diff --git a/midx-write.c b/midx-write.c index b3015af07f..1ccdf0df30 100644 --- a/midx-write.c +++ b/midx-write.c @@ -846,7 +846,7 @@ static int write_midx_bitmap(const char *midx_name, index[pack_order[i]] = &pdata->objects[i].idx; bitmap_writer_select_commits(&writer, commits, commits_nr); - ret = bitmap_writer_build(&writer, pdata); + ret = bitmap_writer_build(&writer); if (ret < 0) goto cleanup; diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 34cdf5f150..8d7437955d 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -569,8 +569,7 @@ static void store_selected(struct bitmap_writer *writer, kh_value(writer->bitmaps, hash_pos) = stored; } -int bitmap_writer_build(struct bitmap_writer *writer, - struct packing_data *to_pack) +int bitmap_writer_build(struct bitmap_writer *writer) { struct bitmap_builder bb; size_t i; @@ -581,17 +580,15 @@ int bitmap_writer_build(struct bitmap_writer *writer, uint32_t *mapping; int closed = 1; /* until proven otherwise */ - writer->to_pack = to_pack; - if (writer->show_progress) writer->progress = start_progress("Building bitmaps", writer->selected_nr); trace2_region_enter("pack-bitmap-write", "building_bitmaps_total", the_repository); - old_bitmap = prepare_bitmap_git(to_pack->repo); + old_bitmap = prepare_bitmap_git(writer->to_pack->repo); if (old_bitmap) - mapping = create_bitmap_mapping(old_bitmap, to_pack); + mapping = create_bitmap_mapping(old_bitmap, writer->to_pack); else mapping = NULL; diff --git a/pack-bitmap.h b/pack-bitmap.h index d2529abadc..0c5b83e954 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -146,8 +146,7 @@ struct ewah_bitmap *pseudo_merge_bitmap_for_commit(struct bitmap_index *bitmap_g void bitmap_writer_select_commits(struct bitmap_writer *writer, struct commit **indexed_commits, unsigned int indexed_commits_nr); -int bitmap_writer_build(struct bitmap_writer *writer, - struct packing_data *to_pack); +int bitmap_writer_build(struct bitmap_writer *writer); void bitmap_writer_finish(struct bitmap_writer *writer, struct pack_idx_entry **index, uint32_t index_nr, From patchwork Thu Aug 15 17:31:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765010 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 C85FF1AC8AD for ; Thu, 15 Aug 2024 17:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743073; cv=none; b=BmBTOlo9VeXW5p7Au0+lBNXsxKe/+aMSNWGWbvg1al8HHqwDO1lGpb9YnBKy+CPiViX6zYgD9sBWF7c4Sx8QfjWxnHfJiGN/mYOteF6ghAijtDKXKcFeP/buYi8z1bL4CgrdqtAkYav7ts7KUridFUR8a9AUtvS8i9TRRhJHrtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743073; c=relaxed/simple; bh=/SW8UQUrlGvTDTyMB1b6LQ7DJd0FzIi3k97MeO103UE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DBmYmxqVR3YhVOizQc0hbMs7bKN5SPnv9WufsmXKQTC9EfxyrVuIaANWm87hDjKwTxsvJj/KU/42RdtQK93t21VPWjoGUiSh3FGNpLG74jLICi0a3tFjb6vWBe2Et0IurWYKP2kPrU/l2he0WUYVmS5QF4EhY3DkuPAiHzOF954= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=CP1mCZMo; arc=none smtp.client-ip=209.85.219.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="CP1mCZMo" Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e0bf9b821e8so1210913276.3 for ; Thu, 15 Aug 2024 10:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743070; x=1724347870; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EPWscMb/aq/2Qly7IOYyJH1CZhpa5gjX4bW5bmLYhX0=; b=CP1mCZMoqhgWjBLpWnUrOnUS/v8lx0KygG4hnRjaI6QYMD8adV9UXP0SPf9XngynrL DD6RGc+x0U1HC1IGsQBdGtCdaMF/OZHct1hnUMI9yC9KiWMa2jFMqmQRAe2cfW6EGHVQ oAhrijKgsbIq01uZ1u4zLN4L5Tl01FjLtpgE3aROofSX7rJEXJ7Pd82GPL/pkY9KZPZ/ z/HOsok/DoxCgpSCVQG6X4dK72VVFCMgeTA6Vd6kVUKuR3TJTWFqRym0LkLuwIwwDEPM Swse9nkslmncs6hptDf23lTHYuvR31QnHVGieyG72Qma+OhuRy8FeXEcCbX2w5qPWmwR lZLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743070; x=1724347870; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EPWscMb/aq/2Qly7IOYyJH1CZhpa5gjX4bW5bmLYhX0=; b=Z3bdveAvWrRoNoKU3qpwGfX5GpjE2rl/MY0iT9FXD3f4EzAawByNIYHg75G+sNgqQh 3cyvnk5MtIXpEIV2qijMyp1e1OAd6fFexarN5GrJkJaQ+LURhFw/WrfkXIOS93ZyxWX2 Pealb+XlBVjpRSAjwnIgnSRSfaBPpgY9b5AmHQXRG0Egqzv+044puSHazMLx3TdP5PCv yKAnvF1nJt1vJDf8T25j5c9QlwHq6rZ5pdqBz3NiI0IunoFhGdoyFVO3HYihdkD9F/+/ JjaV9WR2c9egUvZjFKt7Q/L9OdiowogAnMfu/hO36Z6aCrXQQjuMRCByIZH4sXzXVJIi YcTQ== X-Gm-Message-State: AOJu0YyU1GQXm3hDhFABe35iu8TNVKPJXJFooNKpp4mOe9Nucgb0mTLk Sp95/sOJNJjX53kyPutLuQNtN1UOwzeFqjJD3Rrw4GX/FGuprI8VVVsRAtbJnuH7FnCQv8CbWej J X-Google-Smtp-Source: AGHT+IGlMN/IrpFXp0BDdkM/YY1RWx9Ba/SGIS/KrVS6ur8MhEZO34t9YZa5cnNR/8Y61D4ikHNEHg== X-Received: by 2002:a05:6902:18c4:b0:e0b:e47d:ccc9 with SMTP id 3f1490d57ef6-e1180e6b23amr592390276.8.1723743070307; Thu, 15 Aug 2024 10:31:10 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e1172031fe6sm385979276.58.2024.08.15.10.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:10 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:08 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 4/8] pack-bitmap: drop redundant args from `bitmap_writer_finish()` Message-ID: <819a0765f380e69d2ae53304214d77dcdbb7b91c.1723743050.git.me@ttaylorr.com> 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: In a similar fashion as the previous commit, drop a redundant argument from the `bitmap_writer_finish()` function. Signed-off-by: Taylor Blau --- builtin/pack-objects.c | 2 +- midx-write.c | 3 +-- pack-bitmap-write.c | 8 ++++---- pack-bitmap.h | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 97090433a1..e23c4950ed 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1370,7 +1370,7 @@ static void write_pack_file(void) if (bitmap_writer_build(&bitmap_writer) < 0) die(_("failed to write bitmap index")); bitmap_writer_finish(&bitmap_writer, - written_list, nr_written, + written_list, tmpname.buf, write_bitmap_options); bitmap_writer_free(&bitmap_writer); write_bitmap_index = 0; diff --git a/midx-write.c b/midx-write.c index 1ccdf0df30..d2d13447af 100644 --- a/midx-write.c +++ b/midx-write.c @@ -851,8 +851,7 @@ static int write_midx_bitmap(const char *midx_name, goto cleanup; bitmap_writer_set_checksum(&writer, midx_hash); - bitmap_writer_finish(&writer, index, pdata->nr_objects, bitmap_name, - options); + bitmap_writer_finish(&writer, index, bitmap_name, options); cleanup: free(index); diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 8d7437955d..346fb29513 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -998,7 +998,6 @@ void bitmap_writer_set_checksum(struct bitmap_writer *writer, void bitmap_writer_finish(struct bitmap_writer *writer, struct pack_idx_entry **index, - uint32_t index_nr, const char *filename, uint16_t options) { @@ -1031,12 +1030,13 @@ void bitmap_writer_finish(struct bitmap_writer *writer, dump_bitmap(f, writer->tags); if (options & BITMAP_OPT_LOOKUP_TABLE) - CALLOC_ARRAY(offsets, index_nr); + CALLOC_ARRAY(offsets, writer->to_pack->nr_objects); for (i = 0; i < bitmap_writer_nr_selected_commits(writer); i++) { struct bitmapped_commit *stored = &writer->selected[i]; int commit_pos = oid_pos(&stored->commit->object.oid, index, - index_nr, oid_access); + writer->to_pack->nr_objects, + oid_access); if (commit_pos < 0) BUG(_("trying to write commit not in index")); @@ -1052,7 +1052,7 @@ void bitmap_writer_finish(struct bitmap_writer *writer, write_lookup_table(writer, f, offsets); if (options & BITMAP_OPT_HASH_CACHE) - write_hash_cache(f, index, index_nr); + write_hash_cache(f, index, writer->to_pack->nr_objects); finalize_hashfile(f, NULL, FSYNC_COMPONENT_PACK_METADATA, CSUM_HASH_IN_STREAM | CSUM_FSYNC | CSUM_CLOSE); diff --git a/pack-bitmap.h b/pack-bitmap.h index 0c5b83e954..ff0fd815b8 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -149,7 +149,6 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer, int bitmap_writer_build(struct bitmap_writer *writer); void bitmap_writer_finish(struct bitmap_writer *writer, struct pack_idx_entry **index, - uint32_t index_nr, const char *filename, uint16_t options); void bitmap_writer_free(struct bitmap_writer *writer); From patchwork Thu Aug 15 17:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765011 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (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 8629A4AEEA for ; Thu, 15 Aug 2024 17:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743076; cv=none; b=n7VGJGP0XgbMguAtzuEe41qAQH05T9FgaqgVgu5Vh85ZNW19kPdMtHu3qQBkareZh2rw4lX0dfAtj1k25FuMgMU2lDEEsah7HBviGleN4oDq76EtLNBVkUkWc73NpPLi0cdtW0ssQQwoKzM3VLewD1QQ3YBXDt16Ouuc3+j8vVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743076; c=relaxed/simple; bh=cGB+kZ1Lv5bxlSgmP9X68KGd8Nd6D1/JFoOo4+Ar5Ow=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z0NVes178e+cbQQ74vXrZvY+T5rN/JY8P877Q3pwmyqOZ6eajmiTkax19aImeFkjlfsPt50r9+/h7Kf8uNhsY64zRsJG5vOEf+UgXkdCLR5heIQNt5NchZq1SrYEZ+1LLhPbTcaTmq/BBzF8TVts5k482T8UVr+9IKRYyzwtF/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=B/db3fQa; arc=none smtp.client-ip=209.85.128.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="B/db3fQa" Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-6aef423f80aso11742907b3.2 for ; Thu, 15 Aug 2024 10:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743073; x=1724347873; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vf187ru7pWdoDefzHhSdkxX6HKrnt2ZpTFICpPJNfEE=; b=B/db3fQatNgnuWvMe/bcBK94oFH0jwkGclxQ596yc8IsdlEsz5KsurRqOOx5tFV6yN szWUhGHaWsx7Lxa2noIIxPLan3SZmQA4AhQ++POWiXOy9J6+jfb36NeUtelKnHq+aAZr FUYeNu0RKq7ZfSE0PB71/QjzJxzNsmVFtEbGFfhDlOxLbEi/11glkrV0T4CAtHoLCX7N 2XX7NXIEbJ+zMg/NDsnTRIhiiINuNsp1Wt+Xi+8015gjTAp6kErn0XNedVbsCoO2Udsz 6/3a9m3uC/cwZ/t2fOP46QR9ETctyfGE0SrJuv/PoHq1YeoU1MM1inkA1snjN18rJMhk Uknw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743073; x=1724347873; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vf187ru7pWdoDefzHhSdkxX6HKrnt2ZpTFICpPJNfEE=; b=cEPw4Y65suz0OEk8WInjPmJmNUL1VH37+l62Wzt6WWk7cD5y+8O5D/EHi4rBpAzW6E ZJlTSxSWyf9Foc0nwpFzNh/uEkcXsTeIFmhD3fVlysoXeRW5hj5Mohe5mUgMeFCiQBcY PF0KDXv+kHOUx6bHFCrotUYbKRmZTRlNJJ5DNMPcI1YYRpa5hCMOU/U0O0H7lT9juc53 0jA+JNgx4f3KKDtWnfuvTMUlpTbhvhaGilFNkH13ztoEI0SZT6ES/PHHE/sZZ+fbn6gB qcmf50bKNHVl56EIoDkVAIagRPMsKwmUGo14P8A5oSKpvFzBW3p/BhWak5gVkGDbeVEm /aqw== X-Gm-Message-State: AOJu0YxmZI9LN2+5CJ56yjzr2XEGnoktgyw6bEPm5dWgxpYET+eap+XF cz6AUQqJdi7JPfPliIY27Sy+eqd8Oobz9mCt4814iZK+lPhw4KiFm2BseM5ZabeQSV3vM82kh98 z X-Google-Smtp-Source: AGHT+IESDkDGKgkkX/2qSKsmQiQ54pUD1TxvaJQr3SEGk5iiXDqzNl6iC6+30ELFXPU4FTAqDmnS0g== X-Received: by 2002:a05:690c:d88:b0:61b:1f0e:10 with SMTP id 00721157ae682-6b1b73a7db9mr4087147b3.4.1723743073265; Thu, 15 Aug 2024 10:31:13 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af99506d83sm3247587b3.9.2024.08.15.10.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:12 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:12 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 5/8] pack-bitmap-write.c: select pseudo-merges even for small bitmaps Message-ID: <0fea7803d86ca17451af408e1bf93c32690edc44.1723743050.git.me@ttaylorr.com> 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: Ordinarily, the pack-bitmap machinery will select some subset of reachable commits to receive bitmaps. But when there are fewer than 100 commits indexed in the first place, they will all receive bitmaps as a special case. When this happens, pseudo-merges are not generated, making it impossible to test pseudo-merge corner cases with fewer than 100 commits. Select pseudo-merges even for bitmaps with fewer than 100 commits to make such testing easier. In practice, this should not make a difference to non-testing bitmaps, as they are unlikely to be used when a repository has so few commits to begin with. Signed-off-by: Taylor Blau --- pack-bitmap-write.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 346fb29513..923f793cec 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -694,6 +694,10 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer, if (indexed_commits_nr < 100) { for (i = 0; i < indexed_commits_nr; ++i) bitmap_writer_push_commit(writer, indexed_commits[i], 0); + + select_pseudo_merges(writer, indexed_commits, + indexed_commits_nr); + return; } From patchwork Thu Aug 15 17:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765012 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (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 75BB84AEEA for ; Thu, 15 Aug 2024 17:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743078; cv=none; b=k/cJQylCHWYxCLx4mkHnac5mBrt+1mRekkCXsTgsO5X0myGkrlmxBNlcf95tjQlouVE1aj3fSZc4d+OVs3g89qteoBsdIYwXOBm3CInBrZf9nZ2HsYCzT0MTVgAIea6TT/DW1JEBm182cCoCOGUfFEK/takgs1VcimZRySNY4HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743078; c=relaxed/simple; bh=Nr5Z2kew+QpEn3+4VLaZQPLpjx5mYN0DeYGK6magg6I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X7NjvKVHWaf8WE9AhC4jiArtEf4MiI4WBFsRWMBwJfax4PPMCpkzOSROk7L0MxDBHrVFNNRAWUxJa3Auc3LVRFo1sR4DOUPQu5ogzFnOyE19e0obnKZ/5du1dd0eHKHOcjrRARBGs84zFHMlR0dovPwkVn2DPZZDpT0hLXsl1Cs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=A8DJLF8T; arc=none smtp.client-ip=209.85.219.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="A8DJLF8T" Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-e116ec43a4aso1155399276.0 for ; Thu, 15 Aug 2024 10:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743076; x=1724347876; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=m4/kWMUw2xb5GB9hIUG4yLHC04UvXICmVmSy4PuVeIE=; b=A8DJLF8TVIWqjmn5bguoykf6LbBj2g6QM2yiQQEtXk95YnAS7yP13vC2n1m4f/mDKM Zw/x1RgYhBnIo5ebsOB62qOvqkzpG6q/X4zAK7fekmo7AZYnsdfWpANJjw4AuNjFiItW gohA/h81rN7PnvAA9VEcA5X7Js5WaQ7iepHKOuL3GVha+mJCBQsEnH1qicEuNLwVvRJl vhHaaCkXVMVvCEVU96Gqoy4hxLbGLqrB3jlaBav6KMne2V2bZxB8yFA8IfQvT31Q0pRR XTdNcPgGXdZmAqQ44WO3rOkdGIv+s/4u6wAjKMMLK7po/NQfxR8vwR4YzrpVxU2ILi7y TbIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743076; x=1724347876; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=m4/kWMUw2xb5GB9hIUG4yLHC04UvXICmVmSy4PuVeIE=; b=kQsnZsoAvi0W8db71i2We07vYayy7DzoTS/BOxkiwwKWgGNxkjWiUb1WL7Id2gcP5k PKqTmxo68SvyE6hzLxuV29DMKWlBMxuml0/PZYgtfZBz6Pe2hf5xeE4PLaHMS3XjmWms Gz10tgeMozN2vrP5u1yRMHtt3dmsxthhzHIFkZgQgWpvy1vq+gaoNRKElLhIQ16PVkmX 4AwdeA/krAsptIX4TDQRDs5fZ02cbJuTuVq86HyLYRbI0IZh/74O9te91C64Q40FSwo+ a4lxdxFSGh9UP9FogRy/jgdd4XV0Cx/QUHui3cVW+7GyKZGjRpY6zr2YTLWFSxuAknl8 zUCA== X-Gm-Message-State: AOJu0YzBUCVVwRMgl0v5WtBx1C9jf64oPW+3SIDTzjUIy42DqYHcUNNr J3lDQnik5F8ULG2/dGKno0sarMGrsfLY/EuuXVVk6GCA9moVv1i9mgwoxC2826B+T/N5p3te0+a O X-Google-Smtp-Source: AGHT+IHCZdvWMkRd4fDkgXFuxADH13+UR5mgr5KQgRNjysWX9QYTMtazaoVDFvin1069RP6ptEXcDw== X-Received: by 2002:a05:6902:240a:b0:e11:7e70:a9b2 with SMTP id 3f1490d57ef6-e1180fa47bbmr573343276.42.1723743076181; Thu, 15 Aug 2024 10:31:16 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e1171e09693sm388320276.4.2024.08.15.10.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:15 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:14 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 6/8] t/t5333-pseudo-merge-bitmaps.sh: demonstrate empty pseudo-merge groups Message-ID: <228553e412fc3020a6f24eea601c47a08d70a2bf.1723743050.git.me@ttaylorr.com> 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: Demonstrate that it is possible to generate empty pseudo-merge commits in certain cases. In the below instance, we generate one non-empty pseudo-merge (containing commit "base"), and one empty pseudo-merge group (corresponding to the unstable commits within that group). (In my testing, the pseudo-merge machinery seems to handle empty groups just fine, but generating them is pointless as they carry no information.) This commit (introducing a deliberate "test_expect_failure") is split out from the actual fix (which will appear in the following commit) to demonstrate that the failure is correctly induced. Signed-off-by: Taylor Blau --- t/t5333-pseudo-merge-bitmaps.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index f052f395a7..0288691340 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -390,4 +390,24 @@ test_expect_success 'pseudo-merge reuse' ' ) ' +test_expect_failure 'empty pseudo-merge group' ' + git init pseudo-merge-empty-group && + ( + cd pseudo-merge-empty-group && + + # Ensure that a pseudo-merge group with no unstable + # commits does not generate an empty pseudo-merge + # bitmap. + git config bitmapPseudoMerge.empty.pattern refs/ && + + test_commit base && + git repack -adb && + + test-tool bitmap dump-pseudo-merges >merges && + test_line_count = 1 merges && + + test 0 -eq "$(grep -c commits=0 X-Patchwork-Id: 13765013 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 56B394AEEA for ; Thu, 15 Aug 2024 17:31:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743081; cv=none; b=FMo6/ZPsz+wF3z2qfgibOz8k+L6xEpsdc/N8wlnxVMBaneeusqRxjJVXW1LSexv/zjWrfTlMiEOxov53zFKq2YVYc3LZwios+yAHAbNpRlPT8Yno5aAFWg/KHqr5xAhc878yzIWyiQn4JFx6hishmONijqh5x7WdvQfjBeEDOyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743081; c=relaxed/simple; bh=EWML87h6ljJXrIlxO9LFVvpFdZbaI1U/3r8cSLaNKus=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SxJwSWNKsNKumyKsNY0qsitOFJO5FmG8ktY7zvxpBy5U1I2yKVAhoXc2sE+2mVQlftoCvlpmMOt9l1A7NtnQ0GwgGyiQj2LH69Ngvw++bcdfv3yvP1hKXPE8ydx+vR23qijIxJZeMIxyDmDYpMaUKndip9EfJ398/VDOT4WAsfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=cOgI56Do; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="cOgI56Do" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e116a5c3922so1164363276.1 for ; Thu, 15 Aug 2024 10:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743079; x=1724347879; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BJ8Z7O/zPtyXpw4716G96D3gWfWki+pC0qTXiuxwIIY=; b=cOgI56DoZdktdZ+9BcEIeXqvn45F1kjEpa7rzsOa0cTYyjOGUrKlxGM93SFY7R2ey4 qxlfasQtYRCow0xb9jSUhxxMUPRN6LNO30wc4/14RzathvJHACYB0VpHq7zSJWCeeMG7 2GWuJ+s/6SbBXrKKFVJYBag0+Nys29A/gkaQpW1lcpfTp8TkVwEvuOG/jUHQ098bRouV 1BSGgElhL+VnFLlLWxZWrOnash0MgKSHlmi14kmR4fcoYmk1SP74z/o19YKPRnALCxX5 CWJw/4NA9SthdtWlItRSbi9CK/GUWOoyECPZc9jhb9xIo7SIwiHaucnqBkA8TfPXkjh4 mEBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743079; x=1724347879; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BJ8Z7O/zPtyXpw4716G96D3gWfWki+pC0qTXiuxwIIY=; b=JDz2iBWZr4IqaxCZ3nrJ/3ZmtmNPyM5WG46kqxGb6oHZre/2eKTX2qZ6oOmy0v3mTi pAAGlQog00Mco5odKPWy5uSQi1xTeszvsW4kltNHq/+nrYbaiPz7i5f24qZstWX66Vv/ NY+Rxwgqa3sCF9gOG3ut5TKiKBPqk05LLZjJyNB0Z7PBHcdRF9ohiEfhOGx/PN2lvboD VjPzud5CPxLQ0DfFBCwEfluDT+jTAbtBuSpH0DFF2r2UJ77DTEuSqvHSRdL03KommgjN M2HDuHc/w7JFV2s0o83CeM3Yw5ZonxY9fkl/c5t8YZXn/d01Br5dQkfG6aYjMJyWK2yF A/aA== X-Gm-Message-State: AOJu0Yw7OIInTMojNccHHdrrxKicx5oYT17QFQom1qqTyD9/6vHyXIGC cuX1AyfaCAAbywlRVZzeSrU7QKT2oAbmHei1UW7qROdMeeAuoFS5NdcV7j4Z830evXEdDSMDbjP 3 X-Google-Smtp-Source: AGHT+IGw8Uv3nwE9UYP8JZAIKPpnQ7R3vjZRv7n/StrO+cj09eX6yvvg04YE8BjrlJzaB4U1mAlmeA== X-Received: by 2002:a05:690c:48c4:b0:6b1:9815:b51f with SMTP id 00721157ae682-6b1b9594722mr4466347b3.24.1723743079112; Thu, 15 Aug 2024 10:31:19 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af99410fc4sm3238537b3.13.2024.08.15.10.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:18 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:17 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 7/8] pseudo-merge.c: do not generate empty pseudo-merge commits 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: The previous commit demonstrated it is possible to generate empty pseudo-merge commits, which is not useful as such pseudo-merges carry no information. Ensure that we only generate non-empty groups by not pushing a new commit onto the bitmap_writer when that commit has no parents. Signed-off-by: Taylor Blau --- pseudo-merge.c | 11 +++++++---- t/t5333-pseudo-merge-bitmaps.sh | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pseudo-merge.c b/pseudo-merge.c index f0fde13c47..6422be979c 100644 --- a/pseudo-merge.c +++ b/pseudo-merge.c @@ -357,8 +357,10 @@ static void select_pseudo_merges_1(struct bitmap_writer *writer, p = commit_list_append(c, p); } while (j % group->stable_size); - bitmap_writer_push_commit(writer, merge, 1); - writer->pseudo_merges_nr++; + if (merge->parents) { + bitmap_writer_push_commit(writer, merge, 1); + writer->pseudo_merges_nr++; + } } /* make up to group->max_merges pseudo merges for unstable commits */ @@ -398,8 +400,9 @@ static void select_pseudo_merges_1(struct bitmap_writer *writer, p = commit_list_append(c, p); } - bitmap_writer_push_commit(writer, merge, 1); - writer->pseudo_merges_nr++; + if (merge->parents) { + bitmap_writer_push_commit(writer, merge, 1); + writer->pseudo_merges_nr++; } if (end >= matches->unstable_nr) break; } diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index 0288691340..aa1a7d26f1 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -390,7 +390,7 @@ test_expect_success 'pseudo-merge reuse' ' ) ' -test_expect_failure 'empty pseudo-merge group' ' +test_expect_success 'empty pseudo-merge group' ' git init pseudo-merge-empty-group && ( cd pseudo-merge-empty-group && From patchwork Thu Aug 15 17:31:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13765014 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (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 AF65F47A4C for ; Thu, 15 Aug 2024 17:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743085; cv=none; b=C5bO/atlbegKyR4msv0M4PC9cZQPIcq5dS3ROg62nr6pL0Xl8uDuZo2pJM0FLpIv1Cp2/3d9oEHnVRA/OqNk3t/fPiIuY6+7P7pcxm3uNS9NkRqcVmUlFp4q0ix6SqT96JstHHTJOxjgc9jOwxafyJBJhc1NTf1mUKY2RWa/S1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723743085; c=relaxed/simple; bh=Fd7qy4t3TDkFYCO6yq/P53pNTWe82vC1BWxAnCODuGg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XNg/04li2BksbZ5AMdw/2xEC7MhrM6jOg7p8rK6f4U7mpim7OqWlSDDRwRS7hk4SYcIra7YNFEqeor8A5psiXed1JIw82PZUT2Ms3VuYYPsJwzfoj6F7WpJqy7vewAa8krl0wt5BJK5OOx1JwXVggcad1KlnrZJICRg/vyS1414= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com; spf=none smtp.mailfrom=ttaylorr.com; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b=V/2SAAxv; arc=none smtp.client-ip=209.85.128.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ttaylorr.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20230601.gappssmtp.com header.i=@ttaylorr-com.20230601.gappssmtp.com header.b="V/2SAAxv" Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-66599ca3470so11713077b3.2 for ; Thu, 15 Aug 2024 10:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1723743082; x=1724347882; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4LsIPCqLZSt0MQqlrgXtc1uo3Darr6zqOp+4k0akDmo=; b=V/2SAAxvo0qWh6pVjtWjOaESwqCoa673rc6I927ekoo2KYZJujz9CgW9eLAb1PuIoK 7pLyf3f3O6M6zTBCIJ/+RIv9Cvb8P6jtybrPxKL0T31R6U4S5BhUbXf+6K9i9koDBqXA wSoOhwubu+GZQbaS0owrSOJs/kHqsjukqJpa6XU6r4gEj/zaoWEwQ5rrXt1vJcFm6ACx HHUo83sdK+TTZtdBCc7syz+SEsby4LGLh/wFeKXE9ZkmlhFlBznfZpuzl6Ey7mPzVeKI xUVYVM7D6OUA9olDN7UATyHydVO5Re/VVdfyZJy6HgFrXW+PZUzST4yEokSim7ka4qlx g52w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723743082; x=1724347882; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4LsIPCqLZSt0MQqlrgXtc1uo3Darr6zqOp+4k0akDmo=; b=XnArnQ/8xPpIHXQiVjDz7+4TSaFDsANl+nJGxTZ0nSZ5yDtUhg6jH/A78kx81AVMc5 +V4LWoRmOJi4CpQQ3G2wcyX406PRPAs5wc56JAUUbcdJwo0JT1MsPozCRNcXqkjTILyW 0VHz59axw4ieXK5zKS4g87qGUONumN95EVQCaq3PlH9Q80VpkBYheBNLOzgzso/4RO6F mBW/OVFoyfbSgwQICtMwecXXwvQtRNcBEpOMMX8xNbkgp+nP2s+DZUcun+ekVW/gGfo1 N8wip8aElOjrlnD1VgMiQ2PoMUtdE16p7q43YI85b0Dro/3abfd1t3OvSv8lUzk5kqph lzTQ== X-Gm-Message-State: AOJu0YwoIoVkqd1Gt5WRDiQPuidPOXzdHCSW7BoOdgIz6IZhTB/YbfI8 y4zsCakWYK2cLZzD9xVVARtAGbHG8F8MCaXanh46X3G871I8ZC0tmhplRN8ZyydpY/k7MRp0upK u X-Google-Smtp-Source: AGHT+IESMl3Y6fiK917WzAIJi/2tqKilnqGJmHQSzsZEr8F6cXZsSu3I8BUsUuLo1VEAjJrzcNs4FQ== X-Received: by 2002:a05:690c:d1a:b0:64a:3e36:7fd1 with SMTP id 00721157ae682-6b1ba5f82f5mr3587337b3.10.1723743082050; Thu, 15 Aug 2024 10:31:22 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6af99db3f95sm3185927b3.30.2024.08.15.10.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 10:31:21 -0700 (PDT) Date: Thu, 15 Aug 2024 13:31:20 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH 8/8] pseudo-merge.c: ensure pseudo-merge groups are closed 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: When generating pseudo-merge bitmaps, it's possible that concurrent reference updates may reveal some pseudo-merge candidates which reach objects that are not contained in the bitmap's pack or pseudo-pack order (in the case of MIDX bitmaps). The latter case is relatively easy to demonstrate: if we generate a MIDX bitmap with only half of the repository packed, then the unpacked contents are not part of the MIDX's object order. If we happen to select one or more commit(s) from the unpacked portion of the repository for inclusion in a pseudo-merge, we'll get the following message when trying to generate its bitmap: $ git multi-pack-index write --bitmap [...] Selecting pseudo-merge commits: 100% (1/1), done. warning: Failed to write bitmap index. Packfile doesn't have full closure (object ... is missing) Building bitmaps: 50% (1/2), done. error: could not write multi-pack bitmap , and the attempted bitmap write will fail, leaving the repository without a current bitmap. Rectify this by ensuring that the commits which are pseudo-merge candidates can only be so if they appear somewhere in the packing order. This is sufficient, since we know that the original packing order is closed under reachability, so if a commit appears in that list as a potential pseudo-merge candidate, we know that everything reachable from it also appears in the list (and thus the candidate is a good one). Noticed-by: Jeff King Signed-off-by: Taylor Blau --- pseudo-merge.c | 2 ++ t/t5333-pseudo-merge-bitmaps.sh | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/pseudo-merge.c b/pseudo-merge.c index 6422be979c..7ec9d4c51c 100644 --- a/pseudo-merge.c +++ b/pseudo-merge.c @@ -217,6 +217,8 @@ static int find_pseudo_merge_group_for_ref(const char *refname, c = lookup_commit(the_repository, oid); if (!c) return 0; + if (!packlist_find(writer->to_pack, oid)) + return 0; has_bitmap = bitmap_writer_has_bitmapped_object_id(writer, oid); diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index aa1a7d26f1..1dd6284756 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -410,4 +410,40 @@ test_expect_success 'empty pseudo-merge group' ' ) ' +test_expect_success 'pseudo-merge closure' ' + git init pseudo-merge-closure && + ( + cd pseudo-merge-closure && + + test_commit A && + git repack -d && + + test_commit B && + + # Note that the contents of A is packed, but B is not. A + # (and the objects reachable from it) are thus visible + # to the MIDX, but the same is not true for B and its + # objects. + # + # Ensure that we do not attempt to create a pseudo-merge + # for B, depsite it matching the below pseudo-merge + # group pattern, as doing so would result in a failure + # to write a non-closed bitmap. + git config bitmapPseudoMerge.test.pattern refs/ && + git config bitmapPseudoMerge.test.threshold now && + + git multi-pack-index write --bitmap && + + test-tool bitmap dump-pseudo-merges >pseudo-merges && + test_line_count = 1 pseudo-merges && + + git rev-parse A >expect && + + test-tool bitmap list-commits >actual && + test_cmp expect actual && + test-tool bitmap dump-pseudo-merge-commits 0 >actual && + test_cmp expect actual + ) +' + test_done