diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-11-02 10:53:16 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-11-02 10:53:16 +0300 |
commit | 57b52cec46e1b342071df3addd3369a3b60a5916 (patch) | |
tree | 70b9b432dfc1650096c7d8781ab922128db2b403 /builtin/diff-files.c | |
parent | a00b1127ce09bb963590faaef342618f719e7cc4 (diff) | |
parent | 5cc6b2d70bc55ab75913ee93d9ac96ad875fbb29 (diff) |
Merge branch 'jk/diff-result-code-cleanup' into maint-2.42
"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()
Diffstat (limited to 'builtin/diff-files.c')
-rw-r--r-- | builtin/diff-files.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 50330b8dd2..f38912cd40 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -80,14 +80,10 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) diff_merges_set_dense_combined_if_unset(&rev); - if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) { - perror("repo_read_index_preload"); - result = -1; - goto cleanup; - } - result = run_diff_files(&rev, options); - result = diff_result_code(&rev.diffopt, result); -cleanup: + if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) + die_errno("repo_read_index_preload"); + run_diff_files(&rev, options); + result = diff_result_code(&rev.diffopt); release_revisions(&rev); return result; } |