1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-07 20:56:09 +02:00

t/helper: merge test-dump-untracked-cache 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-09-09 19:36:27 +02:00 committed by Junio C Hamano
parent a0fe6e6e87
commit cd780f0b69
6 changed files with 41 additions and 38 deletions

View File

@ -710,6 +710,7 @@ 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-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
@ -741,7 +742,6 @@ TEST_BUILTINS_OBJS += test-wildmatch.o
TEST_BUILTINS_OBJS += test-write-cache.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options

View File

@ -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;

View File

@ -15,6 +15,7 @@ static struct test_cmd cmds[] = {
{ "drop-caches", cmd__drop_caches },
{ "dump-cache-tree", cmd__dump_cache_tree },
{ "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 },

View File

@ -11,6 +11,7 @@ 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_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);

View File

@ -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

View File

@ -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 &&