Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t/helper: merge test-sha1 into test-tool
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 24 Mar 2018 07:44:32 +0000
(08:44 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 27 Mar 2018 15:45:47 +0000
(08:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/howto/recover-corrupted-object-harder.txt
patch
|
blob
|
history
Makefile
patch
|
blob
|
history
t/helper/test-sha1.c
patch
|
blob
|
history
t/helper/test-sha1.sh
patch
|
blob
|
history
t/helper/test-tool.c
patch
|
blob
|
history
t/helper/test-tool.h
patch
|
blob
|
history
t/lib-pack.sh
patch
|
blob
|
history
t/t0013-sha1dc.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0e49649
)
diff --git
a/Documentation/howto/recover-corrupted-object-harder.txt
b/Documentation/howto/recover-corrupted-object-harder.txt
index 9c4cd0915fe3f3e14879184f3a474e559130bdef..8994e2559eac0c5746ca898b0bad1946a7b83298 100644
(file)
--- a/
Documentation/howto/recover-corrupted-object-harder.txt
+++ b/
Documentation/howto/recover-corrupted-object-harder.txt
@@
-80,7
+80,7
@@
valid pack like:
# now add our object data
cat object >>tmp.pack
# and then append the pack trailer
# now add our object data
cat object >>tmp.pack
# and then append the pack trailer
- /path/to/git.git/t
est-
sha1 -b <tmp.pack >trailer
+ /path/to/git.git/t
/helper/test-tool
sha1 -b <tmp.pack >trailer
cat trailer >>tmp.pack
------------
cat trailer >>tmp.pack
------------
diff --git
a/Makefile
b/Makefile
index 416a8e39c1d636f0597f3c3a3cc642714ef13aa1..3c0d0474af54cb22a6405d6dfd5ae6fbc9a7b581 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-653,6
+653,7
@@
X =
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
TEST_BUILTINS_OBJS += test-chmtime.o
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-sha1.o
TEST_PROGRAMS_NEED_X += test-ctype
TEST_PROGRAMS_NEED_X += test-config
TEST_PROGRAMS_NEED_X += test-ctype
TEST_PROGRAMS_NEED_X += test-config
@@
-684,7
+685,6
@@
TEST_PROGRAMS_NEED_X += test-regex
TEST_PROGRAMS_NEED_X += test-revision-walking
TEST_PROGRAMS_NEED_X += test-run-command
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
TEST_PROGRAMS_NEED_X += test-revision-walking
TEST_PROGRAMS_NEED_X += test-run-command
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
-TEST_PROGRAMS_NEED_X += test-sha1
TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain
TEST_PROGRAMS_NEED_X += test-strcmp-offset
TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain
TEST_PROGRAMS_NEED_X += test-strcmp-offset
@@
-2502,7
+2502,7
@@
t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
-check-sha1:: t/helper/test-
sha1
$X
+check-sha1:: t/helper/test-
tool
$X
t/helper/test-sha1.sh
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
t/helper/test-sha1.sh
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
diff --git
a/t/helper/test-sha1.c
b/t/helper/test-sha1.c
index a1c13f54eca0db7d11a5df134d565171d70b8cce..1ba0675c75f0d2dab281d054b577272cd45c39f9 100644
(file)
--- a/
t/helper/test-sha1.c
+++ b/
t/helper/test-sha1.c
@@
-1,6
+1,7
@@
+#include "test-tool.h"
#include "cache.h"
#include "cache.h"
-int cmd_
main
(int ac, const char **av)
+int cmd_
_sha1
(int ac, const char **av)
{
git_SHA_CTX ctx;
unsigned char sha1[20];
{
git_SHA_CTX ctx;
unsigned char sha1[20];
diff --git
a/t/helper/test-sha1.sh
b/t/helper/test-sha1.sh
index 750b95a0a1c39b4d761b7f2f861f6df4c85ecb65..84594885c703887c3b09aceb51583b9895ac3b45 100755
(executable)
--- a/
t/helper/test-sha1.sh
+++ b/
t/helper/test-sha1.sh
@@
-1,7
+1,7
@@
#!/bin/sh
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
#!/bin/sh
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time t/helper/test-sha1 >/dev/null
+/usr/bin/time t/helper/test-
tool
sha1 >/dev/null
while read expect cnt pfx
do
while read expect cnt pfx
do
@@
-11,7
+11,7
@@
do
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
perl -pe 'y/\000/g/'
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
perl -pe 'y/\000/g/'
- } | ./t/helper/test-sha1 $cnt
+ } | ./t/helper/test-
tool
sha1 $cnt
)
if test "$expect" = "$actual"
then
)
if test "$expect" = "$actual"
then
diff --git
a/t/helper/test-tool.c
b/t/helper/test-tool.c
index 0b1abe1ea24b9cde1f94b3bf0696b109a4a4c24d..11795130a695b87674480a1b8e13782c83729b16 100644
(file)
--- a/
t/helper/test-tool.c
+++ b/
t/helper/test-tool.c
@@
-8,6
+8,7
@@
struct test_cmd {
static struct test_cmd cmds[] = {
{ "chmtime", cmd__chmtime },
static struct test_cmd cmds[] = {
{ "chmtime", cmd__chmtime },
+ { "sha1", cmd__sha1 },
};
int cmd_main(int argc, const char **argv)
};
int cmd_main(int argc, const char **argv)
diff --git
a/t/helper/test-tool.h
b/t/helper/test-tool.h
index 3a35e70e79e45448a393e3fb5d2fd44e97d935a2..a05b8bd14c4f1a79b787e597d12325a11e99654d 100644
(file)
--- a/
t/helper/test-tool.h
+++ b/
t/helper/test-tool.h
@@
-2,5
+2,6
@@
#define __TEST_TOOL_H__
int cmd__chmtime(int argc, const char **argv);
#define __TEST_TOOL_H__
int cmd__chmtime(int argc, const char **argv);
+int cmd__sha1(int argc, const char **argv);
#endif
#endif
diff --git
a/t/lib-pack.sh
b/t/lib-pack.sh
index 75098465716512a3373e64d51a5cdf848e9f1101..501078249dc7d5d5b27dd6b75a22086767a0eddf 100644
(file)
--- a/
t/lib-pack.sh
+++ b/
t/lib-pack.sh
@@
-85,7
+85,7
@@
pack_obj () {
# Compute and append pack trailer to "$1"
pack_trailer () {
# Compute and append pack trailer to "$1"
pack_trailer () {
- test-sha1 -b <"$1" >trailer.tmp &&
+ test-
tool
sha1 -b <"$1" >trailer.tmp &&
cat trailer.tmp >>"$1" &&
rm -f trailer.tmp
}
cat trailer.tmp >>"$1" &&
rm -f trailer.tmp
}
diff --git
a/t/t0013-sha1dc.sh
b/t/t0013-sha1dc.sh
index 6d655cb161b2ed39eda97bb4acb54d1cf74a826d..419f31a8f7d4cb20041f054d25ddb25c7d43e3fb 100755
(executable)
--- a/
t/t0013-sha1dc.sh
+++ b/
t/t0013-sha1dc.sh
@@
-11,7
+11,7
@@
then
fi
test_expect_success 'test-sha1 detects shattered pdf' '
fi
test_expect_success 'test-sha1 detects shattered pdf' '
- test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
+ test_must_fail test-
tool
sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
test_i18ngrep collision err &&
grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
'
test_i18ngrep collision err &&
grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
'