| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test dwim of revs versus pathspecs in revision parser' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'setup' ' |
| 8 | test_commit base && |
| 9 | echo content >"br[ack]ets" && |
| 10 | git add . && |
| 11 | test_tick && |
| 12 | git commit -m brackets |
| 13 | ' |
| 14 | |
| 15 | test_expect_success 'non-rev wildcard dwims to pathspec' ' |
| 16 | git log -- "*.t" >expect && |
| 17 | git log "*.t" >actual && |
| 18 | test_cmp expect actual |
| 19 | ' |
| 20 | |
| 21 | test_expect_success 'tree:path with metacharacters dwims to rev' ' |
| 22 | git show "HEAD:br[ack]ets" -- >expect && |
| 23 | git show "HEAD:br[ack]ets" >actual && |
| 24 | test_cmp expect actual |
| 25 | ' |
| 26 | |
| 27 | test_expect_success '^{foo} with metacharacters dwims to rev' ' |
| 28 | git log "HEAD^{/b.*}" -- >expect && |
| 29 | git log "HEAD^{/b.*}" >actual && |
| 30 | test_cmp expect actual |
| 31 | ' |
| 32 | |
| 33 | test_expect_success '@{foo} with metacharacters dwims to rev' ' |
| 34 | git log "HEAD@{now [or thereabouts]}" -- >expect && |
| 35 | git log "HEAD@{now [or thereabouts]}" >actual && |
| 36 | test_cmp expect actual |
| 37 | ' |
| 38 | |
| 39 | test_expect_success ':/*.t from a subdir dwims to a pathspec' ' |
| 40 | mkdir subdir && |
| 41 | ( |
| 42 | cd subdir && |
| 43 | git log -- ":/*.t" >expect && |
| 44 | git log ":/*.t" >actual && |
| 45 | test_cmp expect actual |
| 46 | ) |
| 47 | ' |
| 48 | |
| 49 | test_done |