chiark / gitweb /
Allow StGIT commands to run correctly in subdirectories
[stgit] / t / t2300-refresh-subdir.sh
CommitLineData
78384a2c
KH
1#!/bin/sh
2test_description='Test the refresh command from a subdirectory'
3. ./test-lib.sh
4stg init
5
6test_expect_success 'Refresh from a subdirectory' '
7 stg new foo -m foo &&
8 echo foo >> foo.txt &&
9 mkdir bar &&
10 echo bar >> bar/bar.txt &&
11 stg add foo.txt bar/bar.txt &&
12 cd bar &&
13 stg refresh &&
14 cd .. &&
15 [ "$(stg status)" = "" ]
16'
17
2299c463 18test_expect_success 'Refresh again' '
78384a2c
KH
19 echo foo2 >> foo.txt &&
20 echo bar2 >> bar/bar.txt &&
21 cd bar &&
22 stg refresh &&
23 cd .. &&
24 [ "$(stg status)" = "" ]
25'
26
d4356ac6
CM
27test_expect_success 'Refresh file in subdirectory' '
28 echo foo3 >> foo.txt &&
29 echo bar3 >> bar/bar.txt &&
30 cd bar &&
31 stg refresh bar.txt &&
32 cd .. &&
33 [ "$(stg status)" = "M foo.txt" ]
34'
35
36test_expect_success 'Refresh whole subdirectory' '
37 echo bar4 >> bar/bar.txt &&
38 stg refresh bar &&
39 [ "$(stg status)" = "M foo.txt" ]
40'
41
42test_expect_success 'Refresh subdirectories recursively' '
43 echo bar5 >> bar/bar.txt &&
44 stg refresh . &&
45 [ "$(stg status)" = "" ]
46'
47
78384a2c 48test_done