🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2874

[PATCH 0/3] Make orphaned commit checks configurable

#2874
From: "Wyatt Holden via GitGitGadget"
Date: Tue, 10 Nov 2026 19:11
69 lines
14019 bytes
Hi there - my name's Wyatt Holden and I'm a Software Engineer at Microsoft
:) I've been working with Derrick Stolee over the past few weeks on
optimizing git in the Office mono-repo. We found some issues around slow
checkouts on mono-repos in an automated environment:

When leaving a detached HEAD, git checkout and git switch
call orphaned_commit_warning() to warn about commits that are not reachable
from any existing ref or the destination HEAD. This requires enumerating
refs and walking commit history, which can be expensive in large
repositories.

In an internal mono-repo, Trace2 showed tree unpacking finishing
approximately 12 seconds into checkout, but the process continuing for
roughly another 193 seconds. A stack dump captured the main thread inside
 orphaned_commit_warning(), enumerating loose refs and opening ref files.
Running checkout with --quiet, which bypasses this routine, reduced the
observed runtime to approximately 14 seconds. However, --quiet also
suppresses unrelated output.

This three-commit series adds a targeted opt-out, advertises it when the
check is slow, and enables it in Scalar:

 1. checkout: make orphaned commit checks configurable Add
     checkout.orphanedCommitWarning , enabled by default, for both checkout
    and switch. Setting it to  false  skips the reachability check while
    retaining the previous HEAD description and normal checkout output. Add
    a Trace2 region to expose the check’s duration and tests verifying that
    disabling the setting bypasses the routine.
 2. checkout: advise when orphaned commit checks are slow When the check
    takes more than two seconds, suggest the opt-out and explain that
    disabling it also removes the warning about commits left behind. Control
    this advice independently through advice.checkoutOrphanedCommitWarning.
    Test advice and suppression without relying on wall-clock delays.
 3. scalar: disable orphaned commit checks by default Add
    checkout.orphanedCommitWarning=false to Scalar’s recommended
    configuration using its existing set-if-missing mechanism, preserving
    explicit user settings during clone, register, and reconfigure. Document
    the tradeoff and reflog recovery; rely on existing Scalar tests for
    configuration-preservation behavior.

Ordinary Git retains its existing default behavior. Users who disable the
check lose the immediate warning about commits left behind; those commits
can still be recovered through the HEAD reflog while the relevant entries
and objects remain available.

Wyatt Holden (3):
  checkout: make orphaned commit checks configurable
  checkout: advise when orphaned commit checks are slow
  scalar: disable orphaned commit checks by default

 Documentation/config/advice.adoc   |  6 +++
 Documentation/config/checkout.adoc | 11 +++++
 Documentation/scalar.adoc          |  7 +++
 advice.c                           |  1 +
 advice.h                           |  1 +
 builtin/checkout.c                 | 31 +++++++++++++-
 scalar.c                           |  1 +
 t/README                           |  5 +++
 t/t2020-checkout-detach.sh         | 69 ++++++++++++++++++++++++++++++
 9 files changed, 130 insertions(+), 2 deletions(-)


