diff.c: remove implicit dependency on the_index

A new variant repo_diff_setup() is added that takes 'struct repository *'
and diff_setup() becomes a thin macro around it that is protected by
NO_THE_REPOSITORY_COMPATIBILITY_MACROS, similar to NO_THE_INDEX_....
The plan is these macros will always be defined for all library files
and the macros are only accessible 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
2018-09-21 17:57:24 +02:00
committed by Junio C Hamano
parent 38bbc2ea39
commit e675765235
15 changed files with 38 additions and 28 deletions

View File

@ -233,7 +233,8 @@ static void fixup_paths(const char **path, struct strbuf *replacement)
}
}
void diff_no_index(struct rev_info *revs,
void diff_no_index(struct repository *r,
struct rev_info *revs,
int argc, const char **argv)
{
int i;
@ -241,7 +242,11 @@ void diff_no_index(struct rev_info *revs,
struct strbuf replacement = STRBUF_INIT;
const char *prefix = revs->prefix;
diff_setup(&revs->diffopt);
/*
* FIXME: --no-index should not look at index and we should be
* able to pass NULL repo. Maybe later.
*/
repo_diff_setup(r, &revs->diffopt);
for (i = 1; i < argc - 2; ) {
int j;
if (!strcmp(argv[i], "--no-index"))