t1700: add tests for splitIndex.maxPercentChange
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Feb 27, 2017 at 19:00 UTC
fcdbd9540bf6d6e92372041a7516516cd2453478
1 file changed
+72
t/t1700-split-index.sh
+72
@@ -238,4 +238,76 @@ test_expect_success 'set core.splitIndex config variable to false' '
238
test_cmp expect actual
239
'
240
241
+test_expect_success 'set core.splitIndex config variable to true' '
242
+ git config core.splitIndex true &&
243
+ : >three &&
244
+ git update-index --add three &&
245
+ BASE=$(test-dump-split-index .git/index | grep "^base") &&
246
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
247
+ cat >expect <<-EOF &&
248
+ $BASE
249
+ replacements:
250
+ deletions:
251
+ EOF
252
+ test_cmp expect actual &&
253
+ : >four &&
254
+ git update-index --add four &&
255
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
256
+ cat >expect <<-EOF &&
257
+ $BASE
258
+ 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 four
259
+ replacements:
260
+ deletions:
261
+ EOF
262
+ test_cmp expect actual
263
+'
264
+
265
+test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
266
+ git config --unset splitIndex.maxPercentChange &&
267
+ : >five &&
268
+ git update-index --add five &&
269
+ BASE=$(test-dump-split-index .git/index | grep "^base") &&
270
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
271
+ cat >expect <<-EOF &&
272
+ $BASE
273
+ replacements:
274
+ deletions:
275
+ EOF
276
+ test_cmp expect actual &&
277
+ : >six &&
278
+ git update-index --add six &&
279
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
280
+ cat >expect <<-EOF &&
281
+ $BASE
282
+ 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 six
283
+ replacements:
284
+ deletions:
285
+ EOF
286
+ test_cmp expect actual
287
+'
288
+
289
+test_expect_success 'check splitIndex.maxPercentChange set to 0' '
290
+ git config splitIndex.maxPercentChange 0 &&
291
+ : >seven &&
292
+ git update-index --add seven &&
293
+ BASE=$(test-dump-split-index .git/index | grep "^base") &&
294
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
295
+ cat >expect <<-EOF &&
296
+ $BASE
297
+ replacements:
298
+ deletions:
299
+ EOF
300
+ test_cmp expect actual &&
301
+ : >eight &&
302
+ git update-index --add eight &&
303
+ BASE=$(test-dump-split-index .git/index | grep "^base") &&
304
+ test-dump-split-index .git/index | sed "/^own/d" >actual &&
305
+ cat >expect <<-EOF &&
306
+ $BASE
307
+ replacements:
308
+ deletions:
309
+ EOF
310
+ test_cmp expect actual
311
+'
312
+
313
test_done