3215eef5253ca9f0a34f217a7af3f0b067df711c
   1#!/bin/sh
   2
   3test_description='test case insensitive pathspec limiting'
   4. ./test-lib.sh
   5
   6test_expect_success 'create commits with glob characters' '
   7        test_commit bar bar &&
   8        test_commit bAr bAr &&
   9        test_commit BAR BAR &&
  10        mkdir foo &&
  11        test_commit foo/bar foo/bar &&
  12        test_commit foo/bAr foo/bAr &&
  13        test_commit foo/BAR foo/BAR &&
  14        mkdir fOo &&
  15        test_commit fOo/bar fOo/bar &&
  16        test_commit fOo/bAr fOo/bAr &&
  17        test_commit fOo/BAR fOo/BAR &&
  18        mkdir FOO &&
  19        test_commit FOO/bar FOO/bar &&
  20        test_commit FOO/bAr FOO/bAr &&
  21        test_commit FOO/BAR FOO/BAR
  22'
  23
  24test_expect_success 'tree_entry_interesting matches bar' '
  25        echo bar >expect &&
  26        git log --format=%s -- "bar" >actual &&
  27        test_cmp expect actual
  28'
  29
  30test_expect_success 'tree_entry_interesting matches :(icase)bar' '
  31        cat <<-EOF >expect &&
  32        BAR
  33        bAr
  34        bar
  35        EOF
  36        git log --format=%s -- ":(icase)bar" >actual &&
  37        test_cmp expect actual
  38'
  39
  40test_expect_success 'tree_entry_interesting matches :(icase)bar with prefix' '
  41        cat <<-EOF >expect &&
  42        fOo/BAR
  43        fOo/bAr
  44        fOo/bar
  45        EOF
  46        ( cd fOo && git log --format=%s -- ":(icase)bar" ) >actual &&
  47        test_cmp expect actual
  48'
  49
  50test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefix' '
  51        cat <<-EOF >expect &&
  52        FOO/BAR
  53        FOO/bAr
  54        FOO/bar
  55        fOo/BAR
  56        fOo/bAr
  57        fOo/bar
  58        foo/BAR
  59        foo/bAr
  60        foo/bar
  61        EOF
  62        ( cd fOo && git log --format=%s -- ":(icase)../foo/bar" ) >actual &&
  63        test_cmp expect actual
  64'
  65
  66test_expect_success 'match_pathspec_depth matches :(icase)bar' '
  67        cat <<-EOF >expect &&
  68        BAR
  69        bAr
  70        bar
  71        EOF
  72        git ls-files ":(icase)bar" >actual &&
  73        test_cmp expect actual
  74'
  75
  76test_expect_success 'match_pathspec_depth matches :(icase)bar with prefix' '
  77        cat <<-EOF >expect &&
  78        fOo/BAR
  79        fOo/bAr
  80        fOo/bar
  81        EOF
  82        ( cd fOo && git ls-files --full-name ":(icase)bar" ) >actual &&
  83        test_cmp expect actual
  84'
  85
  86test_expect_success 'match_pathspec_depth matches :(icase)bar with empty prefix' '
  87        cat <<-EOF >expect &&
  88        bar
  89        fOo/BAR
  90        fOo/bAr
  91        fOo/bar
  92        EOF
  93        ( cd fOo && git ls-files --full-name ":(icase)bar" ../bar ) >actual &&
  94        test_cmp expect actual
  95'
  96
  97test_done