df3c318
[tig.git] / 
blobdf3c31830f2ceb6be51280c78fccc151984caa6d
1 #!/bin/sh
3 # Test main view display of index changes and interaction with the stage view.
5 . libtest.sh
6 . libgit.sh
8 export LINES=16
10 steps '
11         :view-main
12         :wait
13         :save-display main-with-unstaged.screen
14         :enter
15         :wait
16         :save-display main-with-unstaged-split.screen
18         :status-update
19         :wait
20         :save-display main-with-staged.screen
22         :enter
23         :wait
24         :save-display main-with-staged-split.screen
26         :view-close
27         <F1>
28         :refresh
29         :wait
30         :save-display main-with-staged-and-unstaged.screen
33 tigrc <<EOF
34 set vertical-split = no
35 bind generic <F1> @sh -c 'git reset a b.c'
36 EOF
38 prepare_git_repo()
40         echo "*.o" > .gitignore
41         echo "*~" > .git/info/exclude
43         for file in a b.c "d~" e/f "g h" i.o .j "h~/k"; do
44                 dir="$(dirname "$file")"
45                 [ -n "$dir" ] && mkdir -p "$dir"
46                 printf "%s\n%s" "$file" "$(seq 1 10)" > "$file"
47         done
49         git add .
50         git_commit --author="$IDENT_A" --message="Initial commit"
52         for file in a b.c "d~" e/f "g h" i.o .j "h~/k"; do
53                 printf "%s\n%s" "$file CHANGED" "$(seq 1 8)" > "$file"
54         done
57 git_init
58 in_work_dir prepare_git_repo
60 test_tig
62 YYY_MM_DD_HH_MM="$(date +"%Y-%m-%d %H:%M")"
64 assert_equals 'main-with-unstaged.screen' <<EOF
65 $YYY_MM_DD_HH_MM Unknown    o Unstaged changes                                  
66 2009-02-13 23:31 A. U. Thor I [master] Initial commit                           
67                                                                                 
68                                                                                 
69                                                                                 
70                                                                                 
71                                                                                 
72                                                                                 
73                                                                                 
74                                                                                 
75                                                                                 
76                                                                                 
77                                                                                 
78                                                                                 
79 [main] Unstaged changes                                                     100%
80 EOF
82 assert_equals 'main-with-unstaged-split.screen' <<EOF
83 $YYY_MM_DD_HH_MM Unknown    o Unstaged changes                                  
84 2009-02-13 23:31 A. U. Thor I [master] Initial commit                           
85                                                                                 
86                                                                                 
87 [main] Unstaged changes                                                     100%
88  .j  | 6 ++----                                                                 
89  a   | 6 ++----                                                                 
90  b.c | 6 ++----                                                                 
91  e/f | 6 ++----                                                                 
92  g h | 6 ++----                                                                 
93  5 files changed, 10 insertions(+), 20 deletions(-)                             
94                                                                                 
95 diff --git a/.j b/.j                                                            
96 index e697dfd..9d8ef3d 100644                                                   
97 [stage] Unstaged changes - line 1 of 107                                      8%
98 EOF
100 assert_equals 'main-with-staged.screen' <<EOF
101 $YYY_MM_DD_HH_MM Unknown    o Staged changes                                    
102 2009-02-13 23:31 A. U. Thor I [master] Initial commit                           
103                                                                                 
104                                                                                 
105                                                                                 
106                                                                                 
107                                                                                 
108                                                                                 
109                                                                                 
110                                                                                 
111                                                                                 
112                                                                                 
113                                                                                 
114                                                                                 
115 [main] Staged changes                                                       100%
118 assert_equals 'main-with-staged-split.screen' <<EOF
119 $YYY_MM_DD_HH_MM Unknown    o Staged changes                                    
120 2009-02-13 23:31 A. U. Thor I [master] Initial commit                           
121                                                                                 
122                                                                                 
123 [main] Staged changes                                                       100%
124  .j  | 6 ++----                                                                 
125  a   | 6 ++----                                                                 
126  b.c | 6 ++----                                                                 
127  e/f | 6 ++----                                                                 
128  g h | 6 ++----                                                                 
129  5 files changed, 10 insertions(+), 20 deletions(-)                             
130                                                                                 
131 diff --git a/.j b/.j                                                            
132 index e697dfd..9d8ef3d 100644                                                   
133 [stage] Staged changes - line 1 of 107                                        8%
136 assert_equals 'main-with-staged-and-unstaged.screen' <<EOF
137 $YYY_MM_DD_HH_MM Unknown    o Staged changes                                    
138 $YYY_MM_DD_HH_MM Unknown    o Unstaged changes                                  
139 2009-02-13 23:31 A. U. Thor I [master] Initial commit                           
140                                                                                 
141                                                                                 
142                                                                                 
143                                                                                 
144                                                                                 
145                                                                                 
146                                                                                 
147                                                                                 
148                                                                                 
149                                                                                 
150                                                                                 
151 [main] Staged changes                                                       100%