git status: show relative paths when run in a subdirectory
[git/git.git] / t / t7502-status.sh
CommitLineData
367c9886
JS
1#!/bin/sh
2#
3# Copyright (c) 2007 Johannes E. Schindelin
4#
5
6test_description='git-status'
7
8. ./test-lib.sh
9
10test_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'
30
31cat > 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
52EOF
53
54test_expect_success 'status' '
55
56 git status > output &&
57 git diff expect output
58
59'
60
61cat > 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: ../dir1/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
82EOF
83
84test_expect_success 'status with relative paths' '
85
86 (cd dir1 && git status) > output &&
87 git diff expect output
88
89'
90
91test_done