Skip to content

Conversation

@derrickstolee
Copy link

@derrickstolee derrickstolee commented Sep 24, 2019

When updating a sparse-checkout, it can be confusing what is taking so much time. Usually, it is the git read-tree -mu HEAD call.

This PR adds progress to the 'git read-tree' builtin by

  1. Adding progress to clear_ce_flags().
  2. Using progress by default when in a terminal.

Here is an example of output for the Linux kernel repo:

$ git read-tree -mu --verbose HEAD
Updating index flags: 100% (62475/62475), done.
Checking out files: 100% (46804/46804), done.

Resolves #181.

When a large repository has many sparse-checkout patterns, the
process for updating the skip-worktree bits can take long enough
that a user gets confused why nothing is happening. Update the
clear_ce_flags() method to write progress.

Signed-off-by: Derrick Stolee <[email protected]>
The read-tree builtin has a --verbose option that signals to show
progress and other data while updating the index. Update this to
be on by default when stderr is a terminal window.

This will help tools like 'git sparse-checkout' to automatically
benefit from progress indicators when a user runs these commands.

Signed-off-by: Derrick Stolee <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should opts.verbose_update be false if --quiet is specified?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that quiet means something other than "not verbose". This is non-obvious.

The quiet member in struct unpack_trees_options only toggles the output of error messages. This is different than the verbose_update member which toggles the existing progress indicators during the checkout.

Today, if you say git read-tree --verbose --quiet -mu HEAD, then you will still get progress indicators during the "Checking out files" step.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the details here, I couldn't quite figure out what --quiet was controlling.

Copy link

@jeffhostetler jeffhostetler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine as is. However, it would be better if we could use the ce offset trick and give this change a lighter footprint.

@derrickstolee derrickstolee merged commit 17088e6 into microsoft:features/sparse-checkout-2.23.0 Sep 25, 2019
derrickstolee added a commit to microsoft/scalar that referenced this pull request Sep 26, 2019
See microsoft/git#200 for details. Resolves microsoft/git#181.

This will give users more ideas of how long a command will take when modifying the sparse-checkout definition. In particular, we will notice if clear_ce_flags() is suddenly slow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants