t/helper: merge test-dump-split-index into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 24, 2018 at 08:44 UTC
8133061e696508560961c62a30794887c84ad721
6 files changed
+31
-28
Makefile
+1
-1
@@ -659,11 +659,11 @@ TEST_BUILTINS_OBJS += test-date.o
659
TEST_BUILTINS_OBJS += test-delta.o
660
TEST_BUILTINS_OBJS += test-drop-caches.o
661
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
662
+TEST_BUILTINS_OBJS += test-dump-split-index.o
663
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
664
TEST_BUILTINS_OBJS += test-sha1.o
665
666
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
666
-TEST_PROGRAMS_NEED_X += test-dump-split-index
667
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
668
TEST_PROGRAMS_NEED_X += test-example-decorate
669
TEST_PROGRAMS_NEED_X += test-fake-ssh
t/helper/test-dump-split-index.c
+2
-1
@@ -1,3 +1,4 @@
1
+#include "test-tool.h"
2
#include "cache.h"
3
#include "split-index.h"
4
#include "ewah/ewok.h"
@@ -7,7 +8,7 @@ static void show_bit(size_t pos, void *data)
8
printf(" %d", (int)pos);
9
}
10
10
-int cmd_main(int ac, const char **av)
11
+int cmd__dump_split_index(int ac, const char **av)
12
{
13
struct split_index *si;
14
int i;
t/helper/test-tool.c
+1
@@ -14,6 +14,7 @@ static struct test_cmd cmds[] = {
14
{ "delta", cmd__delta },
15
{ "drop-caches", cmd__drop_caches },
16
{ "dump-cache-tree", cmd__dump_cache_tree },
17
+ { "dump-split-index", cmd__dump_split_index },
18
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
19
{ "sha1", cmd__sha1 },
20
};
t/helper/test-tool.h
+1
@@ -8,6 +8,7 @@ int cmd__date(int argc, const char **argv);
8
int cmd__delta(int argc, const char **argv);
9
int cmd__drop_caches(int argc, const char **argv);
10
int cmd__dump_cache_tree(int argc, const char **argv);
11
+int cmd__dump_split_index(int argc, const char **argv);
12
int cmd__lazy_init_name_hash(int argc, const char **argv);
13
int cmd__sha1(int argc, const char **argv);
14
t/t0090-cache-tree.sh
+2
-2
@@ -246,9 +246,9 @@ test_expect_success 'switching trees does not invalidate shared index' '
246
git update-index --split-index &&
247
>split &&
248
git add split &&
249
- test-dump-split-index .git/index | grep -v ^own >before &&
249
+ test-tool dump-split-index .git/index | grep -v ^own >before &&
250
git commit -m "as-is" &&
251
- test-dump-split-index .git/index | grep -v ^own >after &&
251
+ test-tool dump-split-index .git/index | grep -v ^own >after &&
252
test_cmp before after
253
'
254
t/t1700-split-index.sh
+24
-24
@@ -11,7 +11,7 @@ sane_unset GIT_FSMONITOR_TEST
11
test_expect_success 'enable split index' '
12
git config splitIndex.maxPercentChange 100 &&
13
git update-index --split-index &&
14
- test-dump-split-index .git/index >actual &&
14
+ test-tool dump-split-index .git/index >actual &&
15
indexversion=$(test-index-version <.git/index) &&
16
if test "$indexversion" = "4"
17
then
@@ -39,7 +39,7 @@ test_expect_success 'add one file' '
39
EOF
40
test_cmp ls-files.expect ls-files.actual &&
41
42
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
42
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
43
cat >expect <<-EOF &&
44
base $base
45
100644 $EMPTY_BLOB 0 one
@@ -57,8 +57,8 @@ test_expect_success 'disable split index' '
57
EOF
58
test_cmp ls-files.expect ls-files.actual &&
59
60
- BASE=$(test-dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
61
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
60
+ BASE=$(test-tool dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
61
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
62
cat >expect <<-EOF &&
63
not a split index
64
EOF
@@ -73,7 +73,7 @@ test_expect_success 'enable split index again, "one" now belongs to base index"'
73
EOF
74
test_cmp ls-files.expect ls-files.actual &&
75
76
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
76
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
77
cat >expect <<-EOF &&
78
$BASE
79
replacements:
@@ -91,7 +91,7 @@ test_expect_success 'modify original file, base index untouched' '
91
EOF
92
test_cmp ls-files.expect ls-files.actual &&
93
94
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
94
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
95
q_to_tab >expect <<-EOF &&
96
$BASE
97
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -111,7 +111,7 @@ test_expect_success 'add another file, which stays index' '
111
EOF
112
test_cmp ls-files.expect ls-files.actual &&
113
114
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
114
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
115
q_to_tab >expect <<-EOF &&
116
$BASE
117
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -130,7 +130,7 @@ test_expect_success 'remove file not in base index' '
130
EOF
131
test_cmp ls-files.expect ls-files.actual &&
132
133
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
133
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
134
q_to_tab >expect <<-EOF &&
135
$BASE
136
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -147,7 +147,7 @@ test_expect_success 'remove file in base index' '
147
EOF
148
test_cmp ls-files.expect ls-files.actual &&
149
150
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
150
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
151
cat >expect <<-EOF &&
152
$BASE
153
replacements:
@@ -165,7 +165,7 @@ test_expect_success 'add original file back' '
165
EOF
166
test_cmp ls-files.expect ls-files.actual &&
167
168
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
168
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
169
cat >expect <<-EOF &&
170
$BASE
171
100644 $EMPTY_BLOB 0 one
@@ -195,7 +195,7 @@ test_expect_success 'unify index, two files remain' '
195
EOF
196
test_cmp ls-files.expect ls-files.actual &&
197
198
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
198
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
199
cat >expect <<-EOF &&
200
not a split index
201
EOF
@@ -229,8 +229,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
229
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
230
EOF
231
test_cmp ls-files.expect ls-files.actual &&
232
- BASE=$(test-dump-split-index .git/index | grep "^base") &&
233
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
232
+ BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
233
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
234
cat >expect <<-EOF &&
235
$BASE
236
replacements:
@@ -248,7 +248,7 @@ test_expect_success 'set core.splitIndex config variable to false' '
248
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
249
EOF
250
test_cmp ls-files.expect ls-files.actual &&
251
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
251
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
252
cat >expect <<-EOF &&
253
not a split index
254
EOF
@@ -259,8 +259,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
259
git config core.splitIndex true &&
260
: >three &&
261
git update-index --add three &&
262
- BASE=$(test-dump-split-index .git/index | grep "^base") &&
263
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
262
+ BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
263
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
264
cat >expect <<-EOF &&
265
$BASE
266
replacements:
@@ -269,7 +269,7 @@ test_expect_success 'set core.splitIndex config variable to true' '
269
test_cmp expect actual &&
270
: >four &&
271
git update-index --add four &&
272
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
272
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
273
cat >expect <<-EOF &&
274
$BASE
275
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 four
@@ -283,8 +283,8 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
283
git config --unset splitIndex.maxPercentChange &&
284
: >five &&
285
git update-index --add five &&
286
- BASE=$(test-dump-split-index .git/index | grep "^base") &&
287
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
286
+ BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
287
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
288
cat >expect <<-EOF &&
289
$BASE
290
replacements:
@@ -293,7 +293,7 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
293
test_cmp expect actual &&
294
: >six &&
295
git update-index --add six &&
296
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
296
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
297
cat >expect <<-EOF &&
298
$BASE
299
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 six
@@ -307,8 +307,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
307
git config splitIndex.maxPercentChange 0 &&
308
: >seven &&
309
git update-index --add seven &&
310
- BASE=$(test-dump-split-index .git/index | grep "^base") &&
311
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
310
+ BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
311
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
312
cat >expect <<-EOF &&
313
$BASE
314
replacements:
@@ -317,8 +317,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
317
test_cmp expect actual &&
318
: >eight &&
319
git update-index --add eight &&
320
- BASE=$(test-dump-split-index .git/index | grep "^base") &&
321
- test-dump-split-index .git/index | sed "/^own/d" >actual &&
320
+ BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
321
+ test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
322
cat >expect <<-EOF &&
323
$BASE
324
replacements: