blob: 802e0ba01d62c66071dbcad7c8df21f8ba09cb13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
#!/bin/sh
#
# Copyright (c) 2006 Junio C Hamano
#
test_description='Various diff formatting options'
. ./test-lib.sh
test_expect_success setup '
GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
mkdir dir &&
for i in 1 2 3; do echo $i; done >file0 &&
for i in A B; do echo $i; done >dir/sub &&
cat file0 >file2 &&
git add file0 file2 dir/sub &&
git commit -m Initial &&
git branch initial &&
git branch side &&
GIT_AUTHOR_DATE="2006-06-26 00:01:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:01:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in 4 5 6; do echo $i; done >>file0 &&
for i in C D; do echo $i; done >>dir/sub &&
rm -f file2 &&
git update-index --remove file0 file2 dir/sub &&
git commit -m Second &&
GIT_AUTHOR_DATE="2006-06-26 00:02:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:02:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in A B C; do echo $i; done >file1 &&
git add file1 &&
for i in E F; do echo $i; done >>dir/sub &&
git update-index dir/sub &&
git commit -m Third &&
GIT_AUTHOR_DATE="2006-06-26 00:03:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:03:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
git checkout side &&
for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
cat dir/sub >file3 &&
git add file3 &&
git update-index file0 dir/sub &&
git commit -m Side &&
GIT_AUTHOR_DATE="2006-06-26 00:04:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
git checkout master &&
git pull -s ours . side &&
GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
for i in A B C; do echo $i; done >>file0 &&
for i in 1 2; do echo $i; done >>dir/sub &&
git update-index file0 dir/sub &&
EDITOR=: VISUAL=: git commit --amend &&
git show-branch
'
: <<\EOF
! [initial] Initial
* [master] Merge branch 'side'
! [side] Side
---
- [master] Merge branch 'side'
*+ [side] Side
* [master^] Second
+*+ [initial] Initial
EOF
while read cmd
do
case "$cmd" in
'' | '#'*) continue ;;
esac
test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
cnt=`expr $test_count + 1`
pfx=`printf "%04d" $cnt`
expect="../t4013/diff.$test"
actual="$pfx-diff.$test"
test_expect_success "git $cmd" '
{
echo "\$ git $cmd"
git $cmd
echo "\$"
} >"$actual" &&
if test -f "$expect"
then
diff -u "$expect" "$actual" &&
rm -f "$actual"
else
# this is to help developing new tests.
cp "$actual" "$expect"
false
fi
'
done <<\EOF
diff-tree initial
diff-tree -r initial
diff-tree -r --abbrev initial
diff-tree -r --abbrev=4 initial
diff-tree --root initial
diff-tree --root --abbrev initial
diff-tree --root -r initial
diff-tree --root -r --abbrev initial
diff-tree --root -r --abbrev=4 initial
diff-tree -p initial
diff-tree --root -p initial
diff-tree --patch-with-stat initial
diff-tree --root --patch-with-stat initial
diff-tree --patch-with-raw initial
diff-tree --root --patch-with-raw initial
diff-tree --pretty initial
diff-tree --pretty --root initial
diff-tree --pretty -p initial
diff-tree --pretty --stat initial
diff-tree --pretty --summary initial
diff-tree --pretty --stat --summary initial
diff-tree --pretty --root -p initial
diff-tree --pretty --root --stat initial
#diff-tree --pretty --root --summary initial
diff-tree --pretty --root --stat --summary initial
diff-tree --pretty --patch-with-stat initial
diff-tree --pretty --root --patch-with-stat initial
diff-tree --pretty --patch-with-raw initial
diff-tree --pretty --root --patch-with-raw initial
diff-tree --pretty=oneline initial
diff-tree --pretty=oneline --root initial
diff-tree --pretty=oneline -p initial
diff-tree --pretty=oneline --root -p initial
diff-tree --pretty=oneline --patch-with-stat initial
diff-tree --pretty=oneline --root --patch-with-stat initial
diff-tree --pretty=oneline --patch-with-raw initial
diff-tree --pretty=oneline --root --patch-with-raw initial
diff-tree --pretty side
diff-tree --pretty -p side
diff-tree --pretty --patch-with-stat side
diff-tree master
diff-tree -p master
diff-tree -p -m master
diff-tree -c master
diff-tree -c --abbrev master
diff-tree --cc master
log master
log -p master
log --root master
log --root -p master
log --patch-with-stat master
log --root --patch-with-stat master
#log --root --patch-with-stat --summary master
log -SF master
whatchanged master
whatchanged -p master
whatchanged --root master
whatchanged --root -p master
whatchanged --patch-with-stat master
whatchanged --root --patch-with-stat master
whatchanged --root --patch-with-stat --summary master
whatchanged -SF master
log --patch-with-stat master -- dir/
whatchanged --patch-with-stat master -- dir/
show initial
show --root initial
show side
show master
show --stat side
show --stat --summary side
show --patch-with-stat side
show --patch-with-raw side
show --patch-with-stat --summary side
EOF
test_done
|