git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
9bc841d085ee74cbc4a103b3c2f07c7e4b86e82d blob 5964 bytes (raw)

  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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
 
#!/bin/sh
#
# Copyright (c) 2008 Ping Yin
#

test_description='Summary support for submodules

This test tries to verify the sanity of summary subcommand of git submodule.
'

. ./test-lib.sh

add_file () {
	sm=$1
	shift
	owd=$(pwd)
	cd "$sm"
	for name; do
		echo "$name" > "$name" &&
		git add "$name" &&
		test_tick &&
		git commit -m "Add $name"
	done >/dev/null
	git rev-parse --verify HEAD | cut -c1-7
	cd "$owd"
}
commit_file () {
	test_tick &&
	git commit "$@" -m "Commit $*" >/dev/null
}

test_create_repo sm1 &&
add_file . foo >/dev/null

head1=$(add_file sm1 foo1 foo2)

test_expect_success 'added submodule' "
	git add sm1 &&
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 0000000...$head1 (2):
  > Add foo2

EOF
	test_cmp expected actual
"

test_expect_success 'added submodule (subdirectory)' "
	mkdir sub &&
	(
		cd sub &&
		git submodule summary >../actual
	) &&
	cat >expected <<-EOF &&
* ../sm1 0000000...$head1 (2):
  > Add foo2

EOF
	test_cmp expected actual
"

test_expect_success 'added submodule (subdirectory only)' "
	(
		cd sub &&
		git submodule summary . >../actual
	) &&
	test_must_be_empty actual
"

test_expect_success 'added submodule (subdirectory with explicit path)' "
	(
		cd sub &&
		git submodule summary ../sm1 >../actual
	) &&
	cat >expected <<-EOF &&
* ../sm1 0000000...$head1 (2):
  > Add foo2

EOF
	test_cmp expected actual
"

commit_file sm1 &&
head2=$(add_file sm1 foo3)

test_expect_success 'modified submodule(forward)' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head1...$head2 (1):
  > Add foo3

EOF
	test_cmp expected actual
"

test_expect_success 'modified submodule(forward), --files' "
	git submodule summary --files >actual &&
	cat >expected <<-EOF &&
* sm1 $head1...$head2 (1):
  > Add foo3

EOF
	test_cmp expected actual
"

test_expect_success 'no ignore=all setting has any effect' "
	git config -f .gitmodules submodule.sm1.path sm1 &&
	git config -f .gitmodules submodule.sm1.ignore all &&
	git config submodule.sm1.ignore all &&
	git config diff.ignoreSubmodules all &&
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head1...$head2 (1):
  > Add foo3

EOF
	test_cmp expected actual &&
	git config --unset diff.ignoreSubmodules &&
	git config --remove-section submodule.sm1 &&
	git config -f .gitmodules --remove-section submodule.sm1
"


commit_file sm1 &&
head3=$(
	cd sm1 &&
	git reset --hard HEAD~2 >/dev/null &&
	git rev-parse --verify HEAD | cut -c1-7
)

test_expect_success 'modified submodule(backward)' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head2...$head3 (2):
  < Add foo3
  < Add foo2

EOF
	test_cmp expected actual
"

head4=$(add_file sm1 foo4 foo5) &&
head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)
test_expect_success 'modified submodule(backward and forward)' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head2...$head4 (4):
  > Add foo5
  > Add foo4
  < Add foo3
  < Add foo2

EOF
	test_cmp expected actual
"

test_expect_success '--summary-limit' "
	git submodule summary -n 3 >actual &&
	cat >expected <<-EOF &&
* sm1 $head2...$head4 (4):
  > Add foo5
  > Add foo4
  < Add foo3

EOF
	test_cmp expected actual
"

commit_file sm1 &&
mv sm1 sm1-bak &&
echo sm1 >sm1 &&
head5=$(git hash-object sm1 | cut -c1-7) &&
git add sm1 &&
rm -f sm1 &&
mv sm1-bak sm1

test_expect_success 'typechanged submodule(submodule->blob), --cached' "
	git submodule summary --cached >actual &&
	cat >expected <<-EOF &&
* sm1 $head4(submodule)->$head5(blob) (3):
  < Add foo5

EOF
	test_i18ncmp actual expected
"

test_expect_success 'typechanged submodule(submodule->blob), --files' "
	git submodule summary --files >actual &&
	cat >expected <<-EOF &&
* sm1 $head5(blob)->$head4(submodule) (3):
  > Add foo5

EOF
	test_i18ncmp actual expected
"

rm -rf sm1 &&
git checkout-index sm1
test_expect_success 'typechanged submodule(submodule->blob)' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head4(submodule)->$head5(blob):

EOF
	test_i18ncmp actual expected
"

rm -f sm1 &&
test_create_repo sm1 &&
head6=$(add_file sm1 foo6 foo7)
test_expect_success 'nonexistent commit' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head4...$head6:
  Warn: sm1 doesn't contain commit $head4_full

EOF
	test_i18ncmp actual expected
"

commit_file
test_expect_success 'typechanged submodule(blob->submodule)' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head5(blob)->$head6(submodule) (2):
  > Add foo7

EOF
	test_i18ncmp expected actual
"

commit_file sm1 &&
rm -rf sm1
test_expect_success 'deleted submodule' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head6...0000000:

EOF
	test_cmp expected actual
"

test_expect_success 'create second submodule' '
	test_create_repo sm2 &&
	head7=$(add_file sm2 foo8 foo9) &&
	git add sm2
'

test_expect_success 'multiple submodules' "
	git submodule summary >actual &&
	cat >expected <<-EOF &&
* sm1 $head6...0000000:

* sm2 0000000...$head7 (2):
  > Add foo9

EOF
	test_cmp expected actual
"

test_expect_success 'path filter' "
	git submodule summary sm2 >actual &&
	cat >expected <<-EOF &&
* sm2 0000000...$head7 (2):
  > Add foo9

EOF
	test_cmp expected actual
"

commit_file sm2
test_expect_success 'given commit' "
	git submodule summary HEAD^ >actual &&
	cat >expected <<-EOF &&
* sm1 $head6...0000000:

* sm2 0000000...$head7 (2):
  > Add foo9

EOF
	test_cmp expected actual
"

test_expect_success '--for-status' "
	git submodule summary --for-status HEAD^ >actual &&
	test_i18ncmp actual - <<EOF
* sm1 $head6...0000000:

* sm2 0000000...$head7 (2):
  > Add foo9

EOF
"

test_expect_success 'fail when using --files together with --cached' "
	test_must_fail git submodule summary --files --cached
"

test_expect_success 'should not fail in an empty repo' "
	git init xyzzy &&
	cd xyzzy &&
	git submodule summary >output 2>&1 &&
	test_must_be_empty output
"

test_done
debug log:

solving 9bc841d085 ...
found 9bc841d085 in git.git.git

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git