🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3892

[PATCH v2] remote-curl: honor --no-thin when pushing

#3892
From: "Julian Maurin via GitGitGadget"
Date: Thu, 26 Nov 2026 09:19
145 lines
16447 bytes
From: Julian Maurin <julian.maurin.dev@proton.me>

"git push --no-thin" to a smart HTTP remote still sends a thin pack.
transport-helper.c does not forward the "thin" option to remote
helpers, and remote-curl always runs send-pack with --thin.

If one pushes from a shallow, treeless partial clone
(--filter=tree:0) to an HTTPS remote, a thin push lazily fetches
every advertised tip's missing tree from the promisor one by one,
and --no-thin has no effect over HTTP to avoid it.

"thin" was left out of the forwarded options of ef08ef9ea0
(remote-helpers: Support custom transport options, 2009-10-30) after
review noted that --no-thin did nothing on any transport at the time.
f7c815c3ee (push: respect --no-thin, 2013-08-12) made it work again,
but only for the native transports.

Forward "thin" to helpers and teach remote-curl to honor it. A helper
that does not know the option answers "unsupported", which push
ignores, so it keeps working as before.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Julian Maurin <julian.maurin.dev@proton.me>
---
    remote-curl: honor --no-thin when pushing
    
    Changes since v1:
    
     * Added the use case (a push from a shallow, treeless partial clone) to
       the commit message, in Junio's wording.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2328%2FJulianMaurin%2Fpush-no-thin-over-http-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2328/JulianMaurin/push-no-thin-over-http-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2328

Range-diff vs v1:

 1:  c3fb36cb75 ! 1:  8732cf64fc remote-curl: honor --no-thin when pushing
     @@ Commit message
          transport-helper.c does not forward the "thin" option to remote
          helpers, and remote-curl always runs send-pack with --thin.
      
     +    If one pushes from a shallow, treeless partial clone
     +    (--filter=tree:0) to an HTTPS remote, a thin push lazily fetches
     +    every advertised tip's missing tree from the promisor one by one,
     +    and --no-thin has no effect over HTTP to avoid it.
     +
          "thin" was left out of the forwarded options of ef08ef9ea0
          (remote-helpers: Support custom transport options, 2009-10-30) after
          review noted that --no-thin did nothing on any transport at the time.
     @@ Commit message
          that does not know the option answers "unsupported", which push
          ignores, so it keeps working as before.
      
     +    Helped-by: Junio C Hamano <gitster@pobox.com>
          Signed-off-by: Julian Maurin <julian.maurin.dev@proton.me>
      
       ## Documentation/gitremote-helpers.adoc ##


 Documentation/gitremote-helpers.adoc |  4 ++++
 remote-curl.c                        |  8 ++++++++
 t/t5541-http-push-smart.sh           | 17 +++++++++++++++++
 transport-helper.c                   |  1 -
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/Documentation/gitremote-helpers.adoc b/Documentation/gitremote-helpers.adoc
index 39cdece16e..8203ef497c 100644
--- a/Documentation/gitremote-helpers.adoc
+++ b/Documentation/gitremote-helpers.adoc
@@ -542,6 +542,10 @@ set by Git if the remote helper has the 'option' capability.
 	transaction.  If successful, all refs will be updated, or none will.  If the
 	remote side does not support this capability, the push will fail.
 
+'option thin' {'true'|'false'}::
+	When pushing, request the helper to send a thin pack (see
+	`--thin` in linkgit:git-pack-objects[1]).
+
 'option object-format true'::
 	Indicate that the caller wants hash algorithm information
 	to be passed back from the remote.  This mode is used when fetching
diff --git a/remote-curl.c b/remote-curl.c
index 2c35dd5240..8309d9d2a4 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -184,6 +184,14 @@ static int set_option(const char *name, size_t namelen, const char *value)
 		else
 			return -1;
 		return 0;
