Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpack-trees: hash less #185

Conversation

derrickstolee
Copy link
Collaborator

@derrickstolee derrickstolee commented Aug 22, 2019

Creating the PR so I can generate installers and test the performance impact.

When updating the index using the cone-mode patterns for sparse-checkout, we should be able to immediately decide the new ce flags based on going out of the cone or hitting a recursive closure.

Modify is_excluded_from_list() to return a 2 for a recursive match, and use that value to immediately clear the skipworktree bit for everything in that directory. Similarly, if we get a 0, then keep the skipworktree bit on for everything in that directory. The value 1 means we saw that entry with a parent match, so should continue recursing.

Testing this on our target enlistment gave the following results for git read-tree -mu HEAD:

Before: 49s
 After:  9s

dir.c Outdated Show resolved Hide resolved
The sparse-checkout feature in "cone mode" can use the fact that
the recursive patterns are "connected" to the root via parent
patterns to decide if a directory is entirely contained in the
sparse-checkout or entirely removed.

In these cases, we can skip hashing the paths within those
directories and simply set the skipworktree bit to the correct
value.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
dir.h Show resolved Hide resolved
@@ -257,6 +257,10 @@ int read_directory(struct dir_struct *, struct index_state *istate,
const char *path, int len,
const struct pathspec *pathspec);

#define IS_EXCLUDED_UNKNOWN -1
#define IS_EXCLUDED_NOT_CONTAINS 0

Choose a reason for hiding this comment

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

Some more context on what this means please? It doesn;t read very intuitively to me.

@derrickstolee
Copy link
Collaborator Author

/azp run Microsoft.git

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@derrickstolee
Copy link
Collaborator Author

/azp run Microsoft.git

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@derrickstolee derrickstolee merged commit ce6e76d into microsoft:features/sparse-checkout-2.23.0 Aug 27, 2019
derrickstolee added a commit to microsoft/scalar that referenced this pull request Aug 28, 2019
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