diff: spell DIFF_INDEX_CACHED out when calling run_diff_index()
Many callers of run_diff_index() passed literal "1" for the option flag word, which should better be spelled out as DIFF_INDEX_CACHED for readablity. Everybody else passes "0" that can stay as-is. The other bit in the option flag word is DIFF_INDEX_MERGE_BASE, but curiously there is only one caller that can pass it, which is "git diff-index --merge-base" itself---no internal callers uses the feature. A bit tricky call to the function is in builtin/submodule--helper.c where the .cached member in a private struct is set/reset as a plain Boolean flag, which happens to be "1" and happens to match the value of DIFF_INDEX_CACHED. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -675,7 +675,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
|
||||
rev.diffopt.flags.recursive = 1;
|
||||
|
||||
copy_pathspec(&rev.prune_data, &s->pathspec);
|
||||
run_diff_index(&rev, 1);
|
||||
run_diff_index(&rev, DIFF_INDEX_CACHED);
|
||||
release_revisions(&rev);
|
||||
}
|
||||
|
||||
@@ -1156,7 +1156,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
|
||||
rev.diffopt.a_prefix = "c/";
|
||||
rev.diffopt.b_prefix = "i/";
|
||||
} /* else use prefix as per user config */
|
||||
run_diff_index(&rev, 1);
|
||||
run_diff_index(&rev, DIFF_INDEX_CACHED);
|
||||
if (s->verbose > 1 &&
|
||||
wt_status_check_worktree_changes(s, &dirty_submodules)) {
|
||||
status_printf_ln(s, c,
|
||||
@@ -2614,7 +2614,7 @@ int has_uncommitted_changes(struct repository *r,
|
||||
}
|
||||
|
||||
diff_setup_done(&rev_info.diffopt);
|
||||
result = run_diff_index(&rev_info, 1);
|
||||
result = run_diff_index(&rev_info, DIFF_INDEX_CACHED);
|
||||
result = diff_result_code(&rev_info.diffopt, result);
|
||||
release_revisions(&rev_info);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user