t / t3002-ls-files-dashpath.shon commit Merge branch 'sg/filter-branch-dwim-ambiguity' into maint (978b576)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='git ls-files test (-- to terminate the path list).
   7
   8This test runs git ls-files --others with the following on the
   9filesystem.
  10
  11    path0       - a file
  12    -foo        - a file with a funny name.
  13    --          - another file with a funny name.
  14'
  15. ./test-lib.sh
  16
  17test_expect_success \
  18        setup \
  19        'echo frotz >path0 &&
  20        echo frotz >./-foo &&
  21        echo frotz >./--'
  22
  23test_expect_success \
  24    'git ls-files without path restriction.' \
  25    'git ls-files --others >output &&
  26     test_cmp output - <<EOF
  27--
  28-foo
  29output
  30path0
  31EOF
  32'
  33
  34test_expect_success \
  35    'git ls-files with path restriction.' \
  36    'git ls-files --others path0 >output &&
  37        test_cmp output - <<EOF
  38path0
  39EOF
  40'
  41
  42test_expect_success \
  43    'git ls-files with path restriction with --.' \
  44    'git ls-files --others -- path0 >output &&
  45        test_cmp output - <<EOF
  46path0
  47EOF
  48'
  49
  50test_expect_success \
  51    'git ls-files with path restriction with -- --.' \
  52    'git ls-files --others -- -- >output &&
  53        test_cmp output - <<EOF
  54--
  55EOF
  56'
  57
  58test_expect_success \
  59    'git ls-files with no path restriction.' \
  60    'git ls-files --others -- >output &&
  61        test_cmp output - <<EOF
  62--
  63-foo
  64output
  65path0
  66EOF
  67'
  68
  69test_done