When leaving a detached HEAD, git checkout and git switch call orphaned_commit_warning() to warn about commits not reachable from any ref or the destination HEAD. That means enumerating refs and walking history. Wyatt Holden, a Microsoft engineer who has worked with Derrick Stolee on an internal Office mono-repo, reports that in an automated checkout, unpack_trees finished about 12 seconds into a run of roughly 204 seconds. Stack dumps showed the main thread in orphaned_commit_warning(), enumerating loose refs and opening ref files. Using --quiet cut the time to about 14 seconds but also suppressed unrelated output. The cover text says these observations motivate an opt-out but do not show how much of the delay came from ref enumeration versus history walking.

The three patches add the checkout.orphanedCommitWarning setting, add advice that suggests disabling the check when it takes more than two seconds (itself controlled by advice.checkoutOrphanedCommitWarning), and add checkout.orphanedCommitWarning=false to Scalar's recommended settings. The Scalar patch uses the existing set-if-missing behavior so explicit user choices are preserved, and documents that reflog recovery remains available.

Junio Hamano said he found some design choices in the first patch questionable, but that the series is coherent and easy to follow. He said he often works on a detached HEAD and had not realized the check was expensive. He asked what makes it costly (number of branches or length of the history being left behind) and whether it could be optimized, or whether adding an option to disable it is the best available answer.

Derrick Stolee welcomed Wyatt and said he is biased, having pre-reviewed the series and suggested the model of the status.aheadBehind config and advice.statusAheadBehind patches. He said --quiet is not preferred long term because the team wants progress indicators in its logs. He also flagged a whitespace alignment problem. Whether the check can be made cheaper instead is not settled in the excerpts.