mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
t/helper: merge test-submodule-config 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:
parent
c932a5ff28
commit
b618821306
2
Makefile
2
Makefile
|
@ -682,6 +682,7 @@ TEST_BUILTINS_OBJS += test-sha1.o
|
||||||
TEST_BUILTINS_OBJS += test-sigchain.o
|
TEST_BUILTINS_OBJS += test-sigchain.o
|
||||||
TEST_BUILTINS_OBJS += test-strcmp-offset.o
|
TEST_BUILTINS_OBJS += test-strcmp-offset.o
|
||||||
TEST_BUILTINS_OBJS += test-string-list.o
|
TEST_BUILTINS_OBJS += test-string-list.o
|
||||||
|
TEST_BUILTINS_OBJS += test-submodule-config.o
|
||||||
|
|
||||||
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
|
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
|
||||||
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
|
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
|
||||||
|
@ -689,7 +690,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-submodule-config
|
|
||||||
TEST_PROGRAMS_NEED_X += test-subprocess
|
TEST_PROGRAMS_NEED_X += test-subprocess
|
||||||
TEST_PROGRAMS_NEED_X += test-svn-fe
|
TEST_PROGRAMS_NEED_X += test-svn-fe
|
||||||
TEST_PROGRAMS_NEED_X += test-tool
|
TEST_PROGRAMS_NEED_X += test-tool
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "test-tool.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "submodule-config.h"
|
#include "submodule-config.h"
|
||||||
|
@ -10,7 +11,7 @@ static void die_usage(int argc, const char **argv, const char *msg)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_main(int argc, const char **argv)
|
int cmd__submodule_config(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
const char **arg = argv;
|
const char **arg = argv;
|
||||||
int my_argc = argc;
|
int my_argc = argc;
|
||||||
|
|
|
@ -37,6 +37,7 @@ static struct test_cmd cmds[] = {
|
||||||
{ "sigchain", cmd__sigchain },
|
{ "sigchain", cmd__sigchain },
|
||||||
{ "strcmp-offset", cmd__strcmp_offset },
|
{ "strcmp-offset", cmd__strcmp_offset },
|
||||||
{ "string-list", cmd__string_list },
|
{ "string-list", cmd__string_list },
|
||||||
|
{ "submodule-config", cmd__submodule_config },
|
||||||
};
|
};
|
||||||
|
|
||||||
int cmd_main(int argc, const char **argv)
|
int cmd_main(int argc, const char **argv)
|
||||||
|
|
|
@ -31,5 +31,6 @@ int cmd__sha1(int argc, const char **argv);
|
||||||
int cmd__sigchain(int argc, const char **argv);
|
int cmd__sigchain(int argc, const char **argv);
|
||||||
int cmd__strcmp_offset(int argc, const char **argv);
|
int cmd__strcmp_offset(int argc, const char **argv);
|
||||||
int cmd__string_list(int argc, const char **argv);
|
int cmd__string_list(int argc, const char **argv);
|
||||||
|
int cmd__submodule_config(int argc, const char **argv);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,7 +41,7 @@ test_expect_success 'configuration parsing with error' '
|
||||||
EOF
|
EOF
|
||||||
(
|
(
|
||||||
cd repo &&
|
cd repo &&
|
||||||
test_must_fail test-submodule-config "" s 2>actual &&
|
test_must_fail test-tool submodule-config "" s 2>actual &&
|
||||||
test_i18ngrep "bad config" actual
|
test_i18ngrep "bad config" actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
@ -55,7 +55,7 @@ EOF
|
||||||
|
|
||||||
test_expect_success 'test parsing and lookup of submodule config by path' '
|
test_expect_success 'test parsing and lookup of submodule config by path' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
test-submodule-config \
|
test-tool submodule-config \
|
||||||
HEAD^ a \
|
HEAD^ a \
|
||||||
HEAD b \
|
HEAD b \
|
||||||
HEAD^ submodule \
|
HEAD^ submodule \
|
||||||
|
@ -67,7 +67,7 @@ test_expect_success 'test parsing and lookup of submodule config by path' '
|
||||||
|
|
||||||
test_expect_success 'test parsing and lookup of submodule config by name' '
|
test_expect_success 'test parsing and lookup of submodule config by name' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
test-submodule-config --name \
|
test-tool submodule-config --name \
|
||||||
HEAD^ a \
|
HEAD^ a \
|
||||||
HEAD a \
|
HEAD a \
|
||||||
HEAD^ submodule \
|
HEAD^ submodule \
|
||||||
|
@ -89,7 +89,7 @@ test_expect_success 'error in one submodule config lets continue' '
|
||||||
git add .gitmodules &&
|
git add .gitmodules &&
|
||||||
mv .gitmodules.bak .gitmodules &&
|
mv .gitmodules.bak .gitmodules &&
|
||||||
git commit -m "add error" &&
|
git commit -m "add error" &&
|
||||||
test-submodule-config \
|
test-tool submodule-config \
|
||||||
HEAD b \
|
HEAD b \
|
||||||
HEAD submodule \
|
HEAD submodule \
|
||||||
>actual &&
|
>actual &&
|
||||||
|
@ -100,7 +100,7 @@ test_expect_success 'error in one submodule config lets continue' '
|
||||||
test_expect_success 'error message contains blob reference' '
|
test_expect_success 'error message contains blob reference' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
sha1=$(git rev-parse HEAD) &&
|
sha1=$(git rev-parse HEAD) &&
|
||||||
test-submodule-config \
|
test-tool submodule-config \
|
||||||
HEAD b \
|
HEAD b \
|
||||||
HEAD submodule \
|
HEAD submodule \
|
||||||
2>actual_err &&
|
2>actual_err &&
|
||||||
|
@ -114,9 +114,9 @@ test_expect_success 'using different treeishs works' '
|
||||||
git tag new_tag &&
|
git tag new_tag &&
|
||||||
tree=$(git rev-parse HEAD^{tree}) &&
|
tree=$(git rev-parse HEAD^{tree}) &&
|
||||||
commit=$(git rev-parse HEAD^{commit}) &&
|
commit=$(git rev-parse HEAD^{commit}) &&
|
||||||
test-submodule-config $commit b >expect &&
|
test-tool submodule-config $commit b >expect &&
|
||||||
test-submodule-config $tree b >actual.1 &&
|
test-tool submodule-config $tree b >actual.1 &&
|
||||||
test-submodule-config new_tag b >actual.2 &&
|
test-tool submodule-config new_tag b >actual.2 &&
|
||||||
test_cmp expect actual.1 &&
|
test_cmp expect actual.1 &&
|
||||||
test_cmp expect actual.2
|
test_cmp expect actual.2
|
||||||
)
|
)
|
||||||
|
@ -130,7 +130,7 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
|
||||||
git config --unset -f .gitmodules \
|
git config --unset -f .gitmodules \
|
||||||
submodule.submodule.fetchrecursesubmodules &&
|
submodule.submodule.fetchrecursesubmodules &&
|
||||||
git commit -m "add error in fetchrecursesubmodules" &&
|
git commit -m "add error in fetchrecursesubmodules" &&
|
||||||
test-submodule-config \
|
test-tool submodule-config \
|
||||||
HEAD b \
|
HEAD b \
|
||||||
HEAD submodule \
|
HEAD submodule \
|
||||||
>actual &&
|
>actual &&
|
||||||
|
|
Loading…
Reference in a new issue