X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=wt-status.c;h=fadbed0de9710643ac595f551f2897133b05f8c9;hb=218608cacd478bfdf4bfe40ed7d0b11af94a6a60;hp=d1c05145a4bded06a7fccc60543193d2f5181953;hpb=bd73c3f13f34ae47b956777aa4bb785b91078ee5;p=thirdparty%2Fgit.git diff --git a/wt-status.c b/wt-status.c index d1c05145a4..fadbed0de9 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1317,7 +1317,7 @@ static void show_rebase_in_progress(struct wt_status *s, status_printf_ln(s, color, _(" (use \"git rebase --abort\" to check out the original branch)")); } - } else if (state->rebase_in_progress || !stat(git_path_merge_msg(), &st)) { + } else if (state->rebase_in_progress || !stat(git_path_merge_msg(the_repository), &st)) { print_rebase_state(s, state, color); if (s->hints) status_printf_ln(s, color, @@ -1552,17 +1552,17 @@ void wt_status_get_state(struct wt_status_state *state, struct stat st; struct object_id oid; - if (!stat(git_path_merge_head(), &st)) { + if (!stat(git_path_merge_head(the_repository), &st)) { state->merge_in_progress = 1; } else if (wt_status_check_rebase(NULL, state)) { ; /* all set */ - } else if (!stat(git_path_cherry_pick_head(), &st) && + } else if (!stat(git_path_cherry_pick_head(the_repository), &st) && !get_oid("CHERRY_PICK_HEAD", &oid)) { state->cherry_pick_in_progress = 1; oidcpy(&state->cherry_pick_head_oid, &oid); } wt_status_check_bisect(NULL, state); - if (!stat(git_path_revert_head(), &st) && + if (!stat(git_path_revert_head(the_repository), &st) && !get_oid("REVERT_HEAD", &oid)) { state->revert_in_progress = 1; oidcpy(&state->revert_head_oid, &oid); @@ -2340,7 +2340,17 @@ int has_uncommitted_changes(int ignore_submodules) if (ignore_submodules) rev_info.diffopt.flags.ignore_submodules = 1; rev_info.diffopt.flags.quick = 1; + add_head_to_pending(&rev_info); + if (!rev_info.pending.nr) { + /* + * We have no head (or it's corrupt); use the empty tree, + * which will complain if the index is non-empty. + */ + struct tree *tree = lookup_tree(the_hash_algo->empty_tree); + add_pending_object(&rev_info, &tree->object, ""); + } + diff_setup_done(&rev_info.diffopt); result = run_diff_index(&rev_info, 1); return diff_result_code(&rev_info.diffopt, result);