summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-24 21:25:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-24 21:25:52 (GMT)
commite6a6a768ca472afed90adbbd786e5c04fff6be7b (patch)
tree24e3f08992b8d7135cf703a013c591f41018757b /t
parent7c0da37d7b0e09c199788191b322bf45fd003e3c (diff)
parentaac4fac1689f7d1414523d2ac96f1c737ee53b71 (diff)
downloadgit-e6a6a768ca472afed90adbbd786e5c04fff6be7b.zip
git-e6a6a768ca472afed90adbbd786e5c04fff6be7b.tar.gz
git-e6a6a768ca472afed90adbbd786e5c04fff6be7b.tar.bz2
Merge branch 'nd/dwim-wildcards-as-pathspecs'
"git show 'HEAD:Foo[BAR]Baz'" did not interpret the argument as a rev, i.e. the object named by the the pathname with wildcard characters in a tree object. * nd/dwim-wildcards-as-pathspecs: get_sha1: don't die() on bogus search strings check_filename: tighten dwim-wildcard ambiguity checkout: reorder check_filename conditional
Diffstat (limited to 't')
-rwxr-xr-xt/t2019-checkout-ambiguous-ref.sh26
-rwxr-xr-xt/t6133-pathspec-rev-dwim.sh48
2 files changed, 48 insertions, 26 deletions
diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh
index 199b22d..b99d519 100755
--- a/t/t2019-checkout-ambiguous-ref.sh
+++ b/t/t2019-checkout-ambiguous-ref.sh
@@ -56,30 +56,4 @@ test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
test_i18ngrep ! "^HEAD is now at" stderr
'
-test_expect_success 'wildcard ambiguation, paths win' '
- git init ambi &&
- (
- cd ambi &&
- echo a >a.c &&
- git add a.c &&
- echo b >a.c &&
- git checkout "*.c" &&
- echo a >expect &&
- test_cmp expect a.c
- )
-'
-
-test_expect_success !MINGW 'wildcard ambiguation, refs lose' '
- git init ambi2 &&
- (
- cd ambi2 &&
- echo a >"*.c" &&
- git add . &&
- test_must_fail git show :"*.c" &&
- git show :"*.c" -- >actual &&
- echo a >expect &&
- test_cmp expect actual
- )
-'
-
test_done
diff --git a/t/t6133-pathspec-rev-dwim.sh b/t/t6133-pathspec-rev-dwim.sh
new file mode 100755
index 0000000..a290ffc
--- /dev/null
+++ b/t/t6133-pathspec-rev-dwim.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+test_description='test dwim of revs versus pathspecs in revision parser'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit base &&
+ echo content >"br[ack]ets" &&
+ git add . &&
+ test_tick &&
+ git commit -m brackets
+'
+
+test_expect_success 'non-rev wildcard dwims to pathspec' '
+ git log -- "*.t" >expect &&
+ git log "*.t" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'tree:path with metacharacters dwims to rev' '
+ git show "HEAD:br[ack]ets" -- >expect &&
+ git show "HEAD:br[ack]ets" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '^{foo} with metacharacters dwims to rev' '
+ git log "HEAD^{/b.*}" -- >expect &&
+ git log "HEAD^{/b.*}" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '@{foo} with metacharacters dwims to rev' '
+ git log "HEAD@{now [or thereabouts]}" -- >expect &&
+ git log "HEAD@{now [or thereabouts]}" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success ':/*.t from a subdir dwims to a pathspec' '
+ mkdir subdir &&
+ (
+ cd subdir &&
+ git log -- ":/*.t" >expect &&
+ git log ":/*.t" >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_done