git-name-rev: add a --(no-)undefined option.
[git/barrbrain.git] / t / t7502-status.sh
blob9ce50cade8981bb5317397c10b0fabeba4893fc8
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='git-status'
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 : > tracked &&
12 : > modified &&
13 mkdir dir1 &&
14 : > dir1/tracked &&
15 : > dir1/modified &&
16 mkdir dir2 &&
17 : > dir1/tracked &&
18 : > dir1/modified &&
19 git add . &&
20 test_tick &&
21 git commit -m initial &&
22 : > untracked &&
23 : > dir1/untracked &&
24 : > dir2/untracked &&
25 echo 1 > dir1/modified &&
26 echo 2 > dir2/modified &&
27 echo 3 > dir2/added &&
28 git add dir2/added
31 cat > expect << \EOF
32 # On branch master
33 # Changes to be committed:
34 # (use "git reset HEAD <file>..." to unstage)
36 # new file: dir2/added
38 # Changed but not updated:
39 # (use "git add <file>..." to update what will be committed)
41 # modified: dir1/modified
43 # Untracked files:
44 # (use "git add <file>..." to include in what will be committed)
46 # dir1/untracked
47 # dir2/modified
48 # dir2/untracked
49 # expect
50 # output
51 # untracked
52 EOF
54 test_expect_success 'status' '
56 git status > output &&
57 git diff expect output
61 cat > expect << \EOF
62 # On branch master
63 # Changes to be committed:
64 # (use "git reset HEAD <file>..." to unstage)
66 # new file: ../dir2/added
68 # Changed but not updated:
69 # (use "git add <file>..." to update what will be committed)
71 # modified: modified
73 # Untracked files:
74 # (use "git add <file>..." to include in what will be committed)
76 # untracked
77 # ../dir2/modified
78 # ../dir2/untracked
79 # ../expect
80 # ../output
81 # ../untracked
82 EOF
84 test_expect_success 'status with relative paths' '
86 (cd dir1 && git status) > output &&
87 git diff expect output
91 cat > expect << \EOF
92 # On branch master
93 # Changes to be committed:
94 # (use "git reset HEAD <file>..." to unstage)
96 # new file: dir2/added
98 # Changed but not updated:
99 # (use "git add <file>..." to update what will be committed)
101 # modified: dir1/modified
103 # Untracked files:
104 # (use "git add <file>..." to include in what will be committed)
106 # dir1/untracked
107 # dir2/modified
108 # dir2/untracked
109 # expect
110 # output
111 # untracked
114 test_expect_success 'status without relative paths' '
116 git config status.relativePaths false
117 (cd dir1 && git status) > output &&
118 git diff expect output
122 test_done