Skip to content

Commit dae2ff9

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-sha1 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>
1 parent 0e49649 commit dae2ff9

File tree

8 files changed

+11
-8
lines changed

8 files changed

+11
-8
lines changed

Documentation/howto/recover-corrupted-object-harder.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ valid pack like:
8080
# now add our object data
8181
cat object >>tmp.pack
8282
# and then append the pack trailer
83-
/path/to/git.git/test-sha1 -b <tmp.pack >trailer
83+
/path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
8484
cat trailer >>tmp.pack
8585
------------
8686

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ X =
653653
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
654654

655655
TEST_BUILTINS_OBJS += test-chmtime.o
656+
TEST_BUILTINS_OBJS += test-sha1.o
656657

657658
TEST_PROGRAMS_NEED_X += test-ctype
658659
TEST_PROGRAMS_NEED_X += test-config
@@ -684,7 +685,6 @@ TEST_PROGRAMS_NEED_X += test-regex
684685
TEST_PROGRAMS_NEED_X += test-revision-walking
685686
TEST_PROGRAMS_NEED_X += test-run-command
686687
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
687-
TEST_PROGRAMS_NEED_X += test-sha1
688688
TEST_PROGRAMS_NEED_X += test-sha1-array
689689
TEST_PROGRAMS_NEED_X += test-sigchain
690690
TEST_PROGRAMS_NEED_X += test-strcmp-offset
@@ -2502,7 +2502,7 @@ t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
25022502
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
25032503
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
25042504

2505-
check-sha1:: t/helper/test-sha1$X
2505+
check-sha1:: t/helper/test-tool$X
25062506
t/helper/test-sha1.sh
25072507

25082508
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))

t/helper/test-sha1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23

3-
int cmd_main(int ac, const char **av)
4+
int cmd__sha1(int ac, const char **av)
45
{
56
git_SHA_CTX ctx;
67
unsigned char sha1[20];

t/helper/test-sha1.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
4-
/usr/bin/time t/helper/test-sha1 >/dev/null
4+
/usr/bin/time t/helper/test-tool sha1 >/dev/null
55

66
while read expect cnt pfx
77
do
@@ -11,7 +11,7 @@ do
1111
test -z "$pfx" || echo "$pfx"
1212
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
1313
perl -pe 'y/\000/g/'
14-
} | ./t/helper/test-sha1 $cnt
14+
} | ./t/helper/test-tool sha1 $cnt
1515
)
1616
if test "$expect" = "$actual"
1717
then

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct test_cmd {
88

99
static struct test_cmd cmds[] = {
1010
{ "chmtime", cmd__chmtime },
11+
{ "sha1", cmd__sha1 },
1112
};
1213

1314
int cmd_main(int argc, const char **argv)

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
#define __TEST_TOOL_H__
33

44
int cmd__chmtime(int argc, const char **argv);
5+
int cmd__sha1(int argc, const char **argv);
56

67
#endif

t/lib-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pack_obj () {
8585

8686
# Compute and append pack trailer to "$1"
8787
pack_trailer () {
88-
test-sha1 -b <"$1" >trailer.tmp &&
88+
test-tool sha1 -b <"$1" >trailer.tmp &&
8989
cat trailer.tmp >>"$1" &&
9090
rm -f trailer.tmp
9191
}

t/t0013-sha1dc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ then
1111
fi
1212

1313
test_expect_success 'test-sha1 detects shattered pdf' '
14-
test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
14+
test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
1515
test_i18ngrep collision err &&
1616
grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
1717
'

0 commit comments

Comments
 (0)