Repository navigation
Make orphaned commit checks configurable - #2264
wyatt-holden wants to merge 3 commits into
Conversation
Welcome to GitGitGadgetHi @wyatt-holden, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that either:
You can CC potential reviewers by adding a footer to the PR description with the following syntax: NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description, Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:
It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code. Contributing the patchesBefore you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form Both the person who commented An alternative is the channel Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment If you want to see what email(s) would be sent for a After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail). If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the curl -g --user "<EMailAddress>:<Password>" \
--url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txtTo iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description): To send a new iteration, just add another PR comment with the contents: Need help?New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join. You may also be able to find help in real time in the developer IRC channel, |
|
There is an issue in commit 44df4e9:
|
|
There is an issue in commit 00d3fc0:
|
00d3fc0 to
8d9f70d
Compare
|
There is an issue in commit 1e3e99b:
|
|
There is an issue in commit 8d9f70d:
|
b4c882f to
76d29a1
Compare
|
/allow |
|
User wyatt-holden is now allowed to use GitGitGadget. WARNING: wyatt-holden has no public email address set on GitHub; GitGitGadget needs an email address to Cc: you on your contribution, so that you receive any feedback on the Git mailing list. Go to https://github.com/settings/profile to make your preferred email public to let GitGitGadget know which email address to use. |
|
/allow |
|
User wyatt-holden already allowed to use GitGitGadget. |
derrickstolee
left a comment
There was a problem hiding this comment.
I have some recommendations, but here are some top-level thoughts:
-
You use your
@microsoft.comemail address, but we can't use that to reply to the mailing list. Have you subscribed to the mailing list somewhere? (I use my Gmail account, have a rule to put the mailing list messages in a folder, and use Thunderbird to navigate and reply to those messages in plaintext.) -
Your cover letter could include an introduction of yourself (and I'll chime in to vouch for you). But be sure that any justification of the change also happens in the commit messages. You'll want to add
cc: gitster@pobox.comandcc: stolee@gmail.comto CC the maintainer and me. -
"In an affected Scalar-managed repository" you could say "In an internal monorepo" as this could impact a non-Scalar repo. I do wonder how much Scalar and the GVFS Protocol could have impacted this situation, but probably the repo didn't have a commit-graph file (yet) which would have sped-up this check. It might be worth spending some time to understand what exactly was slow about it: did the client use the full endpoint and thus was walking from a huge list of refs? Was it missing commits and thus downloading thousands of missing commits one-by-one? (that last one won't really impact upstream Git clients) It can be worth mentioning that this was something in an automated environment, so we didn't care about abandoning the detached HEAD commit. Users might want to know this information, but I suspect that most ignore it and aren't willing to wait for it.
-
You should mention these two commits directly (and in this format):
06b324c1d71 (status: add status.aheadbehind setting, 2019-06-18)
0a53561a622 (status: warn when a/b calculation takes too long, 2019-06-18)
One thing that is different between those two changes and your change is that git status got a --no-ahead-behind argument that is referenced by the warning, but you're only adding a config option. I think that this is the right call, but it might be worth pointing out that difference as something you know about and is open for changing if reviewers think it's important.
When leaving a detached HEAD, checkout enumerates refs and walks history to warn about commits left behind. This work can dominate checkout time even after the working tree has been updated. In an automated checkout of an internal monorepo, unpack_trees ended about 12 seconds into a roughly 204-second run. Stack dumps captured the main thread in orphaned_commit_warning(), enumerating loose refs and opening ref files. Using --quiet reduced the observed checkout time to about 14 seconds, but also suppressed unrelated output. These observations motivate an opt-out; they do not establish how much of the delay came from enumeration versus history traversal. Add checkout.orphanedCommitWarning, enabled by default, so checkout and switch can skip the check while retaining normal checkout output. Automated callers can opt out when they do not need a warning about leaving detached commits behind. Follow the configuration precedent of 06b324c (status: add status.aheadbehind setting, 2019-06-18). Unlike status, introduce no dedicated command-line option; callers can use git -c for a one-off override. Add a Trace2 region around the check to make its cost visible in future investigations and to verify that disabling the setting skips the routine rather than merely hiding its warning. Document the setting and test both checkout and switch. Signed-off-by: Wyatt Holden <wyattholden@microsoft.com>
The orphaned-commit check can take much longer than updating the working tree. Users who encounter this cost need a way to discover the checkout.orphanedCommitWarning setting. Measure the complete check and suggest disabling it when it takes more than two seconds. Explain that opting out also removes the warning about commits left behind, and allow the advice itself to be disabled with advice.checkoutOrphanedCommitWarning. Follow the slow-operation advice introduced by: 0a53561 (status: warn when a/b calculation takes too long, 2019-06-18) Unlike that status advice, recommend a configuration setting rather than a dedicated command-line option. Keep a test hook to exercise advice and suppression without relying on wall-clock delays. Force the advice condition without replacing the measured duration, and check the formatted duration rather than a fabricated fixed value. Signed-off-by: Wyatt Holden <wyattholden@microsoft.com>
Checking for commits left behind when leaving a detached HEAD can be expensive in large repositories. Add checkout.orphanedCommitWarning=false to Scalar's recommended settings to avoid this foreground work while preserving normal checkout output. Use the existing set-if-missing behavior so explicit user choices are preserved during clone, register, and reconfigure. Document the loss of the immediate orphan warning and the availability of reflog recovery. Existing Scalar tests cover configuration preservation, so no additional inventory of recommended settings is needed. Signed-off-by: Wyatt Holden <wyattholden@microsoft.com>
@derrickstolee - |
76d29a1 to
f24d401
Compare
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 two-commit series adds a targeted opt-out and enables it in Scalar:
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.
CC: gitster@pobox.com, stolee@gmail.com, wyattj.holden@gmail.com