mirror of
https://github.com/git/git.git
synced 2024-05-29 01:36:13 +02:00
diff-lib.c: remove the_repository references
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:
parent
385cb64ff3
commit
ffc00a48ef
|
@ -908,7 +908,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||||
if (ignore_submodule_arg &&
|
if (ignore_submodule_arg &&
|
||||||
!strcmp(ignore_submodule_arg, "all"))
|
!strcmp(ignore_submodule_arg, "all"))
|
||||||
flags.ignore_submodules = 1;
|
flags.ignore_submodules = 1;
|
||||||
committable = index_differs_from(parent, &flags, 1);
|
committable = index_differs_from(the_repository,
|
||||||
|
parent, &flags, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strbuf_release(&committer_ident);
|
strbuf_release(&committer_ident);
|
||||||
|
|
|
@ -26,7 +26,7 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix)
|
||||||
*/
|
*/
|
||||||
if (read_cache() < 0)
|
if (read_cache() < 0)
|
||||||
die_errno("read_cache failed");
|
die_errno("read_cache failed");
|
||||||
if (index_differs_from("HEAD", NULL, 0))
|
if (index_differs_from(the_repository, "HEAD", NULL, 0))
|
||||||
exit(2);
|
exit(2);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -542,7 +542,7 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
|
||||||
{
|
{
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(opt->repo, &revs, NULL);
|
||||||
copy_pathspec(&revs.prune_data, &opt->pathspec);
|
copy_pathspec(&revs.prune_data, &opt->pathspec);
|
||||||
revs.diffopt = *opt;
|
revs.diffopt = *opt;
|
||||||
|
|
||||||
|
@ -551,13 +551,14 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index_differs_from(const char *def, const struct diff_flags *flags,
|
int index_differs_from(struct repository *r,
|
||||||
|
const char *def, const struct diff_flags *flags,
|
||||||
int ita_invisible_in_index)
|
int ita_invisible_in_index)
|
||||||
{
|
{
|
||||||
struct rev_info rev;
|
struct rev_info rev;
|
||||||
struct setup_revision_opt opt;
|
struct setup_revision_opt opt;
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, NULL);
|
repo_init_revisions(r, &rev, NULL);
|
||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
opt.def = def;
|
opt.def = def;
|
||||||
setup_revisions(0, NULL, &rev, &opt);
|
setup_revisions(0, NULL, &rev, &opt);
|
||||||
|
|
3
diff.h
3
diff.h
|
@ -436,7 +436,8 @@ int diff_result_code(struct diff_options *, int);
|
||||||
|
|
||||||
void diff_no_index(struct repository *, struct rev_info *, int, const char **);
|
void diff_no_index(struct repository *, struct rev_info *, int, const char **);
|
||||||
|
|
||||||
int index_differs_from(const char *def, const struct diff_flags *flags,
|
int index_differs_from(struct repository *r, const char *def,
|
||||||
|
const struct diff_flags *flags,
|
||||||
int ita_invisible_in_index);
|
int ita_invisible_in_index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ static int do_pick_commit(struct repository *r,
|
||||||
unborn = 1;
|
unborn = 1;
|
||||||
} else if (unborn)
|
} else if (unborn)
|
||||||
oidcpy(&head, the_hash_algo->empty_tree);
|
oidcpy(&head, the_hash_algo->empty_tree);
|
||||||
if (index_differs_from(unborn ? empty_tree_oid_hex() : "HEAD",
|
if (index_differs_from(r, unborn ? empty_tree_oid_hex() : "HEAD",
|
||||||
NULL, 0))
|
NULL, 0))
|
||||||
return error_dirty_index(r->index, opts);
|
return error_dirty_index(r->index, opts);
|
||||||
}
|
}
|
||||||
|
@ -3915,7 +3915,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
|
||||||
if (res)
|
if (res)
|
||||||
goto release_todo_list;
|
goto release_todo_list;
|
||||||
}
|
}
|
||||||
if (index_differs_from("HEAD", NULL, 0)) {
|
if (index_differs_from(r, "HEAD", NULL, 0)) {
|
||||||
res = error_dirty_index(r->index, opts);
|
res = error_dirty_index(r->index, opts);
|
||||||
goto release_todo_list;
|
goto release_todo_list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue