Merge branch 'jk/diff-result-code-cleanup'
"git diff --no-such-option" and other corner cases around the exit status of the "diff" command has been corrected. * jk/diff-result-code-cleanup: diff: drop useless "status" parameter from diff_result_code() diff: drop useless return values in git-diff helpers diff: drop useless return from run_diff_{files,index} functions diff: die when failing to read index in git-diff builtin diff: show usage for unknown builtin_diff_files() options diff-files: avoid negative exit value diff: spell DIFF_INDEX_CACHED out when calling run_diff_index()
This commit is contained in:
12
wt-status.c
12
wt-status.c
@ -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,
|
||||
@ -2580,8 +2580,8 @@ int has_unstaged_changes(struct repository *r, int ignore_submodules)
|
||||
}
|
||||
rev_info.diffopt.flags.quick = 1;
|
||||
diff_setup_done(&rev_info.diffopt);
|
||||
result = run_diff_files(&rev_info, 0);
|
||||
result = diff_result_code(&rev_info.diffopt, result);
|
||||
run_diff_files(&rev_info, 0);
|
||||
result = diff_result_code(&rev_info.diffopt);
|
||||
release_revisions(&rev_info);
|
||||
return result;
|
||||
}
|
||||
@ -2614,8 +2614,8 @@ int has_uncommitted_changes(struct repository *r,
|
||||
}
|
||||
|
||||
diff_setup_done(&rev_info.diffopt);
|
||||
result = run_diff_index(&rev_info, 1);
|
||||
result = diff_result_code(&rev_info.diffopt, result);
|
||||
run_diff_index(&rev_info, DIFF_INDEX_CACHED);
|
||||
result = diff_result_code(&rev_info.diffopt);
|
||||
release_revisions(&rev_info);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user