3 test_description
='Test stg files'
7 test_expect_success
'Create some patches' '
8 echo "*.log" >> .git/info/exclude
12 stg add a.txt b.txt &&
13 stg new -m "patch-a-b" &&
17 stg add b.txt c.txt &&
18 stg new -m "patch-b-c"
22 test_expect_success
'Invalid bare and stat' '
23 command_error stg files --bare --stat
26 test_expect_success
'Too many arguments' '
27 command_error stg files patch-a-b patch-b-c
30 test_expect_success
'Invalid patch name' '
31 command_error stg files bad-patch-name 2>&1 |
32 grep -e "bad-patch-name: Unknown patch"
35 cat > expected-b-c.log
<<EOF
40 test_expect_success
'No patch args' '
41 stg files > b-c.log &&
42 test_cmp b-c.log expected-b-c.log &&
43 stg files -- patch-b-c > b-c2.log &&
44 test_cmp b-c.log b-c2.log
47 cat > expected-a-b-bare.log
<<EOF
52 test_expect_success
'Bare file names' '
53 stg files --bare patch-a-b > a-b-bare.log &&
54 test_cmp a-b-bare.log expected-a-b-bare.log
57 cat > expected-b-c-stat.log
<<EOF
60 2 files changed, 2 insertions(+)
61 create mode 100644 c.txt
64 test_expect_success
'Stat output' '
65 stg files --stat patch-b-c > b-c-stat.log &&
66 test_cmp b-c-stat.log expected-b-c-stat.log
69 test_expect_success
'Empty patch' '
70 stg new -m empty-patch &&
71 test "$(stg files empty-patch)" = ""
74 cat > expected-a-d.log
<<EOF
79 test_expect_success
'Moved file' '
80 stg new -m patch-a-d &&
83 stg files > a-d.log &&
84 test_cmp a-d.log expected-a-d.log
87 cat > expected-a-d-bare.log
<<EOF
92 test_expect_success
'Moved file bare' '
93 stg files --bare -- patch-a-d > a-d-bare.log &&
94 test_cmp a-d-bare.log expected-a-d-bare.log