| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This is great. I'll look over this more deeply shortly, and I'm very excited to do so. Until then, just a random thought that add_all is probably also not correct. If you had poorly configured line endings, this would re-filter what's in your working directory and may end up putting stuff into the index. So this is very nice. Thanks for the nice monday morning surprise! |
Sorry, something went wrong.
|
Hm, that's an interesting point about the endings. Maybe we should take the crlf configuration into account in the preparation for the diff? |
Sorry, something went wrong.
|
Come to think of it, this new method is probably not correct for type changes, since it doesn't pass INCLUE_TYPECHANGE to diff. |
Sorry, something went wrong.
|
Sorry, I was a little vague earlier, I meant the current add_all is probably dreadfully wrong. I would expect that a diff-based approach would take advantage of the stat cache and not even investigate things that it knows couldn't have changed. I was responding to your first commit's message that this is not a correctness change; I think that it is both correctness and perf. :) |
Sorry, something went wrong.
|
It did later think you might have been talking about the current code. I've updated the commit message and added TYPECHANGE to the things for diff to tell us about. |
Sorry, something went wrong.
We currently iterate over all the entries and re-add them to the index. While this provides correctness, it is wasteful as we try to re-insert files which have not changed. Instead, take a diff between the index and the worktree and only re-add those which we already know have changed.
Refactor so we look like the code we're replacing, which should also allow us to more easily inplement add-all.
Instead of going through each entry we have and re-adding, which may not even be correct for certain crlf options and has bad performance, use the function which performs a diff against the worktree and try to add and remove files from that list.
Without this option, we would not be able to catch exec bit changes.
Use a diff for iteration in index_update_all and index_add_all
| Back | FazBrowse Home | New Git URL |
Re-adding every entry means we hash data we already have hashed, which proves quite a bit slower than it has to be. We can know whether we need to re-calculate hashes by iterating over the entries a diff gives us, rather than every entry in the index.
This should resolve #2687