wt-status.c: remove implicit dependency on the_index

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-11-10 06:48:49 +01:00
committed by Junio C Hamano
parent 8858448bb4
commit 5b02ca38a3
6 changed files with 66 additions and 47 deletions

View File

@ -185,7 +185,7 @@ static void determine_whence(struct wt_status *s)
static void status_init_config(struct wt_status *s, config_fn_t fn)
{
wt_status_prepare(s);
wt_status_prepare(the_repository, s);
init_diff_ui_defaults();
git_config(fn, s);
determine_whence(s);

View File

@ -888,7 +888,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
die(_("Updating an unborn branch with changes added to the index."));
if (!autostash)
require_clean_work_tree(N_("pull with rebase"),
require_clean_work_tree(the_repository,
N_("pull with rebase"),
_("please commit or stash them."), 1, 0);
if (get_rebase_fork_point(&rebase_fork_point, repo, *refspecs))

View File

@ -983,7 +983,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
&lock_file);
rollback_lock_file(&lock_file);
if (has_unstaged_changes(1)) {
if (has_unstaged_changes(the_repository, 1)) {
puts(_("You must edit all merge conflicts and then\n"
"mark them as resolved using git add"));
exit(1);
@ -1351,7 +1351,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
update_index_if_able(&the_index, &lock_file);
rollback_lock_file(&lock_file);
if (has_unstaged_changes(1) || has_uncommitted_changes(1)) {
if (has_unstaged_changes(the_repository, 1) ||
has_uncommitted_changes(the_repository, 1)) {
const char *autostash =
state_dir_path("autostash", &options);
struct child_process stash = CHILD_PROCESS_INIT;
@ -1397,7 +1398,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
}
}
if (require_clean_work_tree("rebase",
if (require_clean_work_tree(the_repository, "rebase",
_("Please commit or stash them."), 1, 1)) {
ret = 1;
goto cleanup;