t / t3010-ls-files-killed.shon commit git-read-tree: simplify merge loops enormously (d723c69)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='git-ls-files -k flag test.
   7
   8This test prepares the following in the cache:
   9
  10    path0       - a file
  11    path1       - a symlink
  12    path2/file2 - a file in a directory
  13    path3/file3 - a file in a directory
  14
  15and the following on the filesystem:
  16
  17    path0/file0 - a file in a directory
  18    path1/file1 - a file in a directory
  19    path2       - a file
  20    path3       - a symlink
  21    path4       - a file
  22    path5       - a symlink
  23    path6/file6 - a file in a directory
  24
  25git-ls-files -k should report that existing filesystem
  26objects except path4, path5 and path6/file6 to be killed.
  27'
  28. ./test-lib.sh
  29
  30date >path0
  31ln -s xyzzy path1
  32mkdir path2 path3
  33date >path2/file2
  34date >path3/file3
  35test_expect_success \
  36    'git-update-cache --add to add various paths.' \
  37    "git-update-cache --add -- path0 path1 path?/file?"
  38
  39rm -fr path?
  40date >path2
  41ln -s frotz path3
  42ln -s nitfol path5
  43mkdir path0 path1 path6
  44date >path0/file0
  45date >path1/file1
  46date >path6/file6
  47
  48test_expect_success \
  49    'git-ls-files -k to show killed files.' \
  50    'git-ls-files -k >.output'
  51cat >.expected <<EOF
  52path0/file0
  53path1/file1
  54path2
  55path3
  56EOF
  57
  58test_expect_success \
  59    'validate git-ls-files -k output.' \
  60    'diff .output .expected'
  61test_done