refresh_index: remove unnecessary calls to preload_index()
With refresh_index() learning to utilize preload_index() to speed up its operation there is no longer any benefit to having the caller preload the index first. Remove those unneeded calls by calling read_index() instead of the preload variant. There is no measurable performance impact of this patch - the 2nd call to preload_index() bails out quickly but there is no reason to call it twice. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ben Peart committed
Nov 5, 2018 at 14:27 UTC
6c5b7f55a845bccf7b3abda92a78c621898d838d
4 files changed
+4
-4
builtin/commit.c
+1
-1
@@ -1363,7 +1363,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1363
if (status_format != STATUS_FORMAT_PORCELAIN &&
1364
status_format != STATUS_FORMAT_PORCELAIN_V2)
1365
progress_flag = REFRESH_PROGRESS;
1366
- read_index_preload(&the_index, &s.pathspec, progress_flag);
1366
+ read_index(&the_index);
1367
refresh_index(&the_index,
1368
REFRESH_QUIET|REFRESH_UNMERGED|progress_flag,
1369
&s.pathspec, NULL, NULL);
builtin/describe.c
+1
-1
@@ -629,7 +629,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
629
struct argv_array args = ARGV_ARRAY_INIT;
630
int fd, result;
631
632
- read_cache_preload(NULL);
632
+ read_cache();
633
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED,
634
NULL, NULL, NULL);
635
fd = hold_locked_index(&index_lock, 0);
builtin/update-index.c
+1
-1
@@ -782,7 +782,7 @@ struct refresh_params {
782
static int refresh(struct refresh_params *o, unsigned int flag)
783
{
784
setup_work_tree();
785
- read_cache_preload(NULL);
785
+ read_cache();
786
*o->has_errors |= refresh_cache(o->flags | flag);
787
return 0;
788
}
sequencer.c
+1
-1
@@ -1913,7 +1913,7 @@ static int read_and_refresh_cache(struct replay_opts *opts)
1913
{
1914
struct lock_file index_lock = LOCK_INIT;
1915
int index_fd = hold_locked_index(&index_lock, 0);
1916
- if (read_index_preload(&the_index, NULL, 0) < 0) {
1916
+ if (read_index(&the_index) < 0) {
1917
rollback_lock_file(&index_lock);
1918
return error(_("git %s: failed to read the index"),
1919
_(action_name(opts)));