author | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Mar 2011 21:55:17 +0000 (14:55 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Mar 2011 21:55:17 +0000 (14:55 -0700) |
* jc/maint-diff-q-filter:
diff --quiet: disable optimization when --diff-filter=X is used
diff --quiet: disable optimization when --diff-filter=X is used
1 | 2 | |||
---|---|---|---|---|
diff-lib.c | patch | | diff1 | | diff2 | | blob | history |
t/t4040-whitespace-status.sh | patch | | diff1 | | | | blob | history |
diff --cc diff-lib.c
index 1e22992cb10420b9dd6def16f80efc5f196ffbbb,bfa65033734452faae0d5f4365a817f9e35b3e01..2870de400ed533d83c77269ee1654af212c6510c
--- 1/diff-lib.c
--- 2/diff-lib.c
+++ b/diff-lib.c
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 a30b03bcf27ba360c3761ade77ddf0ed00600470,0000000000000000000000000000000000000000..abc49348b196cf0fec232b6f2399356e4fe324d5
mode 100755,000000..100755
mode 100755,000000..100755
--- /dev/null
+#!/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