🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3495

Re: [PATCH] builtin/clone: fix --revision with SHA-256 commits

#3495
From: Andrei Șova
Date: Fri, 20 Nov 2026 20:36
30 lines
11910 bytes
Hi! Thanks for the review.

> Having said all that, if the problem is "the refspec item is created
> before we know what algorithm to use", wouldn't that suggest that
> the right conclusion from the observation should be more like "so,
> swap the sequence of initialization, keep the command line argument
> as an array of strings, do the handshake with the other side first
> and *then* finally create the refspec"?

Yea that was what I tried doing initially. Unfortunately it does not
work because the ref prefixes have to be initialized before we can fetch
the remote refs (and thus find out the remote hash algo), and we need
the refspec item to exist before that, so there is a kind of circular
dependency.

> Undoing what was done in an earlier step and recomputing may have
> been possible without losing information in this particular case,
> but that does not look like a good design, just sheer chance.

I agree. I originally did not quite understand the purpose of
refspec_ref_prefixes but I looked into it some more and I think it is OK
to not initialize the ref prefixes when using --revision (IIUC the
prefixes are used just as an optimization?). This also allows to get rid
of the extra case in the if (refs) as it should be non-NULL now
(previously it could be NULL since transport_get_remote_refs would
falsely return nothing because of the incorrectly parsed refspec item).

