Message ID | 485b4a767dfa54729c40b32b7fea033aedc870d1.1632514331.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Implement a batched fsync option for core.fsyncObjectFiles | expand |
On Fri, Sep 24, 2021 at 1:12 PM Neeraj Singh via GitGitGadget <gitgitgadget@gmail.com> wrote: > > From: Neeraj Singh <neerajsi@microsoft.com> > > The update-index functionality is used internally by 'git stash push' to > setup the internal stashed commit. > > This change enables bulk-checkin for update-index infrastructure to > speed up adding new objects to the object database by leveraging the > pack functionality and the new bulk-fsync functionality. This mode > is enabled when passing paths to update-index via the --stdin flag, > as is done by 'git stash'. This part of the description is now inaccurate. All modes of update-index are now enlightened to use bulk_checkin. I'll just remove the sentence that scopes the change to --stdin on reroll. > > There is some risk with this change, since under batch fsync, the object > files will not be available until the update-index is entirely complete. > This usage is unlikely, since any tool invoking update-index and > expecting to see objects would have to synchronize with the update-index > process after passing it a file path. > > Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> > --- > builtin/update-index.c | 6 ++++++ > 1 file changed, 6 insertions(+)
diff --git a/builtin/update-index.c b/builtin/update-index.c index 187203e8bb5..dc7368bb1ee 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -5,6 +5,7 @@ */ #define USE_THE_INDEX_COMPATIBILITY_MACROS #include "cache.h" +#include "bulk-checkin.h" #include "config.h" #include "lockfile.h" #include "quote.h" @@ -1088,6 +1089,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) the_index.updated_skipworktree = 1; + /* we might be adding many objects to the object database */ + plug_bulk_checkin(); + /* * Custom copy of parse_options() because we want to handle * filename arguments as they come. @@ -1168,6 +1172,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) strbuf_release(&buf); } + /* by now we must have added all of the new objects */ + unplug_bulk_checkin(); if (split_index > 0) { if (git_config_get_split_index() == 0) warning(_("core.splitIndex is set to false; "