summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Riesen <fork0@t-online.de>2006-07-24 23:23:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-25 00:32:22 (GMT)
commit57c7d9a7756f9c0165d0aa003eb8a05c08cd9fae (patch)
tree059aa505fb5c38272e9425c4d2b0f9c63ddc06b7
parente557667e2d0439451f404794cb308affbc0acfb1 (diff)
downloadgit-57c7d9a7756f9c0165d0aa003eb8a05c08cd9fae.zip
git-57c7d9a7756f9c0165d0aa003eb8a05c08cd9fae.tar.gz
git-57c7d9a7756f9c0165d0aa003eb8a05c08cd9fae.tar.bz2
Trivial path optimization test
Linus: get_pathspec() does turn '.' into an empty string (which is correct - git internally does _not_ ever understand the notion of "." as the current working directory), but it doesn't ever do the optimization of noticing that a pathspec that consists solely of an empty string is "equivalent" to an empty pathspec. The test is to ensure that this behaviour stays. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xt/t6004-rev-list-path-optim.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t6004-rev-list-path-optim.sh b/t/t6004-rev-list-path-optim.sh
new file mode 100755
index 0000000..5182dbb
--- /dev/null
+++ b/t/t6004-rev-list-path-optim.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_description='git-rev-list trivial path optimization test'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+echo Hello > a &&
+git add a &&
+git commit -m "Initial commit" a
+'
+
+test_expect_success path-optimization '
+ commit=$(echo "Unchanged tree" | git-commit-tree "HEAD^{tree}" -p HEAD) &&
+ test $(git-rev-list $commit | wc -l) = 2 &&
+ test $(git-rev-list $commit -- . | wc -l) = 1
+'
+
+test_done