Code

Merge branch 'maint' of git://linux-nfs.org/~bfields/git
[git.git] / t / t7502-status.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Johannes E. Schindelin
4 #
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
29 '
31 cat > expect << \EOF
32 # On branch master
33 # Changes to be committed:
34 #   (use "git reset HEAD <file>..." to unstage)
35 #
36 #       new file:   dir2/added
37 #
38 # Changed but not updated:
39 #   (use "git add <file>..." to update what will be committed)
40 #
41 #       modified:   dir1/modified
42 #
43 # Untracked files:
44 #   (use "git add <file>..." to include in what will be committed)
45 #
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
59 '
61 cat > expect << \EOF
62 # On branch master
63 # Changes to be committed:
64 #   (use "git reset HEAD <file>..." to unstage)
65 #
66 #       new file:   ../dir2/added
67 #
68 # Changed but not updated:
69 #   (use "git add <file>..." to update what will be committed)
70 #
71 #       modified:   modified
72 #
73 # Untracked files:
74 #   (use "git add <file>..." to include in what will be committed)
75 #
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
89 '
91 cat > expect << \EOF
92 # On branch master
93 # Changes to be committed:
94 #   (use "git reset HEAD <file>..." to unstage)
95 #
96 #       new file:   dir2/added
97 #
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
112 EOF
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