base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2264%2Fwyatt-holden%2Fwyattholden%2Fcheckout-orphaned-commit-warning-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2264/wyatt-holden/wyattholden/checkout-orphaned-commit-warning-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2264
-- 
gitgitgadget
Technical Details
Message-ID: <pull.2264.git.1794337920.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75117-linux-kernel-git=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75117-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Wyatt Holden via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH 0/3] Make orphaned commit checks configurable
Date: Tue, 10 Nov 2026 19:11:57 +0000
Organization: Usenet Network
Message-ID: <pull.2264.git.1794337920.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="681783"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cEnl3Z8kRco+MPkPWZAf0GY/aDw= sha256:l4Sh4YgQSX9X5qJ9oKgu6lF8CecKDD5lOX7MS1tWtks=
	sha1:hQHsVUqla5kX5jSy6j3NV7FukVo= sha256:Z6QG28hMKWQwqcEfNm9eA0NDzqxzckLZRUAbcxqwQt4=
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 4B806113CDF; Tue, 10 Nov 2026 22:18:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.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, 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 vTo0m94zZ2Rm;
	Tue, 10 Nov 2026 22:18:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75117-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 66BF3113CC7; Tue, 10 Nov 2026 22:18:26 +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 B56FCE6BA2; Tue, 10 Nov 2026 19:12:05 +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=1794337924;
	b=umuDdJ49bqXh/lH4oZJTunfksibYc6aNO8PGuSakDqTjr0ThTL5amrUHakwEG4RYxLx8
	 tOdnEfxC0DpWUSiLaMP/DhFqepUGnYd09/6b3oiByHa2+AU4Auzitzrof92knAw0SftNz
	 j90rz9X41WVyF/Zv4y2177V6F9yGoJ5d6f5dYfZJam/SEjTkjQ6UupvhMEhS7HSesh4xf
	 pq9GCBKynw/sS9EiaWpd/3Vke2RiXgmlNm0/gg29OtoE9IJ98K8gtlfN+2avEkIUrmjHV
	 P9vuhyK/pCvlg5AoX9/TIxZT+EKqkcCNLAWEqK0dt55f6715r8I8fvCeacSj228WuiQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794337924;
	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: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=I1MQ3FvIaE9YB0vfzH9+neWqBDMW8tFO2hfJzkWhKBY=;
	b=JOXYTYnJxaIB8tzefWtmivTBe3SdGBgZzn4Cru3+xMOtgg4OQsMsoDsGg8NsvsujXpqX
	 cuG5Ge9fszhXatevEbYBOs0kTPndCGsc9bl4cycNBQU3eHz2cTfWWb25Lwube6fbHur0G
	 UfneXZjO4AhNt4D8+Sfvt1SJXkVfLct7pbN1hvdeHW8rQZ+FvCfUEC7cW5v9f9xvPoU9h
	 JVXhLjjDM+gQaYq0CyGyJpuXKLVzhhZEdayN/d2Nv9jH7dNzIzuF7/JGtG1Cg90emRS0G
	 zD7B22lEIa7D1+qCX9YGkTchtO/vJC4w9WEFIOtvJ+vrUU9S4pIDpLcGuo2mwOGYyvA==
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=EWGXfnzI;
	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 AC238606A320;
	Tue, 10 Nov 2026 19:12:04 +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=EWGXfnzI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794337923;
	b=ft2ajN+BIBwXH51bbzlK0BzJBZD8drOO8IGbdT4Pq4ZsCU41Sz9BXa29qqGBKw5B7IES
	 gLRsxeyPe3mP2nmYltiU3l5o5Lnlpj7+s9uh2E5IdBFekxnckxDAXeH21T1niFGI7Q5Lv
	 N6nQxavjrI+3eTtwUOJxA2W61pQY2HBMPPbudzf5/kmbLS0OT0EIaDaCG2dpsko1gWK0n
	 IBZ0HYK6Ozr1i91z5/c+HwPl03pgMlaeK+jm1fqMTz1KC0ERqJwdYtsHdP991bPiyhSY/
	 o8f98wc5YkEo8i3XJW7P5eq1lzq+48zM593vWZ3qy9AJXf1MoyGO+osT4QKAsYMiJPg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794337923;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:From:Date:
	 Subject:Fcc:Content-Type:Content-Transfer-Encoding:MIME-Version:To:
	 Cc;
	bh=I1MQ3FvIaE9YB0vfzH9+neWqBDMW8tFO2hfJzkWhKBY=;
	b=2/PUHy4jhmnhtcTfY2uS5lXPfeaikDr53r6AkXoc1tpwmilKTe+VIm0DsLZA5+pMkAXj
	 ftPcsU0Npgnf3T7gbTkQdE+Edp7eHFwvumVo3qC4GiAaU7mxh+CHRvKOsoAMpsALwhAZd
	 CCCUn0TwtFOhhRRXEAHSVSHzjcpXWHBXSIKwep7sivvjCEOyJcBXjzoQBNWYEwpaGM4YK
	 tOiw5V6ZnJCk47vFatljl45xEqtH/dvVTlrE/RjBQ6Qx4MzevbodytyYlcYIZDVl0ftZY
	 S9hVRAkXorhoJliPo7wuE3Uu+1zFwsL69QUHI7Jldf2OjWlawuekKw5GTSJroPSW4OA==
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=EWGXfnzI;
	arc=none smtp.remote-ip=209.85.161.46
X-Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46])
	(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 77B1B606A31C
	for <git@vger.kernel.org>; Tue, 10 Nov 2026 19:12:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77B1B606A31C
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-oo1-f46.google.com with SMTP id 006d021491bc7-717034b331dso1411039eaf.2
        for <git@vger.kernel.org>; Tue, 10 Nov 2026 11:12:03 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794337922; x=1794942722; darn=vger.kernel.org;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:message-id:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=I1MQ3FvIaE9YB0vfzH9+neWqBDMW8tFO2hfJzkWhKBY=;
        b=EWGXfnzIaY/RoAl7YmHI63ktfdNDN1L5dclsbcFdpIP0oqD8gNBMX0jJ0Ely5WSX3Q
         aeY3vUnw0aSl9DT3eYXVN1Gzj2i8+a/tXlZIm+jmJuwS64M9SXDy2i2kD7KgLWQWfuvF
         ZjId5z3VG1/Iejc5ociwYWDo53zgseDtFTpryZD4LEM1WDoZ4r1b6ABu55mKeCReh30i
         5at68Dj0mkoi9dZsWRWapnIXzSakft+HBpwq+o3YB/jYT3GGUmlL+GgGVf/qME4OTGb2
         l+BtO271iswYTkLfMgy56S/YndD8PZnIDeNqKF3a5YAVEApcZmO4dGGERPmb98m831Xk
         h1rg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794337922; x=1794942722;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:message-id:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=I1MQ3FvIaE9YB0vfzH9+neWqBDMW8tFO2hfJzkWhKBY=;
        b=BIv2U76u1L5qPetMA3hoMmLppy1iR3tjCqtzZ4K7pngHwSGivqM8KwSj6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XrV7UnxiXm4q
X-Received: by 2002:a05:6820:c5d1:20b0:6f8:2346:cd78 with SMTP id 006d021491bc7-718a1883addmr1388604eaf.5.1794337922277;
        Tue, 10 Nov 2026 11:12:02 -0800 (PST)
X-Received: from [127.0.0.1] ([52.154.21.60])
        by smtp.gmail.com with ESMTPSA id 006d021491bc7-718a6f2a264sm2311559eaf.1.2026.11.10.11.12.01
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 10 Nov 2026 11:12:01 -0800 (PST)
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: gitster@pobox.com,
    stolee@gmail.com,
    wyattj.holden@gmail.com