Skip to content

Commit 6c5b7f5

Browse files
benpeartgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 99ce720 commit 6c5b7f5

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
13631363
if (status_format != STATUS_FORMAT_PORCELAIN &&
13641364
status_format != STATUS_FORMAT_PORCELAIN_V2)
13651365
progress_flag = REFRESH_PROGRESS;
1366-
read_index_preload(&the_index, &s.pathspec, progress_flag);
1366+
read_index(&the_index);
13671367
refresh_index(&the_index,
13681368
REFRESH_QUIET|REFRESH_UNMERGED|progress_flag,
13691369
&s.pathspec, NULL, NULL);

builtin/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
629629
struct argv_array args = ARGV_ARRAY_INIT;
630630
int fd, result;
631631

632-
read_cache_preload(NULL);
632+
read_cache();
633633
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED,
634634
NULL, NULL, NULL);
635635
fd = hold_locked_index(&index_lock, 0);

builtin/update-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ struct refresh_params {
782782
static int refresh(struct refresh_params *o, unsigned int flag)
783783
{
784784
setup_work_tree();
785-
read_cache_preload(NULL);
785+
read_cache();
786786
*o->has_errors |= refresh_cache(o->flags | flag);
787787
return 0;
788788
}

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ static int read_and_refresh_cache(struct replay_opts *opts)
19131913
{
19141914
struct lock_file index_lock = LOCK_INIT;
19151915
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) {
19171917
rollback_lock_file(&index_lock);
19181918
return error(_("git %s: failed to read the index"),
19191919
_(action_name(opts)));

0 commit comments

Comments
 (0)