t / t3009-ls-files-others-nonsubmodule.shon commit t7610-mergetool: use test_cmp instead of test $(cat file) = $txt (e10dffd)
   1#!/bin/sh
   2
   3test_description='test git ls-files --others with non-submodule repositories
   4
   5This test runs git ls-files --others with the following working tree:
   6
   7    nonrepo-no-files/
   8      plain directory with no files
   9    nonrepo-untracked-file/
  10      plain directory with an untracked file
  11    repo-no-commit-no-files/
  12      git repository without a commit or a file
  13    repo-no-commit-untracked-file/
  14      git repository without a commit but with an untracked file
  15    repo-with-commit-no-files/
  16      git repository with a commit and no untracked files
  17    repo-with-commit-untracked-file/
  18      git repository with a commit and an untracked file
  19'
  20
  21. ./test-lib.sh
  22
  23test_expect_success 'setup: directories' '
  24        mkdir nonrepo-no-files/ &&
  25        mkdir nonrepo-untracked-file &&
  26        : >nonrepo-untracked-file/untracked &&
  27        git init repo-no-commit-no-files &&
  28        git init repo-no-commit-untracked-file &&
  29        : >repo-no-commit-untracked-file/untracked &&
  30        git init repo-with-commit-no-files &&
  31        git -C repo-with-commit-no-files commit --allow-empty -mmsg &&
  32        git init repo-with-commit-untracked-file &&
  33        test_commit -C repo-with-commit-untracked-file msg &&
  34        : >repo-with-commit-untracked-file/untracked
  35'
  36
  37test_expect_success 'ls-files --others handles untracked git repositories' '
  38        git ls-files -o >output &&
  39        cat >expect <<-EOF &&
  40        nonrepo-untracked-file/untracked
  41        output
  42        repo-no-commit-no-files/
  43        repo-no-commit-untracked-file/
  44        repo-with-commit-no-files/
  45        repo-with-commit-untracked-file/
  46        EOF
  47        test_cmp expect output
  48'
  49
  50test_done