From 32713b461256c42abd829ca62774649eb7182855 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 8 Jan 2007 18:38:32 +0100 Subject: [PATCH] Work around missing tools on MinGW. egrep cannot be called from the Windows command line. dd and sum are not available. --- t/t1002-read-tree-m-u-2way.sh | 6 ++++++ t/t3800-mktag.sh | 2 +- t/t5300-pack-object.sh | 30 +++++++++++++++++++++--------- t/t5301-sliding-window.sh | 4 ++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index da3c81357b..6012df56eb 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -10,6 +10,12 @@ This is identical to t1001, but uses -u to update the work tree as well. ' . ./test-lib.sh +sum ./test-lib.sh >/dev/null 2>&1 || { + function sum () { + md5sum "$@" + } +} + _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" compare_change () { diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index ede4d42495..d45e10d026 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -15,7 +15,7 @@ check_verify_failure () { test_expect_success \ "$1" \ 'git-mktag message || - egrep -q -f expect.pat message' + grep -E -q -f expect.pat message' } ########################################################### diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 622c5f9968..508803a8e0 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -10,12 +10,28 @@ test_description='git-pack-object TRASH=`pwd` +x4k=xxxxxxxx +x4k="$x4k$x4k$x4k$x4k$x4k$x4k$x4k$x4k" +x4k="$x4k$x4k$x4k$x4k$x4k$x4k$x4k$x4k" +x4k="$x4k$x4k$x4k$x4k$x4k$x4k$x4k$x4k" + +corrupt() +{ + ( + read -d "" -n $4 l + echo -n "$l" + read -d "" -n $3 l + echo -n ${x4k:0:$3} | tr x '\0' + cat + ) < $1 > $2 +} + test_expect_success \ 'setup' \ 'rm -f .git/index* for i in a b c do - dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i && + echo -n "$x4k" | tr x $i >$i && git-update-index --add $i || return 1 done && cat c >d && echo foo >>d && git-update-index --add d && @@ -144,8 +160,7 @@ test_expect_success \ test_expect_success \ 'verify-pack catches a corrupted pack signature' \ - 'cp test-1-${packname_1}.pack test-3.pack && - dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 && + 'corrupt test-1-${packname_1}.pack test-3.pack 1 2 && if git-verify-pack test-3.idx then false else :; @@ -153,8 +168,7 @@ test_expect_success \ test_expect_success \ 'verify-pack catches a corrupted pack version' \ - 'cp test-1-${packname_1}.pack test-3.pack && - dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 && + 'corrupt test-1-${packname_1}.pack test-3.pack 1 7 && if git-verify-pack test-3.idx then false else :; @@ -162,8 +176,7 @@ test_expect_success \ test_expect_success \ 'verify-pack catches a corrupted type/size of the 1st packed object data' \ - 'cp test-1-${packname_1}.pack test-3.pack && - dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 && + 'corrupt test-1-${packname_1}.pack test-3.pack 1 12 && if git-verify-pack test-3.idx then false else :; @@ -173,8 +186,7 @@ test_expect_success \ 'verify-pack catches a corrupted sum of the index file itself' \ 'l=`wc -c