|
5 | 5 | */
|
6 | 6 | #define USE_THE_INDEX_COMPATIBILITY_MACROS
|
7 | 7 | #include "cache.h"
|
| 8 | +#include "bulk-checkin.h" |
8 | 9 | #include "config.h"
|
9 | 10 | #include "lockfile.h"
|
10 | 11 | #include "quote.h"
|
@@ -57,6 +58,14 @@ static void report(const char *fmt, ...)
|
57 | 58 | if (!verbose)
|
58 | 59 | return;
|
59 | 60 |
|
| 61 | + /* |
| 62 | + * It is possible, though unlikely, that a caller could use the verbose |
| 63 | + * output to synchronize with addition of objects to the object |
| 64 | + * database. The current implementation of ODB transactions leaves |
| 65 | + * objects invisible while a transaction is active, so flush the |
| 66 | + * transaction here before reporting a change made by update-index. |
| 67 | + */ |
| 68 | + flush_odb_transaction(); |
60 | 69 | va_start(vp, fmt);
|
61 | 70 | vprintf(fmt, vp);
|
62 | 71 | putchar('\n');
|
@@ -1116,6 +1125,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
|
1116 | 1125 | */
|
1117 | 1126 | parse_options_start(&ctx, argc, argv, prefix,
|
1118 | 1127 | options, PARSE_OPT_STOP_AT_NON_OPTION);
|
| 1128 | + |
| 1129 | + /* |
| 1130 | + * Allow the object layer to optimize adding multiple objects in |
| 1131 | + * a batch. |
| 1132 | + */ |
| 1133 | + begin_odb_transaction(); |
1119 | 1134 | while (ctx.argc) {
|
1120 | 1135 | if (parseopt_state != PARSE_OPT_DONE)
|
1121 | 1136 | parseopt_state = parse_options_step(&ctx, options,
|
@@ -1190,6 +1205,11 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
|
1190 | 1205 | strbuf_release(&buf);
|
1191 | 1206 | }
|
1192 | 1207 |
|
| 1208 | + /* |
| 1209 | + * By now we have added all of the new objects |
| 1210 | + */ |
| 1211 | + end_odb_transaction(); |
| 1212 | + |
1193 | 1213 | if (split_index > 0) {
|
1194 | 1214 | if (git_config_get_split_index() == 0)
|
1195 | 1215 | warning(_("core.splitIndex is set to false; "
|
|
0 commit comments