Remove unused argument from mergetool()
[stgit.git] / t / t0007-files.sh
blob9fed0bd04fd13418e3feb47077fd37b1aeb0cfd7
1 #!/bin/sh
3 test_description='Test stg files'
5 . ./test-lib.sh
7 test_expect_success 'Create some patches' '
8 echo "*.log" >> .git/info/exclude
9 stg init &&
10 echo aaa > a.txt &&
11 echo bbb > b.txt &&
12 stg add a.txt b.txt &&
13 stg new -m "patch-a-b" &&
14 stg refresh &&
15 echo bbb >> b.txt &&
16 echo ccc > c.txt &&
17 stg add b.txt c.txt &&
18 stg new -m "patch-b-c"
19 stg refresh
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
36 M b.txt
37 A c.txt
38 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
48 a.txt
49 b.txt
50 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
58 b.txt | 1 +
59 c.txt | 1 +
60 2 files changed, 2 insertions(+)
61 create mode 100644 c.txt
62 EOF
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
75 D a.txt
76 A d.txt
77 EOF
79 test_expect_success 'Moved file' '
80 stg new -m patch-a-d &&
81 git mv a.txt d.txt &&
82 stg refresh &&
83 stg files > a-d.log &&
84 test_cmp a-d.log expected-a-d.log
87 cat > expected-a-d-bare.log <<EOF
88 a.txt
89 d.txt
90 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
97 test_done