From 35843b1123e2772c5db6d7db5abf279c3253ae57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 21 Sep 2018 17:57:32 +0200 Subject: rerere.c: remove implicit dependency on the_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reason rerere(), rerere_forget() and rerere_remaining() take a struct repository instead of struct index_state is not obvious from the patch: Deep in update_paths() and find_conflict(), hold_locked_index() and read_index() are called. These functions assumes the index path at $GIT_DIR/index which is not always true when you take an arbitrary index state. Taking a repository will allow us to point to the right index path later when we replace them with repo_ versions. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- rerere.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'rerere.h') diff --git a/rerere.h b/rerere.h index cd948f28f4..5ad8864b3c 100644 --- a/rerere.h +++ b/rerere.h @@ -4,6 +4,7 @@ #include "string-list.h" struct pathspec; +struct repository; #define RERERE_AUTOUPDATE 01 #define RERERE_NOAUTOUPDATE 02 @@ -23,7 +24,10 @@ struct rerere_id { }; int setup_rerere(struct string_list *, int); -int rerere(int); +#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS +#define rerere(flags) repo_rerere(the_repository, flags) +#endif +int repo_rerere(struct repository *, int); /* * Given the conflict ID and the name of a "file" used for replaying * the recorded resolution (e.g. "preimage", "postimage"), return the @@ -31,8 +35,8 @@ int rerere(int); * return the path to the directory that houses these files. */ const char *rerere_path(const struct rerere_id *, const char *file); -int rerere_forget(struct pathspec *); -int rerere_remaining(struct string_list *); +int rerere_forget(struct repository *, struct pathspec *); +int rerere_remaining(struct repository *, struct string_list *); void rerere_clear(struct string_list *); void rerere_gc(struct string_list *); -- cgit v1.2.3