Skip to content

Commit 3176576

Browse files
committed
Merge branch 'rs/diff-quiet-no-rename'
As "git diff --quiet" only cares about the existence of any changes, disable rename/copy detection to skip more expensive processing whose result will be discarded anyway. * rs/diff-quiet-no-rename: diff: disable rename detection with --quiet
2 parents 5e6e485 + fa05236 commit 3176576

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4987,6 +4987,8 @@ void diff_setup_done(struct diff_options *options)
49874987
if (options->flags.quick) {
49884988
options->output_format = DIFF_FORMAT_NO_OUTPUT;
49894989
options->flags.exit_with_status = 1;
4990+
options->detect_rename = 0;
4991+
options->flags.find_copies_harder = 0;
49904992
}
49914993

49924994
/*

t/t4007-rename-3.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ test_expect_success 'copy detection, cached' '
4141
compare_diff_raw current expected
4242
'
4343

44+
test_expect_success 'exit code of quiet copy detection' '
45+
test_expect_code 1 \
46+
git diff --quiet --cached --find-copies-harder $tree
47+
'
48+
49+
test_expect_success 'exit code of quiet copy detection with --no-ext-diff' '
50+
test_expect_code 1 \
51+
git diff --quiet --cached --find-copies-harder --no-ext-diff $tree
52+
'
53+
4454
# In the tree, there is only path0/COPYING. In the cache, path0 and
4555
# path1 both have COPYING and the latter is a copy of path0/COPYING.
4656
# However when we say we care only about path1, we should just see

0 commit comments

Comments
 (0)