tests: move convenience regexp to match object names to test-lib.sh

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2009-09-20 11:10:14 -07:00
parent 902f235378
commit cd3c095caa
9 changed files with 6 additions and 18 deletions

View File

@ -1,7 +1,5 @@
: :
_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"
sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /' sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /'
compare_diff_raw () { compare_diff_raw () {
# When heuristics are improved, the score numbers would change. # When heuristics are improved, the score numbers would change.

View File

@ -126,9 +126,6 @@ cat >expected <<\EOF
100644 X 0 Z/NN 100644 X 0 Z/NN
EOF EOF
_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"
check_result () { check_result () {
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current && git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
test_cmp expected current test_cmp expected current

View File

@ -26,8 +26,6 @@ read_tree_twoway () {
git read-tree -m "$1" "$2" && git ls-files --stage git read-tree -m "$1" "$2" && git ls-files --stage
} }
_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 () { compare_change () {
sed -n >current \ sed -n >current \
-e '/^--- /d; /^+++ /d; /^@@ /d;' \ -e '/^--- /d; /^+++ /d; /^@@ /d;' \

View File

@ -10,8 +10,6 @@ This is identical to t1001, but uses -u to update the work tree as well.
' '
. ./test-lib.sh . ./test-lib.sh
_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 () { compare_change () {
sed >current \ sed >current \
-e '1{/^diff --git /d;}' \ -e '1{/^diff --git /d;}' \

View File

@ -43,8 +43,6 @@ test_expect_success \
tree=`git write-tree` && tree=`git write-tree` &&
echo $tree' echo $tree'
_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"
test_output () { test_output () {
sed -e "s/ $_x40 / X /" <current >check sed -e "s/ $_x40 / X /" <current >check
test_cmp expected check test_cmp expected check

View File

@ -39,8 +39,6 @@ test_expect_success \
tree=`git write-tree` && tree=`git write-tree` &&
echo $tree' echo $tree'
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
test_output () { test_output () {
sed -e "s/ $_x40 / X /" <current >check sed -e "s/ $_x40 / X /" <current >check
test_cmp expected check test_cmp expected check

View File

@ -20,8 +20,6 @@ test_expect_success \
'test_chmod +x rezrov && 'test_chmod +x rezrov &&
git diff-index $tree >current' git diff-index $tree >current'
_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"
sed -e 's/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' <current >check sed -e 's/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' <current >check
echo ":100644 100755 X X M rezrov" >expected echo ":100644 100755 X X M rezrov" >expected

View File

@ -8,9 +8,6 @@ note () {
git tag "$1" git tag "$1"
} }
_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"
unnote () { unnote () {
git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g" git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
} }

View File

@ -74,6 +74,12 @@ case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
;; ;;
esac esac
# Convenience
#
# A regexp to match 5 and 40 hexdigits
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
# Each test should start with something like this, after copyright notices: # Each test should start with something like this, after copyright notices:
# #
# test_description='Description of this test... # test_description='Description of this test...