t / t3000-ls-files-others.shon commit t0060: Fix tests on Windows (2718e85)
   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
  20if test_have_prereq SYMLINKS
  21then
  22        ln -s xyzzy path1
  23else
  24        date > path1
  25fi
  26mkdir path2 path3
  27date >path2/file2
  28date >path2-junk
  29date >path3/file3
  30date >path3-junk
  31git update-index --add path3-junk path3/file3
  32
  33cat >expected1 <<EOF
  34expected1
  35expected2
  36output
  37path0
  38path1
  39path2-junk
  40path2/file2
  41EOF
  42sed -e 's|path2/file2|path2/|' <expected1 >expected2
  43
  44test_expect_success \
  45    'git ls-files --others to show output.' \
  46    'git ls-files --others >output'
  47
  48test_expect_success \
  49    'git ls-files --others should pick up symlinks.' \
  50    'test_cmp expected1 output'
  51
  52test_expect_success \
  53    'git ls-files --others --directory to show output.' \
  54    'git ls-files --others --directory >output'
  55
  56
  57test_expect_success \
  58    'git ls-files --others --directory should not get confused.' \
  59    'test_cmp expected2 output'
  60
  61test_done