-- 
Andrei Șova
Technical Details
Message-ID: <87eccfutnw.fsf@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!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75986-linux-kernel-git=dewy.ru
References: <87mrr486sg.fsf@gmail.com> <xmqqv75rqubf.fsf@gitster.g>

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!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75986-linux-kernel-git=dewy.ru
From: andreisva2023@gmail.com (Andrei Șova)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] builtin/clone: fix --revision with SHA-256 commits
Date: Fri, 20 Nov 2026 13:36:35 -0700
Organization: Usenet Network
Message-ID: <87eccfutnw.fsf@gmail.com>
References: <87mrr486sg.fsf@gmail.com> <xmqqv75rqubf.fsf@gitster.g>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network; logging-data="3256869"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XX018lIUs/6N/FQHmyFK1aVGwJc= sha256:iDi/KweZ9SbjyxxRyWWABw4Q7srWNUBfL+wGZMbrhLw= sha1:BpRzNauWh+BiclB2/Q/tYAohRDk= sha256:GGgqUSKjzp2FX+gW26F0UlKZrzbwKYdeu6QRblL6BCU=
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 8D932115A75; Fri, 20 Nov 2026 23:37:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.049
X-Spam-Status: No, score=-2.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FORGED_GMAIL_RCVD=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] 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 4FZFK7mov3sD; Fri, 20 Nov 2026 23:37:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75986-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id BD9D1115A6A; Fri, 20 Nov 2026 23:37:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 1EE47162C17; Fri, 20 Nov 2026 20:37:01 +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=1795207021; b=ao2NdRoX/weTWyhX2V6rsRjZqv09g3ghLsSsBBAjR/onzBZLJWHWkhQXN39bSGJTjBA7 zJHPOsMWvFebVPY3ufkb9w1ooqKX7caoA0Y0h9CfQeblkkhAJj/UhD79Y0xtR4j3M289G od42oG1uLfYD43Qbc4mJh7fkKL+9NpNaVWMCqLFC8XTezRx3R0XFI8yTiHidj/CHK9a37 mxPsC9YM9WxiQcfeRh+xwz23zU9uqobNTKMJo+td7gJW2Xh7U4TOTgpTzTBnrisl1TOti n4Ju+wBIhsByh4daSSej9ebF8JDXWbOs8kXDZVMYpfztq3CNlkk+Oerxfxhvlc1wUFw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795207021; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received: Received:From:To:Cc:Subject:In-Reply-To:References:User-Agent:Date: Message-ID:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=RYg3qjip9zduv+mbRo4Qm6OFpSXOnWKZH8f29ubtZpo=; b=BmsEVRBm4ha2eQ6cBc7HlKO96EaaGLVg09R+MmFqNgpkbfMcggodXZXg/GHGiRl0iYpZ Kwhiggn1au3+lrHJ25pbyCpqpwVgypA/jQHGnBMJvJ5FjIFJV6kEbaPWeTPsB8ElApsub hSR+l9raTyjeQMntu/iegp82GEumgIesc82lXAYiVISf29ts0sQWmfs+f7AwAhbFlDr7A MtWdvGsLbtGyszSuAxmaVwrhhVvKUHp0Rse04LKqL8a7xq/7xNGFah16cejV5zmtFPytH XbQhVLqx3OO6i4md5x+HRyT0FQlQHu0wjtEf1CAn2jK4aGbGJkDZPT4wy9r4/pXQc1A==
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=zDI224tX; 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 E3EFA606A33A; Fri, 20 Nov 2026 20:37:00 +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=zDI224tX
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.177
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795207020; b=Aif74hnb8LSIEm8toe9S9iO33hUgftZHh7yDeVZ0sX4pnypjGN0jcuuFRAAWVIzaxvjq YhMYtPWDoPTIrNoIN9/R9AiEc+BdWEejXBJac3yynHdu5/enM0ddytx3x3rK/6LduH0TN J3r0SBGbhBCG9Kyn5o4jkx3360pEEXEFdnPv14jmIchLs1BByjuchFSUPWdwbVH3xoQ2a HEonPORNmuvaLPpf2IOsU4yVox+bTjCNoMWkjol/mUSP/W9uwXEuCaWD5Tpc8NYLvJpuI V2JdlvyVT7MioPKI1Q/qPos9heQqAkQto7YOI0O6DIQZcHu+TfOVPN3BYngWxy7WQ4A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795207020; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: In-Reply-To:References:User-Agent:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=RYg3qjip9zduv+mbRo4Qm6OFpSXOnWKZH8f29ubtZpo=; b=DkH73A1bpAUChXCwwB6K32rhPa0SQUEyVKSp7GX3Fcn7Pv8UwBfSI5PC5RRcy4SX1YsA SvXFke9JSfG2ixea3jFEeGMJx7HqVDZw1MkxpnxXUDypCBqD5FXZHkZRZ8+6FC7/ogApX mQ7vS+OaHwY68fx9+9zrgBa59+FkGNaDNVpuJeuHgsXTJVZUtscrJv1UcqxkXvT3YCujr rQ5EEbBGMLLYA2y4Q7j5RFcNv69gkKvAmOn+pJjg8DI5ZmoRqL6k+CgnBTNgneviu7Bnl LkB+c+MyLcen+U1I8/Zp+O7wAx3nKsGo0UMpe4mYPTRW79VXweLPFsqQhUQKUHF/BUA==
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=zDI224tX; arc=none smtp.remote-ip=209.85.210.177
X-Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 BCB06606A6CB for <git@vger.kernel.org>; Fri, 20 Nov 2026 20:36:58 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BCB06606A6CB
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-pf1-f177.google.com with SMTP id d2e1a72fcca58-8bddb1172a4so80560b3a.1 for <git@vger.kernel.org>; Fri, 20 Nov 2026 12:36:58 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795207018; x=1795811818; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to:content-type; bh=RYg3qjip9zduv+mbRo4Qm6OFpSXOnWKZH8f29ubtZpo=; b=zDI224tXbsADSOhxaLk7GnQVcIxYbgolwqqKeMVrg/QBqmIbi2HbUUexMvQH6VSzj6 rB3ZIYRHT9YDNXD+jv8DqN4upkrZ0j7hbhIlzPv+P2roMXS36KJl6t/ayskZ1QTfxNz+ FGvMpL6LTFB1zZ9oGu+vl2Moob/lm+NJ4CaBZaq0eh1atPmBk54bxCJ9agTUFUGiyXKp t0IJwXVvQJFmkZ8aXQNgfnYoLp4Sdc5CopcY6QSNsCDJ1lvUNOtVw6KYAOCVjjiIuPxe qbF4G8KJERNugV5+P+Jd4eG0utb9nlVXWu3K5gR/tiLvbA12Sghn1JzC8rl34HoPqJCC 8pVQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795207018; x=1795811818; h=content-transfer-encoding:content-type:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RYg3qjip9zduv+mbRo4Qm6OFpSXOnWKZH8f29ubtZpo=; b=XppxKFro4rIfF4ZbVzElKcD/tVc4furO2drxLwWFX2XOGIdiYu3cpbd1SoDfkr3V4d rGHy/e5N4ThTfHwtAEP3fGx7QrUQGxY1zSY08RTgkhOUflyNFvZyU4kO/vf3sYR47NyG yHWX1apcHm0gJeOboZwXQPXJb6gFNOR8W/lxdsR+oAM1yBzZqvC1KSyDjF7O9P4C4zCJ 3HQzADJtZTUCMyHkkCYYiz/9b6zvc0m2XTBNU/7WNbF85mEDukGKlFI8gpnPXSV6FBGj 6F4KRgH1NG2ndedgSaZJwoW6TyKMnjMKVFSCOZ/Q/ZybW38rmk/xEy2q8ERfJoujmibx PTqA==
X-Gm-Message-State: APuU4Z8s546MOA/v2xUMyQ0MXNTPOsBo+gVBkiIhcDZ0zW/3cLuaao+C Wvqx6ioplvJPLWk7yV6t4+GI62QnNaaJS6Y+6gpFn8Q0NxHjFQHJ0qELVCjc4Sck
X-Gm-Gg: AZFdTZd5DlCnrqvdhYcDJVvAG7Jt9exU/yrNgcp2V4Qann22u2vgTTdMGpmcUKl2cnr O7iO5A37UtolwmBnIZ3h2MTVnaDoHbEmAo0RcOto/4eis8hhzZkBIAlA+i6i2op28QIDGqNJzyX 4sf5Ar51Gpp6Fg+Bj7QYsREw/RjfGJ+qBkSS1clmbj0szDhEEDngoHxI082/rXXNnF7tSorWt09 RO8eJKSH/iWyQIVVpp5VGCmNi3/W6W3QBaqzcXp13xQ9NDix1xvOe46NJr2mc9B/crG55c6EH1C prOc/VCg6fFFXQcNA7EFASOkzehy5qtHIfk5CJMog5lz5JkGlAcE5chXs0scwUhCWLZT9avE4kS mq3z5c46/BEKRt99Q6tJVt8L9mkPKuSrX/wlQ64u5jFg+wy9Z3yl/oCBHZII7ULd2p3pyaupY23 cDSFYFwt5xA4Uz19Y/1Foh7pNXP6pWRUDQqDK2on5NcVk9eoGFrVlb9a85hUP8HJreVvpl4YfDt r312FdwOgNzjIZ2qEh2s/af2KiQ1zgfBFS6Eamciba2nqN7QEgmsjxoteiJMy5v0qECtrf7DG7T gpQCNNjaous92MS/5wvZvEsc8lqPe7S6GFU2HlI47tGAjbV6GwUqmo3Jcw9jAhZ/N+3T3dy9xr/ D8Uhp+iCwdbs7ms+zHdLVv+O8MvzTRqDxaWNclH7Jb3ftlt/VSGpoDHFwbyHdm95Rx9RZ5h1hdq E57JW3lm9l
X-Received: by 2002:aa7:804c:0:b0:8a0:646e:7e16 with SMTP id d2e1a72fcca58-8c87b4f38cbmr4306915b3a.2.1795207018080; Fri, 20 Nov 2026 12:36:58 -0800 (PST)
X-Received: from canneberge (dhcp-206-87-134-18.ubcsecure.wireless.ubc.ca. [206.87.134.18]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87344184fsm2032029b3a.35.2026.11.20.12.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 12:36:57 -0800 (PST)
X-Cc: git@vger.kernel.org
X-In-Reply-To: <xmqqv75rqubf.fsf@gitster.g>
X-User-Agent: mu4e 1.14.4; emacs 31.1
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-Received-Bytes: 11655