]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3004-ls-files-basic.sh
The third batch
[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
0b3481c9 9TEST_PASSES_SANITIZE_LEAK=true
cbb3167e
NTND
10. ./test-lib.sh
11
cbb3167e
NTND
12test_expect_success 'ls-files in empty repository' '
13 git ls-files >actual &&
1c5e94f4 14 test_must_be_empty actual
cbb3167e
NTND
15'
16
17test_expect_success 'ls-files with nonexistent path' '
18 git ls-files doesnotexist >actual &&
1c5e94f4 19 test_must_be_empty actual
cbb3167e
NTND
20'
21
22test_expect_success 'ls-files with nonsense option' '
23 test_expect_code 129 git ls-files --nonsense 2>actual &&
6789275d 24 test_grep "[Uu]sage: git ls-files" actual
cbb3167e
NTND
25'
26
27test_expect_success 'ls-files -h in corrupt repository' '
28 mkdir broken &&
29 (
30 cd broken &&
31 git init &&
32 >.git/index &&
33 test_expect_code 129 git ls-files -h >usage 2>&1
34 ) &&
6789275d 35 test_grep "[Uu]sage: git ls-files " broken/usage
cbb3167e
NTND
36'
37
655ee9ea 38test_expect_success SYMLINKS 'ls-files with absolute paths to symlinks' '
f02033f1
JH
39 mkdir subs &&
40 ln -s nosuch link &&
41 ln -s ../nosuch subs/link &&
42 git add link subs/link &&
43 git ls-files -s link subs/link >expect &&
44 git ls-files -s "$(pwd)/link" "$(pwd)/subs/link" >actual &&
45 test_cmp expect actual &&
46
47 (
48 cd subs &&
49 git ls-files -s link >../expect &&
50 git ls-files -s "$(pwd)/link" >../actual
51 ) &&
52 test_cmp expect actual
53'
54
cbb3167e 55test_done