diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-01-12 09:13:27 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-14 12:13:04 -0800 |
commit | 1b0d968b34122a0f3ceec2786f01679437f2baba (patch) | |
tree | 8109ea8109155136b71582902f20c94dcf33ded9 /read-cache.c | |
parent | read-cache.c: kill read_index() (diff) | |
download | tgif-1b0d968b34122a0f3ceec2786f01679437f2baba.tar.xz |
read-cache.c: replace update_index_if_able with repo_&
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/read-cache.c b/read-cache.c index afbf976107..61cc0571da 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2654,9 +2654,9 @@ out: return 0; } -static int verify_index(const struct index_state *istate) +static int repo_verify_index(struct repository *repo) { - return verify_index_from(istate, get_index_file()); + return verify_index_from(repo->index, repo->index_file); } static int has_racy_timestamp(struct index_state *istate) @@ -2672,11 +2672,13 @@ static int has_racy_timestamp(struct index_state *istate) return 0; } -void update_index_if_able(struct index_state *istate, struct lock_file *lockfile) +void repo_update_index_if_able(struct repository *repo, + struct lock_file *lockfile) { - if ((istate->cache_changed || has_racy_timestamp(istate)) && - verify_index(istate)) - write_locked_index(istate, lockfile, COMMIT_LOCK); + if ((repo->index->cache_changed || + has_racy_timestamp(repo->index)) && + repo_verify_index(repo)) + write_locked_index(repo->index, lockfile, COMMIT_LOCK); else rollback_lock_file(lockfile); } |