repository.c: replace hold_locked_index() with repo_hold_locked_index()

hold_locked_index() assumes the index path at $GIT_DIR/index. This is
not good for places that take an arbitrary index_state instead of
the_index, which is basically everywhere except builtin/.

Replace it with repo_hold_locked_index(). hold_locked_index() remains
as a wrapper around repo_hold_locked_index() to reduce changes in builtin/

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2019-01-12 09:13:24 +07:00
committed by Junio C Hamano
parent 1d18d7581c
commit 3a95f31d1c
10 changed files with 26 additions and 16 deletions

View File

@@ -6,6 +6,7 @@
struct config_set;
struct git_hash_algo;
struct index_state;
struct lock_file;
struct raw_object_store;
struct submodule_cache;
@@ -130,5 +131,8 @@ void repo_clear(struct repository *repo);
* populated then the number of entries will simply be returned.
*/
int repo_read_index(struct repository *repo);
int repo_hold_locked_index(struct repository *repo,
struct lock_file *lf,
int flags);
#endif /* REPOSITORY_H */