+	} else if (!strncmp(name, TRANS_OPT_THIN, namelen)) {
+		if (!strcmp(value, "true"))
+			options.thin = 1;
+		else if (!strcmp(value, "false"))
+			options.thin = 0;
+		else
+			return -1;
+		return 0;
 	} else if (!strncmp(name, "push-option", namelen)) {
 		if (*value != '"')
 			string_list_append(&options.push_options, value);
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 8c34833027..280b2d9078 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -253,6 +253,23 @@ test_expect_success 'push --atomic fails on server-side errors' '
 	test_grep "^ ! .*rejected.* atomic -> atomic .*atomic transaction failed" output
 '
 
+test_expect_success 'push --[no-]thin is passed to pack-objects' '
+	d=$HTTPD_DOCUMENT_ROOT_PATH/no-thin.git &&
+	git init --bare "$d" &&
+	test_config -C "$d" http.receivepack true &&
+	up="$HTTPD_URL"/smart/no-thin.git &&
+	git push "$up" main &&
+
+	test_commit thin-default &&
+	GIT_TRACE2_EVENT="$PWD/trace-thin" git push "$up" main &&
+	test_subcommand_flex git pack-objects --thin <trace-thin &&
+
+	test_commit thin-disabled &&
+	GIT_TRACE2_EVENT="$PWD/trace-no-thin" git push --no-thin "$up" main &&
+	test_subcommand_flex git pack-objects <trace-no-thin &&
+	test_subcommand_flex ! git pack-objects --thin <trace-no-thin
+'
+
 test_expect_success 'push --all can push to empty repo' '
 	d=$HTTPD_DOCUMENT_ROOT_PATH/empty-all.git &&
 	git init --bare "$d" &&
diff --git a/transport-helper.c b/transport-helper.c
index d5a064d386..6052407b9a 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -275,7 +275,6 @@ static int disconnect_helper(struct transport *transport)
 static const char *unsupported_options[] = {
 	TRANS_OPT_UPLOADPACK,
 	TRANS_OPT_RECEIVEPACK,
-	TRANS_OPT_THIN,
 	TRANS_OPT_KEEP
 	};
 

base-commit: 03b41523c576f26ad34085378717a0c1b287470f
-- 
gitgitgadget
Technical Details
Message-ID: <pull.2328.v2.git.1795684746909.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76429-linux-kernel-git=dewy.ru
References: <pull.2328.git.1795595886592.gitgitgadget@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76429-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Julian Maurin via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH v2] remote-curl: honor --no-thin when pushing
Date: Thu, 26 Nov 2026 09:19:06 +0000
Organization: Usenet Network
Message-ID: <pull.2328.v2.git.1795684746909.gitgitgadget@gmail.com>
References: <pull.2328.git.1795595886592.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="425465"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:L2c54+qJVMMXootMw1ncXe0kRQM= sha256:/puH45OSN8sZu5rt0flCG+oObABwBFm6WTOmwZ7DG0k= sha1:JbkzM91pCcddRigLm6dTCyDiHYg= sha256:GD6Z1bkpIigzMOUeptBchOOyWfB779avVahFCcx9JE8=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 1AC42125EBC; Thu, 26 Nov 2026 12:19:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.048
X-Spam-Status: No, score=-2.048 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jQYag5PW-2Jy; Thu, 26 Nov 2026 12:19:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-76429-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id EBE8B125EB7; Thu, 26 Nov 2026 12:19:14 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E1F8A340C4; Thu, 26 Nov 2026 09:19:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795684750; b=2tomTxzrVm0d1etLel+b0fyXvSiVqhLulevpJx67YAlSGaicMprEqWMeyk2nuRB1EdAw iijxndVb+NpDvgIaJ6CM8OP4MXf5wUj77nOFQvkv60WTETrVUEIFUhj2bTPMbKdpNmvMy bzS3DpVU2wWmAoAy0r9FZE8UQjhlivJw0Nsj0Hop+kOHApcprXqAmiWfgY6J6ClFInbP/ gF9vUOnT11sHQMFVuz1yDwIF7SDqsn+svCIgtaUnn7smhLEBCl+0ulz8vfmlRXAG3BmvZ I8ZLynaZWjb3o+8kdWm/dN6KmpJ3gUM/eXw8JfTlT0y/HWYlui17yL33Vlie6jgJpow==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795684750; h=X-Original-To:Received: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:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:To:Cc; bh=cWv9T2SBf8N7lY+VvscR+MvHxK6G10GIb3I29LL7hTs=; b=YgHkPfaQcYpAntAR3CtU/iE2o2mXYCwE/daxK/vNVcjI/qvI5PPlbKxViyjCYMd70rF1 I0skQWkNBcmv/t1msD0AoNUAlyItz2TXFmrqwxFFCIc6YlKrm/WHyeUWpT+RnGJwToS3e l8bS0T+73WjQkTazgnG46NZRnsQ/3zHjB9ArXN7Eo4+XGXQ5ow0FX2QbruLV9ah7xvZcD ttKv3Kj4RZMrLvnIODLH93r0iZaWaE7mUhNPhHZ5eZReo+Zyec3s13dno1wsAkceyx+5B cwLCMiRMCuPY6PFhyNDsrAGSZOHKEIZjuSsBb2Itbl2O4s1/FDxk3MF20zGWDEC4nWA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ay8zLdnu; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 466F9606A329; Thu, 26 Nov 2026 09:19:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ay8zLdnu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795684749; b=Kw7O33fXRlxdZ1FZJFveha0n8JAl39VDijue1xm3SjxM+4chh9X5d0tTySXLyroplYoF gRT3X+pSW2fuVvhVIl2btAa38XKpv1QUlRZ+GztZALClckbwfiqTix2akPNle5w5WeV1L dFOx2fI0n/DpE4wMPBdWu7kGbSbAaqeS5t474hxJFtHHSGzigyy/jPTtBrRo5XBgGFlY8 D5m95bBHkB+Plj/CIEaytdCUWU6gHhOcvDdHWv11ARTtSE65EkHEGJQEoYNWPWMJKfoyb AGUkqB8W3W/4GRzsMBmNfCJHs8NFwvlSeE9jZXvbloUyqcJ6RS2eluHl4sA+e7q4IgQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795684749; 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=cWv9T2SBf8N7lY+VvscR+MvHxK6G10GIb3I29LL7hTs=; b=Nd0sjaMDDO63yPo/S0PKCfFfTFGDdty7+v5r4j9OUFYcVXwE3N6Mtn74plWG0knDcyZu bB+OUult3G5+JHRctIVQb5aJxnrJUPtmSjmp0T1xjDeqVmclWolJFVCQWuU7FM8yIq2Sd /cMEQOo1Qv7fiZyIB3BfHzB60DcKh+0JWPHX/AJ0jGSlhfZQHjSNfytAtY9ey5H0HCwQ1 TWjd1q/23uivcMGa59gIhn73h+nIsWJLBZrY7dlxzDpxiDH5xFOS/IMcVXSYisXFmavFD 2uYmZSqHDJBPST1nqzo06W0CUF6vv0G2WayC9qxhz1dyb4RZudT0Yht+5OWrhr93dKw==
X-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=20260707 header.b=ay8zLdnu; arc=none smtp.remote-ip=209.85.214.172
X-Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.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 F1F14606A31C for <git@vger.kernel.org>; Thu, 26 Nov 2026 09:19:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1F14606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2f02b9c1f6fso46884645ad.0 for <git@vger.kernel.org>; Thu, 26 Nov 2026 01:19:08 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795684748; x=1796289548; 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=cWv9T2SBf8N7lY+VvscR+MvHxK6G10GIb3I29LL7hTs=; b=ay8zLdnuduNIKAdBkBCvmqrMxJepCjEZrWPkcAdocZ/4igT9Nxvai75g46dwpHvaoS UzYTPQKNbnZVdEZi7h3fdAatAElqab0gxnD0CDUOIBSTFgqz9K4SAukssKAcLbslXncN fZ4gSwrVH7kSdHWa4IAogEYlZiAFQqWNu4fVoXUzTyCf4kUhQ4YvPLgoKeiyg6iWqHDR 3PC6GQbvQFvoeQ85atxkeavmK+a0+EwHQmlVykFCnPWlEu2ar1rKIOtrb+VoBG902FPL /g5tpA8D9jQTqQtYNJfdQGLzegmK+Xp04EeAWfNkCXV28ZMirbJsUf4yQiZKwptIHLz2 AIpQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795684748; x=1796289548; 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=cWv9T2SBf8N7lY+VvscR+MvHxK6G10GIb3I29LL7hTs=; b=yISyYrXL7OGKgZqeecMsXcqywqB6ax6W/0W4ET57J6wA/aQ8Rg+cky+jt68J2AoeDX 7Q+fnImfp2pm96hwfdLShtN0XIiVmmp5OZBrulLZW6vhfqUxvITNbJpluTEKujGnt0h7 b+FgcZygZqKkc+KVT0p8C3pL/CnL8PVvNDdDpbY5+f1c6TN4I6J6uzy7cxAwBdJIGHkR /mceHEEvscHUlkSzAuON+xPmWAeL0P6JfGYnYzGPJNxNxHe3qQoJgd6/KhOT0+wZUtsE 1WMD2ElKJWno+x90YsRJ8Falm6hB8zB3U4jjU592XKEn/BOfAIdBAZJeqPIn/hzBb9hN 5FcQ==
X-Gm-Message-State: APuU4Z/OhN6blBNxPIuBauffxDAwXZutSr11AVjlcPIyXfEI/WyZ8A+N 39TD8aBp8eQ2NaoRrdu7aybbUJIHGO9cZuIAB1bhGwZonXf/+xKS1V0a2JJDsw==
X-Gm-Gg: AZFdTZdvZ3UxNGZepOTct6+LRD3kKnBmnyzO9AQfZE9z+yjmK7eh0v2UzfJ2S1/47N/ zlHJ/C3tom73ZzSU8kzb+sFktDwjp5UoAYa0cxwlBBK13dx0hStXkb8JKJiF14trdD+BQfCaAiK 4mLyAI7f4n0yXw0SHpyYx4dGmcjxPnNNw7ibk1JN2A4mmAXf6Yp0/nKM1usn0wnVtB/4LoJfIw/ b/J5WEj2KmLr5aq66aqnXM/CP3W08FS+CNWj2GovfySTnNy//1FLp6dtYtpWPQWGfrZGOa3n66S ja96qW5CRS0AjH/Z0Cs97KDyNxiiAv6a2nmvPKzYPMNXtSPPIlldRzhQwTZ2TvoofDybicAkMP4 KCpb3U8GyWL6Y2CfJXnDiI40rLFinYj/t63wD9aM2rEu2Xc23OsAnW23nSJrzA85fbX8VZ6MIZ2 R7A2gJ3TNZ50kLsAu+M2looPQpyddvhNxTIbeguuB8FKxNrh60ZOngjukAsLjCTzYOtEJr0O2fY 9Yvy8PSKTuoybJSgtZwAJq+MH54tK5fCtXOWcDu6KmUOggbodBdh/5igeSsTTqcNxLGR3i5jJKZ a6XCAAiAjAxHiR+LA6U3Yqw0k5OK58zvWWovoz36fq6IoTfXP0Yo1pQ+GH8EUKn0JjRBBP8mLWE tyCY5/Q==
X-Received: by 2002:a17:902:ea03:b0:2f0:7e65:befa with SMTP id d9443c01a7336-2f07e65c110mr106835075ad.1.1795684748230; Thu, 26 Nov 2026 01:19:08 -0800 (PST)
X-Received: from [127.0.0.1] (ec2-3-42-157-91.us-west-2.compute.amazonaws.com. [3.42.157.91]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f191464sm103294015ad.1.2026.11.26.01.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2026 01:19:07 -0800 (PST)
X-In-Reply-To: <pull.2328.git.1795595886592.gitgitgadget@gmail.com>
X-Fcc: Sent
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Cc: Jeff King <peff@peff.net>, "brian m. carlson" <sandals@crustytoothpaste.net>, Patrick Steinhardt <ps@pks.im>, Julian Maurin <julian.maurin.dev@proton.me>, Julian Maurin <julian.maurin.dev+github@proton.me>, Julian Maurin <julian.maurin.dev@proton.me>