]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3004-ls-files-basic.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t3004-ls-files-basic.sh
CommitLineData
cbb3167e
NTND
1#!/bin/sh
2
3test_description='basic ls-files tests
4
5This test runs git ls-files with various unusual or malformed
6command-line arguments.
7'
8
9. ./test-lib.sh
10
cbb3167e
NTND
11test_expect_success 'ls-files in empty repository' '
12 git ls-files >actual &&
1c5e94f4 13 test_must_be_empty actual
cbb3167e
NTND
14'
15
16test_expect_success 'ls-files with nonexistent path' '
17 git ls-files doesnotexist >actual &&
1c5e94f4 18 test_must_be_empty actual
cbb3167e
NTND
19'
20
21test_expect_success 'ls-files with nonsense option' '
22 test_expect_code 129 git ls-files --nonsense 2>actual &&
9a001381 23 test_i18ngrep "[Uu]sage: git ls-files" actual
cbb3167e
NTND
24'
25
26test_expect_success 'ls-files -h in corrupt repository' '
27 mkdir broken &&
28 (
29 cd broken &&
30 git init &&
31 >.git/index &&
32 test_expect_code 129 git ls-files -h >usage 2>&1
33 ) &&
9a001381 34 test_i18ngrep "[Uu]sage: git ls-files " broken/usage
cbb3167e
NTND
35'
36
655ee9ea 37test_expect_success SYMLINKS 'ls-files with absolute paths to symlinks' '
f02033f1
JH
38 mkdir subs &&
39 ln -s nosuch link &&
40 ln -s ../nosuch subs/link &&
41 git add link subs/link &&
42 git ls-files -s link subs/link >expect &&
43 git ls-files -s "$(pwd)/link" "$(pwd)/subs/link" >actual &&
44 test_cmp expect actual &&
45
46 (
47 cd subs &&
48 git ls-files -s link >../expect &&
49 git ls-files -s "$(pwd)/link" >../actual
50 ) &&
51 test_cmp expect actual
52'
53
cbb3167e 54test_done