Skip to content

Commit a28fb87

Browse files
neerajsi-msftdscho
authored andcommitted
update-index: use the bulk-checkin infrastructure
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. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d94edba commit a28fb87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

builtin/update-index.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
#define USE_THE_INDEX_COMPATIBILITY_MACROS
77
#include "cache.h"
8+
#include "bulk-checkin.h"
89
#include "config.h"
910
#include "lockfile.h"
1011
#include "quote.h"
@@ -1088,6 +1089,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
10881089

10891090
the_index.updated_skipworktree = 1;
10901091

1092+
/* we might be adding many objects to the object database */
1093+
plug_bulk_checkin();
1094+
10911095
/*
10921096
* Custom copy of parse_options() because we want to handle
10931097
* filename arguments as they come.
@@ -1168,6 +1172,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
11681172
strbuf_release(&buf);
11691173
}
11701174

1175+
/* by now we must have added all of the new objects */
1176+
unplug_bulk_checkin();
11711177
if (split_index > 0) {
11721178
if (git_config_get_split_index() == 0)
11731179
warning(_("core.splitIndex is set to false; "

0 commit comments

Comments
 (0)