Commit b55e6d3
diff: ensure consistent diff behavior with ignore options
In git-diff, options like `-w` and `-I<regex>`, two files are considered
equivalent under the specified "ignore" rules, even when they are not
bit-for-bit identical. For options like `--raw`, `--name-status`,
and `--name-only`, git-diff deliberately compares only the SHA values
to determine whether two files are equivalent, for performance reasons.
As a result, a file shown in `git diff --name-status` may not appear
in `git diff --patch`.
To quickly determine whether two files are equivalent, add a helper
function diff_flush_patch_quietly() in diff.c. Add `.dry_run` field in
`struct diff_options`. When `.dry_run` is true, builtin_diff() returns
immediately upon finding any change. Call diff_flush_patch_quietly()
to determine if we should flush `--raw`, `--name-only` or `--name-status`
output.
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Lidong Yan <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 866e6a3 commit b55e6d3
File tree
5 files changed
+70
-23
lines changed- t
5 files changed
+70
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2444 | 2444 | | |
2445 | 2445 | | |
2446 | 2446 | | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
2447 | 2456 | | |
2448 | 2457 | | |
2449 | 2458 | | |
| |||
3759 | 3768 | | |
3760 | 3769 | | |
3761 | 3770 | | |
3762 | | - | |
3763 | | - | |
| 3771 | + | |
| 3772 | + | |
| 3773 | + | |
| 3774 | + | |
| 3775 | + | |
| 3776 | + | |
| 3777 | + | |
| 3778 | + | |
| 3779 | + | |
| 3780 | + | |
| 3781 | + | |
| 3782 | + | |
| 3783 | + | |
| 3784 | + | |
| 3785 | + | |
3764 | 3786 | | |
3765 | 3787 | | |
3766 | 3788 | | |
| |||
6150 | 6172 | | |
6151 | 6173 | | |
6152 | 6174 | | |
| 6175 | + | |
| 6176 | + | |
| 6177 | + | |
| 6178 | + | |
| 6179 | + | |
| 6180 | + | |
| 6181 | + | |
| 6182 | + | |
| 6183 | + | |
| 6184 | + | |
| 6185 | + | |
| 6186 | + | |
| 6187 | + | |
| 6188 | + | |
| 6189 | + | |
| 6190 | + | |
6153 | 6191 | | |
6154 | 6192 | | |
6155 | 6193 | | |
| |||
6778 | 6816 | | |
6779 | 6817 | | |
6780 | 6818 | | |
6781 | | - | |
6782 | | - | |
| 6819 | + | |
| 6820 | + | |
| 6821 | + | |
| 6822 | + | |
| 6823 | + | |
| 6824 | + | |
| 6825 | + | |
| 6826 | + | |
| 6827 | + | |
6783 | 6828 | | |
6784 | 6829 | | |
6785 | 6830 | | |
| |||
6831 | 6876 | | |
6832 | 6877 | | |
6833 | 6878 | | |
6834 | | - | |
6835 | | - | |
6836 | | - | |
6837 | | - | |
6838 | | - | |
6839 | | - | |
6840 | | - | |
6841 | | - | |
6842 | | - | |
6843 | 6879 | | |
6844 | 6880 | | |
6845 | 6881 | | |
6846 | | - | |
| 6882 | + | |
6847 | 6883 | | |
6848 | 6884 | | |
6849 | 6885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| 403 | + | |
| 404 | + | |
403 | 405 | | |
404 | 406 | | |
405 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
651 | 664 | | |
652 | 665 | | |
653 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
| |||
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | | - | |
| 42 | + | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments