t/helper: merge test-scrap-cache-tree 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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2018-03-24 08:44:56 +01:00 committed by Junio C Hamano
parent ae6a51f5a1
commit ff5fb8b034
5 changed files with 9 additions and 6 deletions

View File

@ -676,6 +676,7 @@ TEST_BUILTINS_OBJS += test-ref-store.o
TEST_BUILTINS_OBJS += test-regex.o TEST_BUILTINS_OBJS += test-regex.o
TEST_BUILTINS_OBJS += test-revision-walking.o TEST_BUILTINS_OBJS += test-revision-walking.o
TEST_BUILTINS_OBJS += test-run-command.o TEST_BUILTINS_OBJS += test-run-command.o
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
TEST_BUILTINS_OBJS += test-sha1.o TEST_BUILTINS_OBJS += test-sha1.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@ -684,7 +685,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-line-buffer TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-write-cache TEST_PROGRAMS_NEED_X += test-write-cache
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
TEST_PROGRAMS_NEED_X += test-sha1-array TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain TEST_PROGRAMS_NEED_X += test-sigchain
TEST_PROGRAMS_NEED_X += test-strcmp-offset TEST_PROGRAMS_NEED_X += test-strcmp-offset

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h" #include "cache.h"
#include "lockfile.h" #include "lockfile.h"
#include "tree.h" #include "tree.h"
@ -5,7 +6,7 @@
static struct lock_file index_lock; static struct lock_file index_lock;
int cmd_main(int ac, const char **av) int cmd__scrap_cache_tree(int ac, const char **av)
{ {
setup_git_directory(); setup_git_directory();
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR); hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);

View File

@ -31,6 +31,7 @@ static struct test_cmd cmds[] = {
{ "regex", cmd__regex }, { "regex", cmd__regex },
{ "revision-walking", cmd__revision_walking }, { "revision-walking", cmd__revision_walking },
{ "run-command", cmd__run_command }, { "run-command", cmd__run_command },
{ "scrap-cache-tree", cmd__scrap_cache_tree },
{ "sha1", cmd__sha1 }, { "sha1", cmd__sha1 },
}; };

View File

@ -25,6 +25,7 @@ int cmd__ref_store(int argc, const char **argv);
int cmd__regex(int argc, const char **argv); int cmd__regex(int argc, const char **argv);
int cmd__revision_walking(int argc, const char **argv); int cmd__revision_walking(int argc, const char **argv);
int cmd__run_command(int argc, const char **argv); int cmd__run_command(int argc, const char **argv);
int cmd__scrap_cache_tree(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv); int cmd__sha1(int argc, const char **argv);
#endif #endif

View File

@ -115,14 +115,14 @@ test_expect_success 'update-index invalidates cache-tree' '
' '
test_expect_success 'write-tree establishes cache-tree' ' test_expect_success 'write-tree establishes cache-tree' '
test-scrap-cache-tree && test-tool scrap-cache-tree &&
git write-tree && git write-tree &&
test_cache_tree test_cache_tree
' '
test_expect_success 'test-scrap-cache-tree works' ' test_expect_success 'test-tool scrap-cache-tree works' '
git read-tree HEAD && git read-tree HEAD &&
test-scrap-cache-tree && test-tool scrap-cache-tree &&
test_no_cache_tree test_no_cache_tree
' '
@ -170,7 +170,7 @@ test_expect_success 'commit in child dir has cache-tree' '
' '
test_expect_success 'reset --hard gives cache-tree' ' test_expect_success 'reset --hard gives cache-tree' '
test-scrap-cache-tree && test-tool scrap-cache-tree &&
git reset --hard && git reset --hard &&
test_cache_tree test_cache_tree
' '