t / t3000-ls-files-others.shon commit Merge branch 'jc/grep-c' (f633616)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='git ls-files test (--others should pick up symlinks).
   7
   8This test runs git ls-files --others with the following on the
   9filesystem.
  10
  11    path0       - a file
  12    path1       - a symlink
  13    path2/file2 - a file in a directory
  14    path3-junk  - a file to confuse things
  15    path3/file3 - a file in a directory
  16'
  17. ./test-lib.sh
  18
  19date >path0
  20ln -s xyzzy path1
  21mkdir path2 path3
  22date >path2/file2
  23date >path2-junk
  24date >path3/file3
  25date >path3-junk
  26git update-index --add path3-junk path3/file3
  27
  28cat >expected1 <<EOF
  29expected1
  30expected2
  31output
  32path0
  33path1
  34path2-junk
  35path2/file2
  36EOF
  37sed -e 's|path2/file2|path2/|' <expected1 >expected2
  38
  39test_expect_success \
  40    'git ls-files --others to show output.' \
  41    'git ls-files --others >output'
  42
  43test_expect_success \
  44    'git ls-files --others should pick up symlinks.' \
  45    'diff output expected1'
  46
  47test_expect_success \
  48    'git ls-files --others --directory to show output.' \
  49    'git ls-files --others --directory >output'
  50
  51
  52test_expect_success \
  53    'git ls-files --others --directory should not get confused.' \
  54    'diff output expected2'
  55
  56test_done