From: Junio C Hamano Date: Wed, 23 Mar 2011 21:55:17 +0000 (-0700) Subject: Merge branch 'jc/maint-diff-q-filter' X-Git-Tag: v1.7.5-rc0~33 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7d0cf357a31cc8a442342696788d776265482ce9;p=git.git Merge branch 'jc/maint-diff-q-filter' * jc/maint-diff-q-filter: diff --quiet: disable optimization when --diff-filter=X is used --- 7d0cf357a31cc8a442342696788d776265482ce9 diff --cc diff-lib.c index 1e22992cb,bfa650337..2870de400 --- a/diff-lib.c +++ b/diff-lib.c @@@ -100,13 -72,13 +100,14 @@@ int run_diff_files(struct rev_info *rev unsigned int oldmode, newmode; struct cache_entry *ce = active_cache[i]; int changed; + unsigned dirty_submodule = 0; if (DIFF_OPT_TST(&revs->diffopt, QUICK) && - DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES)) + !revs->diffopt.filter && + DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES)) break; - if (!ce_path_match(ce, revs->prune_data)) + if (!ce_path_match(ce, &revs->prune_data)) continue; if (ce_stage(ce)) { diff --cc t/t4040-whitespace-status.sh index a30b03bcf,000000000..abc49348b mode 100755,000000..100755 --- a/t/t4040-whitespace-status.sh +++ b/t/t4040-whitespace-status.sh @@@ -1,63 -1,0 +1,70 @@@ +#!/bin/sh + +test_description='diff --exit-code with whitespace' +. ./test-lib.sh + +test_expect_success setup ' + mkdir a b && + echo >c && + echo >a/d && + echo >b/e && + git add . && + test_tick && + git commit -m initial && + echo " " >a/d && + test_tick && + git commit -a -m second && + echo " " >a/d && + echo " " >b/e && + git add a/d +' + +test_expect_success 'diff-tree --exit-code' ' + test_must_fail git diff --exit-code HEAD^ HEAD && + test_must_fail git diff-tree --exit-code HEAD^ HEAD +' + +test_expect_success 'diff-tree -b --exit-code' ' + git diff -b --exit-code HEAD^ HEAD && + git diff-tree -b -p --exit-code HEAD^ HEAD && + git diff-tree -b --exit-code HEAD^ HEAD +' + +test_expect_success 'diff-index --cached --exit-code' ' + test_must_fail git diff --cached --exit-code HEAD && + test_must_fail git diff-index --cached --exit-code HEAD +' + +test_expect_success 'diff-index -b -p --cached --exit-code' ' + git diff -b --cached --exit-code HEAD && + git diff-index -b -p --cached --exit-code HEAD +' + +test_expect_success 'diff-index --exit-code' ' + test_must_fail git diff --exit-code HEAD && + test_must_fail git diff-index --exit-code HEAD +' + +test_expect_success 'diff-index -b -p --exit-code' ' + git diff -b --exit-code HEAD && + git diff-index -b -p --exit-code HEAD +' + +test_expect_success 'diff-files --exit-code' ' + test_must_fail git diff --exit-code && + test_must_fail git diff-files --exit-code +' + +test_expect_success 'diff-files -b -p --exit-code' ' + git diff -b --exit-code && + git diff-files -b -p --exit-code +' + ++test_expect_success 'diff-files --diff-filter --quiet' ' ++ git reset --hard && ++ rm a/d && ++ echo x >>b/e && ++ test_must_fail git diff-files --diff-filter=M --quiet ++' ++ +test_done