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