t / t1014-read-tree-confusing.shon commit utf8: add is_hfs_dotgit() helper (6162a1d)
   1#!/bin/sh
   2
   3test_description='check that read-tree rejects confusing paths'
   4. ./test-lib.sh
   5
   6test_expect_success 'create base tree' '
   7        echo content >file &&
   8        git add file &&
   9        git commit -m base &&
  10        blob=$(git rev-parse HEAD:file) &&
  11        tree=$(git rev-parse HEAD^{tree})
  12'
  13
  14while read path; do
  15        test_expect_success "reject $path at end of path" '
  16                printf "100644 blob %s\t%s" "$blob" "$path" >tree &&
  17                bogus=$(git mktree <tree) &&
  18                test_must_fail git read-tree $bogus
  19        '
  20
  21        test_expect_success "reject $path as subtree" '
  22                printf "040000 tree %s\t%s" "$tree" "$path" >tree &&
  23                bogus=$(git mktree <tree) &&
  24                test_must_fail git read-tree $bogus
  25        '
  26done <<-\EOF
  27.
  28..
  29.git
  30.GIT
  31EOF
  32
  33test_done