diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-09-14 00:27:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-09-14 00:27:43 +0200 |
commit | 41390eb3e6411925365a4932ca4b5c12e609c779 (patch) | |
tree | 8f133156fd224de1034a913b7e265e2a6733ebde /diff.c | |
parent | Merge branch 'jc/doc-skip-fetch-all-and-prefetch' (diff) | |
parent | diff: report dirty submodules as changes in builtin_diff() (diff) | |
download | git-41390eb3e6411925365a4932ca4b5c12e609c779.tar.xz git-41390eb3e6411925365a4932ca4b5c12e609c779.zip |
Merge branch 'rs/diff-exit-code-fix'
In a few corner cases "git diff --exit-code" failed to report
"changes" (e.g., renamed without any content change), which has
been corrected.
* rs/diff-exit-code-fix:
diff: report dirty submodules as changes in builtin_diff()
diff: report copies and renames as changes in run_diff_cmd()
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -3565,6 +3565,7 @@ static void builtin_diff(const char *name_a, show_submodule_diff_summary(o, one->path ? one->path : two->path, &one->oid, &two->oid, two->dirty_submodule); + o->found_changes = 1; return; } else if (o->submodule_format == DIFF_SUBMODULE_INLINE_DIFF && (!one->mode || S_ISGITLINK(one->mode)) && @@ -3573,6 +3574,7 @@ static void builtin_diff(const char *name_a, show_submodule_inline_diff(o, one->path ? one->path : two->path, &one->oid, &two->oid, two->dirty_submodule); + o->found_changes = 1; return; } @@ -4587,6 +4589,9 @@ static void run_diff_cmd(const struct external_diff *pgm, builtin_diff(name, other ? other : name, one, two, xfrm_msg, must_show_header, o, complete_rewrite); + if (p->status == DIFF_STATUS_COPIED || + p->status == DIFF_STATUS_RENAMED) + o->found_changes = 1; } else { fprintf(o->file, "* Unmerged path %s\n", name); o->found_changes = 1; |