From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793005626; b=ZWhiYBSK/IUkApWkp5nZ0hlprKeY7LRvY4oM8tPRr9ptGs4S09FIlOWpjAbFKAl/Us6l YbjtEUr3hYXQibEk+5jGHT/tQW2OmvgBZxBFpHE26R7loGPtGggmqUEfAA18FpWiF6x5Z a7Gf5FIMiScL7kfCJQVVXgdK2oOZKYNqT0hKlSB6r6wx/6CuQZTY+oip8EeIvswd6oiTo ItQ4Lm2MA8J+sIRTdmggtKeNv2xJX0v/XAUUdxJxraZ3K536d5dtlddPBt5DqSf/UJeVX zbVe7Rnwgy3V3h3sacC0rju5J7N/kje05hX2xIyqBrCkHhT1hF3rYbFRTXKuvXXbNsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793005626; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To: References:From:Date:Subject:Fcc:Content-Type: Content-Transfer-Encoding:MIME-Version:To:Cc; bh=JDL3hXrxiyYT7g7r/FBmNwS1zM1Uj5hccHKVyhjiIx0=; b=u6VzHt1tPgZxeMtfp7wt6cvL216MZTTBKSGV2E16y5ZQUdGtJ1hRz/feOsM5ndTpsmJo xuPLBLefrHLW7CVKUY0oEu43F83UHYV/novbcD3JVXK49Zdt3q6wvC1J4CMG7TIINcHAK 3yzt0iUi/RBCsdxcqevJDwoiGn8THD5uU+Ko4n+fAoPBjH0h/V1puBH0cJiF194OW5cg+ zFsaRjFfNivozyc+giLVM6xcXz2bwXAuzmrAlFEKyYxw6Xnl2qidMTXSAQ5jcpLjsYK5r ONvkN8KyxO3os/pfAYYEwioFM/MXNohM8+gW2nxskMmY7ujMZwEI43BOTxFbxgttQRg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=PbH71ENL; arc=none smtp.remote-ip=209.85.215.172 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2CB0606A325 for ; Mon, 26 Oct 2026 09:07:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A2CB0606A325 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, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=PbH71ENL Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-cd60c5da24cso1474275a12.0 for ; Mon, 26 Oct 2026 02:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1793005625; x=1793610425; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=JDL3hXrxiyYT7g7r/FBmNwS1zM1Uj5hccHKVyhjiIx0=; b=PbH71ENLczR0Q9MUOMobBqt0wOhr4aSuJi/XjU3TuBL3YOptB5v2+un3DaKW/Jnqje 8z6idZjhSXjgozRF/1LKgVgKW7iFMONZ2pERWW2oHypJIU9MFlunH2kt7YOW1QDTTLfi Co8EIpd3ULoLCdDwTV7rhHS5nyrdZwjkzp4KfRtF6KhVGuoEdN5shEroyfgtzinON/FX I9cM2uFereqAs4dYOl8w8BF668+h7NWXYdAQJDFH7MmQfdi2T2JUFdOF6wWJa8dx2x9/ 1bF98yJW/6U0XTfLw6CwXfk3AzLduyKZwguR46pQcH5zgERLmYk5uFEs1TuTPtxh1p7s fWxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793005625; x=1793610425; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JDL3hXrxiyYT7g7r/FBmNwS1zM1Uj5hccHKVyhjiIx0=; b=E/t3DxC0vDejNijILC379SRzNNW1+mT7cArU4f1sIc1TdkariAZRs8SNw1finbNiKX vWcHNt/Agy0mZz7tZ039sWqe6DhU/bcjG6ghci+hKkuTR9j9hEGLd9NAAu4jv16zfHGf nMjmwIWUVbUdSmNUFLJQYBGycD65pZv1fxtKCDJJHeaGpURimNdw7daNp22ELpCosAo1 OftCdoM2sCrmCkghorhWVp684oTB17QzyJQJ2c5qoqdyIS8c384Xh6zehCMJQFbMvab5 Z8MgzPffjNUvJX0W/Paj0dXKHrl8Z3MuMyIq9IFcgqV93AKXtc2Zdk2Snr1ldIr4MPRJ yLsA== X-Gm-Message-State: AFq9FYK7zJjCSJPco3E0fn627BH26pqw+VOP6s79AfDM3PMWO15gaWH3 H8mZ36jQdmgCcoMSEW/5rDhTwSMrGETCcEANLHJoF8rNx1buszuV2AQq+KGIoQZ+ X-Gm-Gg: AYBFou2lCsAy0Um2rF4DiQJiNbVymn5caL9+lZzs3wdqDf9E10402ciDYyEe3xuelJq ODzsUrLqVd2tYzE5etKjAqkvoF0ccH+vvcjuxgBDHJ0WxPTqNverw584cHiKIMSO1LUrBsw4tF9 wMH0Ik4jCjJO28iHfCgKJ3oo5CZrBkvCO8Ee0W2hY0QSiMRX9el906aH3MescYKtmk9CKrF/lIP AgQkc88nThcl6VChBw9ZgOcVT6ZcAighoJJjv1ZpsolVnLzQI0KDe4fIOvI3xrtzTytZhB6flZD nEt+8QEq1DXLthfkeP/NPe10UnJwOUgT9xh3wRkYr+jn527BAPCvEHlpQEtHtEbypphxANAke6s Y4d6dHRaVPVh+L9aE7OSLI+7xP7g0pNw/iFkiptIjL8oZlY7Fd3COHPBlmgUHCAjsWMRvP3IPTz AbbojRiEAvFI4IDIJIbjCcAk2g8z5lzJL/8Hn5eATMF/2I1bSpLU3CJScDVI/gpU6mLoF+4VwJi 53TvjwbGeVy7/AZa0M69X/qg6lm/aXawh1F+H6zu86wNgk1lnpR8Nyn X-Received: by 2002:a17:90a:4485:b0:3ac:97e3:7389 with SMTP id 98e67ed59e1d1-3adeafd6493mr3865742a91.44.1793005624894; Mon, 26 Oct 2026 02:07:04 -0700 (PDT) Received: from [127.0.0.1] ([20.168.94.86]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3adebacbf5fsm7823040a91.6.2026.10.26.02.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2026 02:07:04 -0700 (PDT) Message-Id: <91ffbdf4fa9beb215f92819c4c6d0ad2640a0c71.1793005620.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Qin ShiCheng via GitGitGadget" Date: Mon, 26 Oct 2026 09:06:59 +0000 Subject: [PATCH v4 2/3] pack-objects: add --ignore-pack-keep-from Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 To: git@vger.kernel.org Cc: Patrick Steinhardt , Taylor Blau , Junio C Hamano , Justin Tobler , qeesung , Qin ShiCheng From: Qin ShiCheng repack decides which packs to delete before it runs pack-objects, but pack-objects looks for ".keep" files on its own when it opens the packs. A ".keep" that appears in between, for example from a push or fetch whose index-pack wrote a pack identical to an existing one, makes pack-objects treat as kept a pack that repack is about to delete. Its objects are then left out of the new pack, or not loosened, or not kept as unreachable, and they are gone once repack deletes the pack. Not all of that goes through "--honor-pack-keep": loosening objects for "--unpack-unreachable", and collecting them for "--keep-unreachable" and "--cruft", skip packs with a ".keep" file regardless of it. Let the caller name such packs. "--ignore-pack-keep-from=" reads names of local packs, one per line, given and matched as for "--keep-pack", and treats them as if they had no ".keep" file. All of the above go by p->pack_keep, which is read from the disk once, when a pack is first seen, so clearing it for the named packs before anything looks at it covers every one of them. Other packs, including any that show up later, keep whatever their ".keep" files say. The names come from a file because there can be more of them than fit on a command line (on Windows, the whole command line is limited to 32767 characters), and the standard input is already taken in every mode repack uses. Signed-off-by: Qin ShiCheng --- Documentation/git-pack-objects.adoc | 12 ++++++++++ builtin/pack-objects.c | 37 +++++++++++++++++++++++++++++ t/t7700-repack.sh | 37 +++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/Documentation/git-pack-objects.adoc b/Documentation/git-pack-objects.adoc index ccad938c5b..43fb206ef0 100644 --- a/Documentation/git-pack-objects.adoc +++ b/Documentation/git-pack-objects.adoc @@ -13,6 +13,7 @@ SYNOPSIS [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=] [--depth=] [--revs [--unpacked | --all]] [--keep-pack=] + [--ignore-pack-keep-from=] [--cruft] [--cruft-expiration=