git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] Make orphaned commit checks configurable

From
WGWyatt Holden via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 10, 2026, 19:11 UTC
Message-ID
<pull.2264.git.1794337920.gitgitgadget@gmail.com>

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: Wyatt Holden via GitGitGadget
Message 1 of 10 in “Make orphaned commit checks configurable”
  1. 0/3 Make orphaned commit checks configurableWyatt Holden via GitGitGadget, Nov 10, 2026
  2. 1/3 checkout: make orphaned commit checks configurableWyatt Holden via GitGitGadget, Nov 10, 2026
  3. Junio C HamanoNov 10, 2026
  4. 2/3 checkout: advise when orphaned commit checks are slowWyatt Holden via GitGitGadget, Nov 10, 2026
  5. Derrick StoleeNov 10, 2026
  6. Junio C HamanoNov 10, 2026
  7. Junio C HamanoNov 11, 2026
  8. 3/3 scalar: disable orphaned commit checks by defaultWyatt Holden via GitGitGadget, Nov 10, 2026
  9. Derrick StoleeNov 10, 2026
  10. Junio C HamanoNov 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.