summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-12-27 14:58:17 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-12-27 14:58:17 -0800
commit73b063130befa7475316a142343de87da61f31e3 (patch)
tree3079b4e1f628ff89bcc0a4e5dbb42985e2c7b3a0 /t/perf
parentMerge branch 'zk/difftool-counts' (diff)
parentdiff: avoid some nesting (diff)
downloadtgif-73b063130befa7475316a142343de87da61f31e3.tar.xz
Merge branch 'tg/diff-no-index-refactor'
"git diff ../else/where/A ../else/where/B" when ../else/where is clearly outside the repository, and "git diff --no-index A B", do not have to look at the index at all, but we used to read the index unconditionally. * tg/diff-no-index-refactor: diff: avoid some nesting diff: add test for --no-index executed outside repo diff: don't read index when --no-index is given diff: move no-index detection to builtin/diff.c
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p4001-diff-no-index.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/perf/p4001-diff-no-index.sh b/t/perf/p4001-diff-no-index.sh
new file mode 100755
index 0000000000..683be6984f
--- /dev/null
+++ b/t/perf/p4001-diff-no-index.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+test_description="Test diff --no-index performance"
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+test_checkout_worktree
+
+file1=$(git ls-files | tail -n 2 | head -1)
+file2=$(git ls-files | tail -n 1 | head -1)
+
+test_expect_success "empty files, so they take no time to diff" "
+ echo >$file1 &&
+ echo >$file2
+"
+
+test_perf "diff --no-index" "
+ git diff --no-index $file1 $file2 >/dev/null
+"
+
+test_done