From patchwork Tue Oct 31 19:24:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13442228 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 178EB22326 for ; Tue, 31 Oct 2023 19:24:13 +0000 (UTC) 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="u/WMn+mA" Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6876C2 for ; Tue, 31 Oct 2023 12:24:10 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-418201cb9e9so43240851cf.0 for ; Tue, 31 Oct 2023 12:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1698780249; x=1699385049; 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=AYqrhhnCNMqvd4t5kEM7gTmsRYUTv9t7HjT+F5v7xkE=; b=u/WMn+mAd57yvYOynhagtMsjWne2J9K36B3tD24XMH16J5lkBm4oOYKA405vRfHS1W ApCs3WBv2pV3fl6TpZueP2v3yhJIh/iPnEYxQX7DgDZnEdNzSMjS1tpgG6B6vtp85umN MFbYNRc1HX1Dctd3D6id6dMlxIdZopBdm+DSh6pviRw8xyfG0I2rkcqykZ9u+HcpTkKe 8xb1Izma34t4ekoaxnnfyWind+/M5LeC3GdGYatNV+ESAYSt12ugF1HhJ/s/Fao+Mcz1 byi4ZGanhwKKitSeR8M/DdXNpo9FQD2LCMBhIZsxHXJqN9DMr2FGCjeFvkg3figDg9Ce JI3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698780249; x=1699385049; 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=AYqrhhnCNMqvd4t5kEM7gTmsRYUTv9t7HjT+F5v7xkE=; b=q/3l3BXH8oKZQ1V1hVRUeWYKGVWh8Ke2TPCzkcXUSfBh+j0XGsbzyQSnfkCPenx1GA QCIqR7ZTjIKemuRWjpI1gK8cYrnnLUc7S2WeyiS8NUs7PHkinfAcBTLq4OsNxejWvtzD 8kdj5/V52CtVI/G6T2DaYsn4DLZrmGYSFIcpAUjW/SK0I4h7bf2H9/fp40+A3lmI8fZw mtYjSBXxXMT4LgROc4zwKL9sw+4ILrZHzGgNjWeC6iK7be5IFdHTDwixdlb7+HdJDM2B Dxlzf0Czkh4RP1PfgtR8nOhP+byZHeJ6ox3dZldeBb6xMc7jCXYL9zHMQkJo7E6Xtlw0 P4Gg== X-Gm-Message-State: AOJu0YyFnFggOQV+aT4kxsb2fnH+/z5N5I8Da7pWlEE9UcBnOguAsR8M ZpFrkOu6jYVfiK5nab2JupFp+xamr/c8tywQGM4y9w== X-Google-Smtp-Source: AGHT+IFUSRqulltaEUvDKCaKNVxSzfrFaWXHPrB6qh+e0OQvqcewF1T3Ta93nEc3lVwGeFG8GFXB7A== X-Received: by 2002:ac8:4e47:0:b0:417:d340:c426 with SMTP id e7-20020ac84e47000000b00417d340c426mr17541834qtw.9.1698780249504; Tue, 31 Oct 2023 12:24:09 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id c10-20020ac84e0a000000b00410ac0068d0sm737069qtw.91.2023.10.31.12.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 12:24:09 -0700 (PDT) Date: Tue, 31 Oct 2023 15:24:08 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH v2 1/2] Documentation/gitformat-pack.txt: fix typo Message-ID: <92e9bee4ad39906c773e4a6eba84ec1ebf8c1d3b.1698780244.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: e0d1bcf825 (multi-pack-index: add format details, 2018-07-12) describes the MIDX's "PNAM" chunk as having entries which are "null-terminated strings". This is a typo, as strings are terminated with a NUL character, which is a distinct concept from "NULL" or "null", which we typically reserve for the void pointer to address 0. Correct the documentation accordingly. Signed-off-by: Taylor Blau --- Documentation/gitformat-pack.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/gitformat-pack.txt b/Documentation/gitformat-pack.txt index 4a4d87e7db..c4eb09d52a 100644 --- a/Documentation/gitformat-pack.txt +++ b/Documentation/gitformat-pack.txt @@ -390,7 +390,7 @@ CHUNK LOOKUP: CHUNK DATA: Packfile Names (ID: {'P', 'N', 'A', 'M'}) - Stores the packfile names as concatenated, null-terminated strings. + Stores the packfile names as concatenated, NUL-terminated strings. Packfiles must be listed in lexicographic order for fast lookups by name. This is the only chunk not guaranteed to be a multiple of four bytes in length, so should be the last chunk for alignment reasons. From patchwork Tue Oct 31 19:24:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 13442229 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 DF9202232F for ; Tue, 31 Oct 2023 19:24:16 +0000 (UTC) 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="aXdURaxE" Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84855DA for ; Tue, 31 Oct 2023 12:24:13 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-66d17bdabe1so41308636d6.0 for ; Tue, 31 Oct 2023 12:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20230601.gappssmtp.com; s=20230601; t=1698780252; x=1699385052; 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=QV3MfU+4pZ9NCMCn3YWPZ/3pv6aBO4+VZTyDwmW4+Ec=; b=aXdURaxEtipiVMth1bMJWBlGp1RqOWrsJuikN0uhiAlkhgO/vjhex6mEfZff4eVwxU QHacOG0OdPC/2zPrvZUsPZMbtubw4fibY5GHjIcrrGYOrlkh9peTG3zDtENWMFRS3OmE TsOm1KY4w/ljDc9Tmtwb7bkElAhAixUMsm/ZLF3UkarPcPTkzMVFWB2dQ2SChgr0gIZO CDH+WmlpVEQqibkWNzilW7W5ePXLhAfV4uJj13L8l6zG4KyqxCJKG4rjWAJL630ANdls YqX3GwzzeZZq8eYrCr759UMss37jJ7xAxjDuNeqQeT2L9rkjyxo+KqSJFzAnhnCVjBpe LFgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698780252; x=1699385052; 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=QV3MfU+4pZ9NCMCn3YWPZ/3pv6aBO4+VZTyDwmW4+Ec=; b=sIGR2+dG3dMnSZVShAqza254dQSeud9UgZ9u82b2dud4os5X6HKyiRfxKQMxyS0+sn Fs2IhOqv6b9on9pxLu7pbGmkm56SoYfY+m7TSzd8zJk7ax5qJE9OuOppQTneOC660kXB zFYsBgWM9QNQsOhP6Ac6Chgc7qkqbE5FLMEMKOjh2gtRKM/wKc3Hhw9AjL8FlTXj5Fki 3IrYXzpgHORfoFDVmWVQFaueRUn5b6ehVUOUm6Cq3/A6YjKJd1fG436ODGBOf7ilGxh8 5qSIAxv4ujKDxuACgos8M+qjBbQJo2csSnGEkrpchVYDB4CwCyD+plpwDASfovjtdw0B LJFg== X-Gm-Message-State: AOJu0YwBlnjccQ2Q6E53qYm0ybWxYzxOnZnqH+aHO/RIZrlU2IMbST19 B6zk6v2s4XLoOn51BMLulWqAMgGOqynzHXs20GHveg== X-Google-Smtp-Source: AGHT+IEmfDkCG2onlCmUZzaJqMwbp5CnHmY61902sL6NGtiTVdzvC63eddQ9zYiCQ/3NQwOGbX6GXA== X-Received: by 2002:a05:6214:2508:b0:66d:3f8b:fd93 with SMTP id gf8-20020a056214250800b0066d3f8bfd93mr16374085qvb.2.1698780252329; Tue, 31 Oct 2023 12:24:12 -0700 (PDT) Received: from localhost (104-178-186-189.lightspeed.milwwi.sbcglobal.net. [104.178.186.189]) by smtp.gmail.com with ESMTPSA id i26-20020a05620a145a00b0076e1e2d6496sm754840qkl.104.2023.10.31.12.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 12:24:12 -0700 (PDT) Date: Tue, 31 Oct 2023 15:24:11 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH v2 2/2] Documentation/gitformat-pack.txt: fix incorrect MIDX documentation 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: Back in 32f3c541e3 (multi-pack-index: write pack names in chunk, 2018-07-12) the MIDX's "Packfile Names" (or "PNAM", for short) chunk was described as containing an array of string entries. e0d1bcf825 notes that this is the only chunk in the MIDX format's specification that is not guaranteed to be 4-byte aligned, and so should be placed last. This isn't quite accurate: the entries within the PNAM chunk are not guaranteed to be 4-byte aligned since they are arbitrary strings, but the chunk itself is 4-byte aligned since the ending is padded with NUL bytes. That padding has always been there since 32f3c541e3 via midx.c::write_midx_pack_names(), which ended with: i = MIDX_CHUNK_ALIGNMENT - (written % MIDX_CHUNK_ALIGNMENT) if (i < MIDX_CHUNK_ALIGNMENT) { unsigned char padding[MIDX_CHUNK_ALIGNMENT]; memset(padding, 0, sizeof(padding)) hashwrite(f, padding, i); written += i; } In fact, 32f3c541e3's log message itself describes the chunk in its first paragraph with: Since filenames are not well structured, add padding to keep good alignment in later chunks. So these have always been externally aligned. Correct the corresponding part of our documentation to reflect that. Helped-by: Junio C Hamano Signed-off-by: Taylor Blau --- Documentation/gitformat-pack.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/gitformat-pack.txt b/Documentation/gitformat-pack.txt index c4eb09d52a..9fcb29a9c8 100644 --- a/Documentation/gitformat-pack.txt +++ b/Documentation/gitformat-pack.txt @@ -390,10 +390,11 @@ CHUNK LOOKUP: CHUNK DATA: Packfile Names (ID: {'P', 'N', 'A', 'M'}) - Stores the packfile names as concatenated, NUL-terminated strings. - Packfiles must be listed in lexicographic order for fast lookups by - name. This is the only chunk not guaranteed to be a multiple of four - bytes in length, so should be the last chunk for alignment reasons. + Store the names of packfiles as a sequence of NUL-terminated + strings. There is no extra padding between the filenames, + and they are listed in lexicographic order. The chunk itself + is padded at the end with between 0 and 3 NUL bytes to make the + chunk size a multiple of 4 bytes. OID Fanout (ID: {'O', 'I', 'D', 'F'}) The ith entry, F[i], stores the number of OIDs with first