From: "Wyatt Holden via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, stolee@gmail.com, wyattj.holden@gmail.com
Subject: [PATCH 0/3] Make orphaned commit checks configurable
Date: Tue, 10 Nov 2026 19:11:57 +0000 [thread overview]
Message-ID: <pull.2264.git.1794337920.gitgitgadget@gmail.com> (raw)
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
next reply other threads:[~2026-11-10 19:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 19:11 Wyatt Holden via GitGitGadget [this message]
2026-11-10 19:11 ` [PATCH 1/3] checkout: make orphaned commit checks configurable Wyatt Holden via GitGitGadget
2026-11-10 22:05 ` Junio C Hamano
2026-11-10 19:11 ` [PATCH 2/3] checkout: advise when orphaned commit checks are slow Wyatt Holden via GitGitGadget
2026-11-10 20:48 ` Derrick Stolee
2026-11-10 22:22 ` Junio C Hamano
2026-11-11 18:52 ` Junio C Hamano
2026-11-10 19:12 ` [PATCH 3/3] scalar: disable orphaned commit checks by default Wyatt Holden via GitGitGadget
2026-11-10 20:57 ` [PATCH 0/3] Make orphaned commit checks configurable Derrick Stolee
2026-11-10 22:29 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2264.git.1794337920.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=stolee@gmail.com \
--cc=wyattj.holden@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox