Merge branch 'nd/test-tool'
Test helper binaries clean-up. * nd/test-tool: Makefile: add a hint about TEST_BUILTINS_OBJS t/helper: merge test-dump-fsmonitor into test-tool t/helper: merge test-parse-options into test-tool t/helper: merge test-pkt-line into test-tool t/helper: merge test-dump-untracked-cache into test-tool t/helper: keep test-tool command list sorted
This commit is contained in:
commit
77b5046ae3
12
Makefile
12
Makefile
@ -709,7 +709,9 @@ TEST_BUILTINS_OBJS += test-date.o
|
||||
TEST_BUILTINS_OBJS += test-delta.o
|
||||
TEST_BUILTINS_OBJS += test-drop-caches.o
|
||||
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
|
||||
TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
|
||||
TEST_BUILTINS_OBJS += test-dump-split-index.o
|
||||
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
|
||||
TEST_BUILTINS_OBJS += test-example-decorate.o
|
||||
TEST_BUILTINS_OBJS += test-genrandom.o
|
||||
TEST_BUILTINS_OBJS += test-hashmap.o
|
||||
@ -720,7 +722,9 @@ TEST_BUILTINS_OBJS += test-match-trees.o
|
||||
TEST_BUILTINS_OBJS += test-mergesort.o
|
||||
TEST_BUILTINS_OBJS += test-mktemp.o
|
||||
TEST_BUILTINS_OBJS += test-online-cpus.o
|
||||
TEST_BUILTINS_OBJS += test-parse-options.o
|
||||
TEST_BUILTINS_OBJS += test-path-utils.o
|
||||
TEST_BUILTINS_OBJS += test-pkt-line.o
|
||||
TEST_BUILTINS_OBJS += test-prio-queue.o
|
||||
TEST_BUILTINS_OBJS += test-reach.o
|
||||
TEST_BUILTINS_OBJS += test-read-cache.o
|
||||
@ -731,8 +735,8 @@ TEST_BUILTINS_OBJS += test-repository.o
|
||||
TEST_BUILTINS_OBJS += test-revision-walking.o
|
||||
TEST_BUILTINS_OBJS += test-run-command.o
|
||||
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
|
||||
TEST_BUILTINS_OBJS += test-sha1-array.o
|
||||
TEST_BUILTINS_OBJS += test-sha1.o
|
||||
TEST_BUILTINS_OBJS += test-sha1-array.o
|
||||
TEST_BUILTINS_OBJS += test-sigchain.o
|
||||
TEST_BUILTINS_OBJS += test-strcmp-offset.o
|
||||
TEST_BUILTINS_OBJS += test-string-list.o
|
||||
@ -743,12 +747,10 @@ TEST_BUILTINS_OBJS += test-wildmatch.o
|
||||
TEST_BUILTINS_OBJS += test-windows-named-pipe.o
|
||||
TEST_BUILTINS_OBJS += test-write-cache.o
|
||||
|
||||
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
|
||||
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
|
||||
# Do not add more tests here unless they have extra dependencies. Add
|
||||
# them in TEST_BUILTINS_OBJS above.
|
||||
TEST_PROGRAMS_NEED_X += test-fake-ssh
|
||||
TEST_PROGRAMS_NEED_X += test-line-buffer
|
||||
TEST_PROGRAMS_NEED_X += test-parse-options
|
||||
TEST_PROGRAMS_NEED_X += test-pkt-line
|
||||
TEST_PROGRAMS_NEED_X += test-svn-fe
|
||||
TEST_PROGRAMS_NEED_X += test-tool
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "test-tool.h"
|
||||
#include "cache.h"
|
||||
|
||||
int cmd_main(int ac, const char **av)
|
||||
int cmd__dump_fsmonitor(int ac, const char **av)
|
||||
{
|
||||
struct index_state *istate = &the_index;
|
||||
int i;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "test-tool.h"
|
||||
#include "cache.h"
|
||||
#include "dir.h"
|
||||
|
||||
@ -38,7 +39,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
|
||||
strbuf_setlen(base, len);
|
||||
}
|
||||
|
||||
int cmd_main(int ac, const char **av)
|
||||
int cmd__dump_untracked_cache(int ac, const char **av)
|
||||
{
|
||||
struct untracked_cache *uc;
|
||||
struct strbuf base = STRBUF_INIT;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "test-tool.h"
|
||||
#include "cache.h"
|
||||
#include "parse-options.h"
|
||||
#include "string-list.h"
|
||||
@ -94,11 +95,11 @@ static void show(struct string_list *expect, int *status, const char *fmt, ...)
|
||||
strbuf_release(&buf);
|
||||
}
|
||||
|
||||
int cmd_main(int argc, const char **argv)
|
||||
int cmd__parse_options(int argc, const char **argv)
|
||||
{
|
||||
const char *prefix = "prefix/";
|
||||
const char *usage[] = {
|
||||
"test-parse-options <options>",
|
||||
"test-tool parse-options <options>",
|
||||
"",
|
||||
"A helper function for the parse-options API.",
|
||||
NULL
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "test-tool.h"
|
||||
#include "pkt-line.h"
|
||||
|
||||
static void pack_line(const char *line)
|
||||
@ -79,7 +80,7 @@ static void unpack_sideband(void)
|
||||
}
|
||||
}
|
||||
|
||||
int cmd_main(int argc, const char **argv)
|
||||
int cmd__pkt_line(int argc, const char **argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
die("too few arguments");
|
||||
|
@ -14,7 +14,9 @@ static struct test_cmd cmds[] = {
|
||||
{ "delta", cmd__delta },
|
||||
{ "drop-caches", cmd__drop_caches },
|
||||
{ "dump-cache-tree", cmd__dump_cache_tree },
|
||||
{ "dump-fsmonitor", cmd__dump_fsmonitor },
|
||||
{ "dump-split-index", cmd__dump_split_index },
|
||||
{ "dump-untracked-cache", cmd__dump_untracked_cache },
|
||||
{ "example-decorate", cmd__example_decorate },
|
||||
{ "genrandom", cmd__genrandom },
|
||||
{ "hashmap", cmd__hashmap },
|
||||
@ -25,7 +27,9 @@ static struct test_cmd cmds[] = {
|
||||
{ "mergesort", cmd__mergesort },
|
||||
{ "mktemp", cmd__mktemp },
|
||||
{ "online-cpus", cmd__online_cpus },
|
||||
{ "parse-options", cmd__parse_options },
|
||||
{ "path-utils", cmd__path_utils },
|
||||
{ "pkt-line", cmd__pkt_line },
|
||||
{ "prio-queue", cmd__prio_queue },
|
||||
{ "reach", cmd__reach },
|
||||
{ "read-cache", cmd__read_cache },
|
||||
@ -36,8 +40,8 @@ static struct test_cmd cmds[] = {
|
||||
{ "revision-walking", cmd__revision_walking },
|
||||
{ "run-command", cmd__run_command },
|
||||
{ "scrap-cache-tree", cmd__scrap_cache_tree },
|
||||
{ "sha1-array", cmd__sha1_array },
|
||||
{ "sha1", cmd__sha1 },
|
||||
{ "sha1-array", cmd__sha1_array },
|
||||
{ "sigchain", cmd__sigchain },
|
||||
{ "strcmp-offset", cmd__strcmp_offset },
|
||||
{ "string-list", cmd__string_list },
|
||||
|
@ -10,7 +10,9 @@ int cmd__date(int argc, const char **argv);
|
||||
int cmd__delta(int argc, const char **argv);
|
||||
int cmd__drop_caches(int argc, const char **argv);
|
||||
int cmd__dump_cache_tree(int argc, const char **argv);
|
||||
int cmd__dump_fsmonitor(int argc, const char **argv);
|
||||
int cmd__dump_split_index(int argc, const char **argv);
|
||||
int cmd__dump_untracked_cache(int argc, const char **argv);
|
||||
int cmd__example_decorate(int argc, const char **argv);
|
||||
int cmd__genrandom(int argc, const char **argv);
|
||||
int cmd__hashmap(int argc, const char **argv);
|
||||
@ -21,7 +23,9 @@ int cmd__match_trees(int argc, const char **argv);
|
||||
int cmd__mergesort(int argc, const char **argv);
|
||||
int cmd__mktemp(int argc, const char **argv);
|
||||
int cmd__online_cpus(int argc, const char **argv);
|
||||
int cmd__parse_options(int argc, const char **argv);
|
||||
int cmd__path_utils(int argc, const char **argv);
|
||||
int cmd__pkt_line(int argc, const char **argv);
|
||||
int cmd__prio_queue(int argc, const char **argv);
|
||||
int cmd__reach(int argc, const char **argv);
|
||||
int cmd__read_cache(int argc, const char **argv);
|
||||
@ -32,8 +36,8 @@ int cmd__repository(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__scrap_cache_tree(int argc, const char **argv);
|
||||
int cmd__sha1_array(int argc, const char **argv);
|
||||
int cmd__sha1(int argc, const char **argv);
|
||||
int cmd__sha1_array(int argc, const char **argv);
|
||||
int cmd__sigchain(int argc, const char **argv);
|
||||
int cmd__strcmp_offset(int argc, const char **argv);
|
||||
int cmd__string_list(int argc, const char **argv);
|
||||
|
@ -8,7 +8,7 @@ test_description='our own option parser'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat >expect <<\EOF
|
||||
usage: test-parse-options <options>
|
||||
usage: test-tool parse-options <options>
|
||||
|
||||
A helper function for the parse-options API.
|
||||
|
||||
@ -52,7 +52,7 @@ Standard options
|
||||
EOF
|
||||
|
||||
test_expect_success 'test help' '
|
||||
test_must_fail test-parse-options -h >output 2>output.err &&
|
||||
test_must_fail test-tool parse-options -h >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
@ -64,7 +64,7 @@ check () {
|
||||
shift &&
|
||||
expect="$1" &&
|
||||
shift &&
|
||||
test-parse-options --expect="$what $expect" "$@"
|
||||
test-tool parse-options --expect="$what $expect" "$@"
|
||||
}
|
||||
|
||||
check_unknown_i18n() {
|
||||
@ -75,7 +75,7 @@ check_unknown_i18n() {
|
||||
echo error: unknown switch \`${1#-}\' >expect ;;
|
||||
esac &&
|
||||
cat expect.err >>expect &&
|
||||
test_must_fail test-parse-options $* >output 2>output.err &&
|
||||
test_must_fail test-tool parse-options $* >output 2>output.err &&
|
||||
test_must_be_empty output &&
|
||||
test_i18ncmp expect output.err
|
||||
}
|
||||
@ -133,7 +133,7 @@ file: prefix/my.file
|
||||
EOF
|
||||
|
||||
test_expect_success 'short options' '
|
||||
test-parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
|
||||
test-tool parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
|
||||
>output 2>output.err &&
|
||||
test_cmp expect output &&
|
||||
test_must_be_empty output.err
|
||||
@ -153,7 +153,7 @@ file: prefix/fi.le
|
||||
EOF
|
||||
|
||||
test_expect_success 'long options' '
|
||||
test-parse-options --boolean --integer 1729 --magnitude 16k \
|
||||
test-tool parse-options --boolean --integer 1729 --magnitude 16k \
|
||||
--boolean --string2=321 --verbose --verbose --no-dry-run \
|
||||
--abbrev=10 --file fi.le --obsolete \
|
||||
>output 2>output.err &&
|
||||
@ -162,9 +162,9 @@ test_expect_success 'long options' '
|
||||
'
|
||||
|
||||
test_expect_success 'missing required value' '
|
||||
test_expect_code 129 test-parse-options -s &&
|
||||
test_expect_code 129 test-parse-options --string &&
|
||||
test_expect_code 129 test-parse-options --file
|
||||
test_expect_code 129 test-tool parse-options -s &&
|
||||
test_expect_code 129 test-tool parse-options --string &&
|
||||
test_expect_code 129 test-tool parse-options --file
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -184,7 +184,7 @@ arg 02: --boolean
|
||||
EOF
|
||||
|
||||
test_expect_success 'intermingled arguments' '
|
||||
test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
|
||||
test-tool parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
|
||||
>output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
@ -204,21 +204,21 @@ file: (not set)
|
||||
EOF
|
||||
|
||||
test_expect_success 'unambiguously abbreviated option' '
|
||||
test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
|
||||
test-tool parse-options --int 2 --boolean --no-bo >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'unambiguously abbreviated option with "="' '
|
||||
test-parse-options --expect="integer: 2" --int=2
|
||||
test-tool parse-options --expect="integer: 2" --int=2
|
||||
'
|
||||
|
||||
test_expect_success 'ambiguously abbreviated option' '
|
||||
test_expect_code 129 test-parse-options --strin 123
|
||||
test_expect_code 129 test-tool parse-options --strin 123
|
||||
'
|
||||
|
||||
test_expect_success 'non ambiguous option (after two options it abbreviates)' '
|
||||
test-parse-options --expect="string: 123" --st 123
|
||||
test-tool parse-options --expect="string: 123" --st 123
|
||||
'
|
||||
|
||||
cat >typo.err <<\EOF
|
||||
@ -226,7 +226,7 @@ error: did you mean `--boolean` (with two dashes ?)
|
||||
EOF
|
||||
|
||||
test_expect_success 'detect possible typos' '
|
||||
test_must_fail test-parse-options -boolean >output 2>output.err &&
|
||||
test_must_fail test-tool parse-options -boolean >output 2>output.err &&
|
||||
test_must_be_empty output &&
|
||||
test_cmp typo.err output.err
|
||||
'
|
||||
@ -236,13 +236,13 @@ error: did you mean `--ambiguous` (with two dashes ?)
|
||||
EOF
|
||||
|
||||
test_expect_success 'detect possible typos' '
|
||||
test_must_fail test-parse-options -ambiguous >output 2>output.err &&
|
||||
test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
|
||||
test_must_be_empty output &&
|
||||
test_cmp typo.err output.err
|
||||
'
|
||||
|
||||
test_expect_success 'keep some options as arguments' '
|
||||
test-parse-options --expect="arg 00: --quux" --quux
|
||||
test-tool parse-options --expect="arg 00: --quux" --quux
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -260,7 +260,7 @@ arg 00: foo
|
||||
EOF
|
||||
|
||||
test_expect_success 'OPT_DATE() works' '
|
||||
test-parse-options -t "1970-01-01 00:00:01 +0000" \
|
||||
test-tool parse-options -t "1970-01-01 00:00:01 +0000" \
|
||||
foo -q >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
@ -281,13 +281,13 @@ file: (not set)
|
||||
EOF
|
||||
|
||||
test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
|
||||
test-parse-options --length=four -b -4 >output 2>output.err &&
|
||||
test-tool parse-options --length=four -b -4 >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_CALLBACK() and callback errors work' '
|
||||
test_must_fail test-parse-options --no-length >output 2>output.err &&
|
||||
test_must_fail test-tool parse-options --no-length >output 2>output.err &&
|
||||
test_must_be_empty output &&
|
||||
test_must_be_empty output.err
|
||||
'
|
||||
@ -306,31 +306,31 @@ file: (not set)
|
||||
EOF
|
||||
|
||||
test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
|
||||
test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
|
||||
test-tool parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
|
||||
test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
|
||||
test-tool parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_BIT() works' '
|
||||
test-parse-options --expect="boolean: 6" -bb --or4
|
||||
test-tool parse-options --expect="boolean: 6" -bb --or4
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_NEGBIT() works' '
|
||||
test-parse-options --expect="boolean: 6" -bb --no-neg-or4
|
||||
test-tool parse-options --expect="boolean: 6" -bb --no-neg-or4
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
|
||||
test-parse-options --expect="boolean: 6" + + + + + +
|
||||
test-tool parse-options --expect="boolean: 6" + + + + + +
|
||||
'
|
||||
|
||||
test_expect_success 'OPT_NUMBER_CALLBACK() works' '
|
||||
test-parse-options --expect="integer: 12345" -12345
|
||||
test-tool parse-options --expect="integer: 12345" -12345
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -347,7 +347,7 @@ file: (not set)
|
||||
EOF
|
||||
|
||||
test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
|
||||
test-parse-options --no-ambig >output 2>output.err &&
|
||||
test-tool parse-options --no-ambig >output 2>output.err &&
|
||||
test_must_be_empty output.err &&
|
||||
test_cmp expect output
|
||||
'
|
||||
@ -358,38 +358,38 @@ list: bar
|
||||
list: baz
|
||||
EOF
|
||||
test_expect_success '--list keeps list of strings' '
|
||||
test-parse-options --list foo --list=bar --list=baz >output &&
|
||||
test-tool parse-options --list foo --list=bar --list=baz >output &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success '--no-list resets list' '
|
||||
test-parse-options --list=other --list=irrelevant --list=options \
|
||||
test-tool parse-options --list=other --list=irrelevant --list=options \
|
||||
--no-list --list=foo --list=bar --list=baz >output &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'multiple quiet levels' '
|
||||
test-parse-options --expect="quiet: 3" -q -q -q
|
||||
test-tool parse-options --expect="quiet: 3" -q -q -q
|
||||
'
|
||||
|
||||
test_expect_success 'multiple verbose levels' '
|
||||
test-parse-options --expect="verbose: 3" -v -v -v
|
||||
test-tool parse-options --expect="verbose: 3" -v -v -v
|
||||
'
|
||||
|
||||
test_expect_success '--no-quiet sets --quiet to 0' '
|
||||
test-parse-options --expect="quiet: 0" --no-quiet
|
||||
test-tool parse-options --expect="quiet: 0" --no-quiet
|
||||
'
|
||||
|
||||
test_expect_success '--no-quiet resets multiple -q to 0' '
|
||||
test-parse-options --expect="quiet: 0" -q -q -q --no-quiet
|
||||
test-tool parse-options --expect="quiet: 0" -q -q -q --no-quiet
|
||||
'
|
||||
|
||||
test_expect_success '--no-verbose sets verbose to 0' '
|
||||
test-parse-options --expect="verbose: 0" --no-verbose
|
||||
test-tool parse-options --expect="verbose: 0" --no-verbose
|
||||
'
|
||||
|
||||
test_expect_success '--no-verbose resets multiple verbose to 0' '
|
||||
test-parse-options --expect="verbose: 0" -v -v -v --no-verbose
|
||||
test-tool parse-options --expect="verbose: 0" -v -v -v --no-verbose
|
||||
'
|
||||
|
||||
test_done
|
||||
|
@ -15,13 +15,13 @@ test_expect_success 'test capability advertisement' '
|
||||
EOF
|
||||
|
||||
git serve --advertise-capabilities >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'stateless-rpc flag does not list capabilities' '
|
||||
# Empty request
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
0000
|
||||
EOF
|
||||
git serve --stateless-rpc >out <in &&
|
||||
@ -33,7 +33,7 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
|
||||
'
|
||||
|
||||
test_expect_success 'request invalid capability' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
foobar
|
||||
0000
|
||||
EOF
|
||||
@ -42,7 +42,7 @@ test_expect_success 'request invalid capability' '
|
||||
'
|
||||
|
||||
test_expect_success 'request with no command' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
agent=git/test
|
||||
0000
|
||||
EOF
|
||||
@ -51,7 +51,7 @@ test_expect_success 'request with no command' '
|
||||
'
|
||||
|
||||
test_expect_success 'request invalid command' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=foo
|
||||
agent=git/test
|
||||
0000
|
||||
@ -71,7 +71,7 @@ test_expect_success 'setup some refs and tags' '
|
||||
'
|
||||
|
||||
test_expect_success 'basics of ls-refs' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
0000
|
||||
EOF
|
||||
@ -88,12 +88,12 @@ test_expect_success 'basics of ls-refs' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'basic ref-prefixes' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
0001
|
||||
ref-prefix refs/heads/master
|
||||
@ -108,12 +108,12 @@ test_expect_success 'basic ref-prefixes' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'refs/heads prefix' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
0001
|
||||
ref-prefix refs/heads/
|
||||
@ -128,12 +128,12 @@ test_expect_success 'refs/heads prefix' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'peel parameter' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
0001
|
||||
peel
|
||||
@ -149,12 +149,12 @@ test_expect_success 'peel parameter' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'symrefs parameter' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
0001
|
||||
symrefs
|
||||
@ -170,12 +170,12 @@ test_expect_success 'symrefs parameter' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'sending server-options' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=ls-refs
|
||||
server-option=hello
|
||||
server-option=world
|
||||
@ -190,14 +190,14 @@ test_expect_success 'sending server-options' '
|
||||
EOF
|
||||
|
||||
git serve --stateless-rpc <in >out &&
|
||||
test-pkt-line unpack <out >actual &&
|
||||
test-tool pkt-line unpack <out >actual &&
|
||||
test_cmp actual expect
|
||||
'
|
||||
|
||||
test_expect_success 'unexpected lines are not allowed in fetch request' '
|
||||
git init server &&
|
||||
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
this-is-not-a-command
|
||||
|
@ -334,7 +334,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
|
||||
git -C server config uploadpack.allowfilter 0 &&
|
||||
|
||||
# Custom request that tries to filter even though it is not advertised.
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
want $(git -C server rev-parse master)
|
||||
|
@ -9,14 +9,14 @@ get_actual_refs () {
|
||||
/wanted-refs/d
|
||||
/0001/d
|
||||
p
|
||||
}' <out | test-pkt-line unpack >actual_refs
|
||||
}' <out | test-tool pkt-line unpack >actual_refs
|
||||
}
|
||||
|
||||
get_actual_commits () {
|
||||
sed -n -e '/packfile/,/0000/{
|
||||
/packfile/d
|
||||
p
|
||||
}' <out | test-pkt-line unpack-sideband >o.pack &&
|
||||
}' <out | test-tool pkt-line unpack-sideband >o.pack &&
|
||||
git index-pack o.pack &&
|
||||
git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits
|
||||
}
|
||||
@ -61,7 +61,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
|
||||
'
|
||||
|
||||
test_expect_success 'invalid want-ref line' '
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
no-progress
|
||||
@ -80,7 +80,7 @@ test_expect_success 'basic want-ref' '
|
||||
EOF
|
||||
git rev-parse f | sort >expected_commits &&
|
||||
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
no-progress
|
||||
@ -101,7 +101,7 @@ test_expect_success 'multiple want-ref lines' '
|
||||
EOF
|
||||
git rev-parse c d | sort >expected_commits &&
|
||||
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
no-progress
|
||||
@ -122,7 +122,7 @@ test_expect_success 'mix want and want-ref' '
|
||||
EOF
|
||||
git rev-parse e f | sort >expected_commits &&
|
||||
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
no-progress
|
||||
@ -143,7 +143,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
|
||||
EOF
|
||||
>expected_commits &&
|
||||
|
||||
test-pkt-line pack >in <<-EOF &&
|
||||
test-tool pkt-line pack >in <<-EOF &&
|
||||
command=fetch
|
||||
0001
|
||||
no-progress
|
||||
|
@ -55,7 +55,7 @@ test_expect_success 'setup' '
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache is empty' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect-empty <<EOF &&
|
||||
info/exclude 0000000000000000000000000000000000000000
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -106,7 +106,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache after first status' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../dump.expect ../actual
|
||||
'
|
||||
|
||||
@ -126,7 +126,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache after second status' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../dump.expect ../actual
|
||||
'
|
||||
|
||||
@ -157,7 +157,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude $EMPTY_BLOB
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -204,7 +204,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude $EMPTY_BLOB
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -248,7 +248,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -267,7 +267,7 @@ EOF
|
||||
|
||||
test_expect_success 'move two from tracked to untracked' '
|
||||
git rm --cached two &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -304,7 +304,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -324,7 +324,7 @@ EOF
|
||||
|
||||
test_expect_success 'move two from untracked to tracked' '
|
||||
git add two &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -361,7 +361,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -405,7 +405,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache correct after commit' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -464,7 +464,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache correct after status' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -532,7 +532,7 @@ EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked cache dump (sparse/subdirs)' '
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
cat >../expect-from-test-dump <<EOF &&
|
||||
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
|
||||
core.excludesfile 0000000000000000000000000000000000000000
|
||||
@ -598,66 +598,66 @@ EOF
|
||||
|
||||
test_expect_success '--no-untracked-cache removes the cache' '
|
||||
git update-index --no-untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
echo "no untracked cache" >../expect-no-uc &&
|
||||
test_cmp ../expect-no-uc ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'git status does not change anything' '
|
||||
git status &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-no-uc ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'setting core.untrackedCache to true and using git status creates the cache' '
|
||||
git config core.untrackedCache true &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-no-uc ../actual &&
|
||||
git status &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-from-test-dump ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'using --no-untracked-cache does not fail when core.untrackedCache is true' '
|
||||
git update-index --no-untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-no-uc ../actual &&
|
||||
git update-index --untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-empty ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'setting core.untrackedCache to false and using git status removes the cache' '
|
||||
git config core.untrackedCache false &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-empty ../actual &&
|
||||
git status &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-no-uc ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'using --untracked-cache does not fail when core.untrackedCache is false' '
|
||||
git update-index --untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-empty ../actual
|
||||
'
|
||||
|
||||
test_expect_success 'setting core.untrackedCache to keep' '
|
||||
git config core.untrackedCache keep &&
|
||||
git update-index --untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-empty ../actual &&
|
||||
git status &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-from-test-dump ../actual &&
|
||||
git update-index --no-untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-no-uc ../actual &&
|
||||
git update-index --force-untracked-cache &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-empty ../actual &&
|
||||
git status &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
test_cmp ../expect-from-test-dump ../actual
|
||||
'
|
||||
|
||||
@ -671,23 +671,23 @@ test_expect_success 'test ident field is working' '
|
||||
|
||||
test_expect_success 'untracked cache survives a checkout' '
|
||||
git commit --allow-empty -m empty &&
|
||||
test-dump-untracked-cache >../before &&
|
||||
test-tool dump-untracked-cache >../before &&
|
||||
test_when_finished "git checkout master" &&
|
||||
git checkout -b other_branch &&
|
||||
test-dump-untracked-cache >../after &&
|
||||
test-tool dump-untracked-cache >../after &&
|
||||
test_cmp ../before ../after &&
|
||||
test_commit test &&
|
||||
test-dump-untracked-cache >../before &&
|
||||
test-tool dump-untracked-cache >../before &&
|
||||
git checkout master &&
|
||||
test-dump-untracked-cache >../after &&
|
||||
test-tool dump-untracked-cache >../after &&
|
||||
test_cmp ../before ../after
|
||||
'
|
||||
|
||||
test_expect_success 'untracked cache survives a commit' '
|
||||
test-dump-untracked-cache >../before &&
|
||||
test-tool dump-untracked-cache >../before &&
|
||||
git add done/two &&
|
||||
git commit -m commit &&
|
||||
test-dump-untracked-cache >../after &&
|
||||
test-tool dump-untracked-cache >../after &&
|
||||
test_cmp ../before ../after
|
||||
'
|
||||
|
||||
@ -751,7 +751,7 @@ test_expect_success '"status" after file replacement should be clean with UC=tru
|
||||
git checkout master &&
|
||||
avoid_racy &&
|
||||
status_is_clean &&
|
||||
test-dump-untracked-cache >../actual &&
|
||||
test-tool dump-untracked-cache >../actual &&
|
||||
grep -F "recurse valid" ../actual >../actual.grep &&
|
||||
cat >../expect.grep <<EOF &&
|
||||
/ 0000000000000000000000000000000000000000 recurse valid
|
||||
|
@ -84,21 +84,21 @@ test_expect_success 'setup' '
|
||||
|
||||
# test that the fsmonitor extension is off by default
|
||||
test_expect_success 'fsmonitor extension is off by default' '
|
||||
test-dump-fsmonitor >actual &&
|
||||
test-tool dump-fsmonitor >actual &&
|
||||
grep "^no fsmonitor" actual
|
||||
'
|
||||
|
||||
# test that "update-index --fsmonitor" adds the fsmonitor extension
|
||||
test_expect_success 'update-index --fsmonitor" adds the fsmonitor extension' '
|
||||
git update-index --fsmonitor &&
|
||||
test-dump-fsmonitor >actual &&
|
||||
test-tool dump-fsmonitor >actual &&
|
||||
grep "^fsmonitor last update" actual
|
||||
'
|
||||
|
||||
# test that "update-index --no-fsmonitor" removes the fsmonitor extension
|
||||
test_expect_success 'update-index --no-fsmonitor" removes the fsmonitor extension' '
|
||||
git update-index --no-fsmonitor &&
|
||||
test-dump-fsmonitor >actual &&
|
||||
test-tool dump-fsmonitor >actual &&
|
||||
grep "^no fsmonitor" actual
|
||||
'
|
||||
|
||||
@ -307,9 +307,9 @@ test_expect_success 'splitting the index results in the same state' '
|
||||
dirty_repo &&
|
||||
git update-index --fsmonitor &&
|
||||
git ls-files -f >expect &&
|
||||
test-dump-fsmonitor >&2 && echo &&
|
||||
test-tool dump-fsmonitor >&2 && echo &&
|
||||
git update-index --fsmonitor --split-index &&
|
||||
test-dump-fsmonitor >&2 && echo &&
|
||||
test-tool dump-fsmonitor >&2 && echo &&
|
||||
git ls-files -f >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
@ -333,7 +333,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
|
||||
git update-index --fsmonitor &&
|
||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-before" \
|
||||
git status &&
|
||||
test-dump-untracked-cache >../before
|
||||
test-tool dump-untracked-cache >../before
|
||||
) &&
|
||||
cat >>dot-git/.git/hooks/fsmonitor-test <<-\EOF &&
|
||||
printf ".git\0"
|
||||
@ -345,7 +345,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
|
||||
cd dot-git &&
|
||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-after" \
|
||||
git status &&
|
||||
test-dump-untracked-cache >../after
|
||||
test-tool dump-untracked-cache >../after
|
||||
) &&
|
||||
grep "directory invalidation" trace-before >>before &&
|
||||
grep "directory invalidation" trace-after >>after &&
|
||||
|
Loading…
Reference in New Issue
Block a user