зеркало из https://github.com/microsoft/git.git
Merge branch 'ew/tests'
* ew/tests: t6000lib: workaround a possible dash bug t5500-fetch-pack: remove local (bashism) usage. tests: Remove heredoc usage inside quotes t3300-funny-names: shell portability fixes
This commit is contained in:
Коммит
481176f752
|
@ -8,15 +8,16 @@ test_description='git-update-index --again test.
|
|||
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > expected <<\EOF
|
||||
100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1
|
||||
100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2
|
||||
EOF
|
||||
test_expect_success 'update-index --add' \
|
||||
'echo hello world >file1 &&
|
||||
echo goodbye people >file2 &&
|
||||
git-update-index --add file1 file2 &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1
|
||||
100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
test_expect_success 'update-index --again' \
|
||||
'rm -f file1 &&
|
||||
|
@ -29,20 +30,22 @@ test_expect_success 'update-index --again' \
|
|||
echo happy - failed as expected
|
||||
fi &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1
|
||||
100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
cat > expected <<\EOF
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF
|
||||
test_expect_success 'update-index --remove --again' \
|
||||
'git-update-index --remove --again &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
test_expect_success 'first commit' 'git-commit -m initial'
|
||||
|
||||
cat > expected <<\EOF
|
||||
100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF
|
||||
test_expect_success 'update-index again' \
|
||||
'mkdir -p dir1 &&
|
||||
echo hello world >dir1/file3 &&
|
||||
|
@ -52,11 +55,12 @@ test_expect_success 'update-index again' \
|
|||
echo happy >dir1/file3 &&
|
||||
git-update-index --again &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
cat > expected <<\EOF
|
||||
100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF
|
||||
test_expect_success 'update-index --update from subdir' \
|
||||
'echo not so happy >file2 &&
|
||||
cd dir1 &&
|
||||
|
@ -64,19 +68,17 @@ test_expect_success 'update-index --update from subdir' \
|
|||
git-update-index --again &&
|
||||
cd .. &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
cat > expected <<\EOF
|
||||
100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF
|
||||
test_expect_success 'update-index --update with pathspec' \
|
||||
'echo very happy >file2 &&
|
||||
cat file2 >dir1/file3 &&
|
||||
git-update-index --again dir1/ &&
|
||||
git-ls-files -s >current &&
|
||||
cmp current - <<\EOF
|
||||
100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
|
||||
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -40,9 +40,11 @@ test_expect_success 'git-ls-files no-funny' \
|
|||
t0=`git-write-tree`
|
||||
echo "$t0" >t0
|
||||
|
||||
echo 'just space
|
||||
cat > expected <<\EOF
|
||||
just space
|
||||
no-funny
|
||||
"tabs\t,\" (dq) and spaces"' >expected
|
||||
"tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-ls-files with-funny' \
|
||||
'git-update-index --add "$p1" &&
|
||||
git-ls-files >current &&
|
||||
|
@ -58,14 +60,18 @@ test_expect_success 'git-ls-files -z with-funny' \
|
|||
t1=`git-write-tree`
|
||||
echo "$t1" >t1
|
||||
|
||||
echo 'just space
|
||||
cat > expected <<\EOF
|
||||
just space
|
||||
no-funny
|
||||
"tabs\t,\" (dq) and spaces"' >expected
|
||||
"tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-ls-tree with funny' \
|
||||
'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo 'A "tabs\t,\" (dq) and spaces"' >expected
|
||||
cat > expected <<\EOF
|
||||
A "tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-diff-index with-funny' \
|
||||
'git-diff-index --name-status $t0 >current &&
|
||||
diff -u expected current'
|
||||
|
@ -84,53 +90,62 @@ test_expect_success 'git-diff-tree -z with-funny' \
|
|||
'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo 'CNUM no-funny "tabs\t,\" (dq) and spaces"' >expected
|
||||
cat > expected <<\EOF
|
||||
CNUM no-funny "tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree -C with-funny' \
|
||||
'git-diff-tree -C --find-copies-harder --name-status \
|
||||
$t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo 'RNUM no-funny "tabs\t,\" (dq) and spaces"' >expected
|
||||
cat > expected <<\EOF
|
||||
RNUM no-funny "tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree delete with-funny' \
|
||||
'git-update-index --force-remove "$p0" &&
|
||||
git-diff-index -M --name-status \
|
||||
$t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo 'diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
|
||||
cat > expected <<\EOF
|
||||
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
|
||||
similarity index NUM%
|
||||
rename from no-funny
|
||||
rename to "tabs\t,\" (dq) and spaces"' >expected
|
||||
|
||||
rename to "tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree delete with-funny' \
|
||||
'git-diff-index -M -p $t0 |
|
||||
sed -e "s/index [0-9]*%/index NUM%/" >current &&
|
||||
diff -u expected current'
|
||||
|
||||
chmod +x "$p1"
|
||||
echo 'diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
|
||||
cat > expected <<\EOF
|
||||
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
similarity index NUM%
|
||||
rename from no-funny
|
||||
rename to "tabs\t,\" (dq) and spaces"' >expected
|
||||
|
||||
rename to "tabs\t,\" (dq) and spaces"
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree delete with-funny' \
|
||||
'git-diff-index -M -p $t0 |
|
||||
sed -e "s/index [0-9]*%/index NUM%/" >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo >expected ' "tabs\t,\" (dq) and spaces"
|
||||
1 files changed, 0 insertions(+), 0 deletions(-)'
|
||||
cat >expected <<\EOF
|
||||
"tabs\t,\" (dq) and spaces"
|
||||
1 files changed, 0 insertions(+), 0 deletions(-)
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree rename with-funny applied' \
|
||||
'git-diff-index -M -p $t0 |
|
||||
git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
|
||||
diff -u expected current'
|
||||
|
||||
echo >expected ' no-funny
|
||||
cat > expected <<\EOF
|
||||
no-funny
|
||||
"tabs\t,\" (dq) and spaces"
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)'
|
||||
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
EOF
|
||||
test_expect_success 'git-diff-tree delete with-funny applied' \
|
||||
'git-diff-index -p $t0 |
|
||||
git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
|
||||
|
|
|
@ -16,25 +16,20 @@ test_expect_success 'prepare repository' \
|
|||
echo git >c &&
|
||||
cat b b >d'
|
||||
|
||||
test_expect_success 'diff without --binary' \
|
||||
'git-diff | git-apply --stat --summary >current &&
|
||||
cmp current - <<\EOF
|
||||
cat > expected <<\EOF
|
||||
a | 2 +-
|
||||
b | Bin
|
||||
c | 2 +-
|
||||
d | Bin
|
||||
4 files changed, 2 insertions(+), 2 deletions(-)
|
||||
EOF'
|
||||
EOF
|
||||
test_expect_success 'diff without --binary' \
|
||||
'git-diff | git-apply --stat --summary >current &&
|
||||
cmp current expected'
|
||||
|
||||
test_expect_success 'diff with --binary' \
|
||||
'git-diff --binary | git-apply --stat --summary >current &&
|
||||
cmp current - <<\EOF
|
||||
a | 2 +-
|
||||
b | Bin
|
||||
c | 2 +-
|
||||
d | Bin
|
||||
4 files changed, 2 insertions(+), 2 deletions(-)
|
||||
EOF'
|
||||
cmp current expected'
|
||||
|
||||
# apply needs to be able to skip the binary material correctly
|
||||
# in order to report the line number of a corrupt patch.
|
||||
|
|
|
@ -12,11 +12,11 @@ test_description='Testing multi_ack pack fetching
|
|||
|
||||
# Some convenience functions
|
||||
|
||||
function add () {
|
||||
local name=$1
|
||||
local text="$@"
|
||||
local branch=${name:0:1}
|
||||
local parents=""
|
||||
add () {
|
||||
name=$1
|
||||
text="$@"
|
||||
branch=`echo $name | sed -e 's/^\(.\).*$/\1/'`
|
||||
parents=""
|
||||
|
||||
shift
|
||||
while test $1; do
|
||||
|
@ -36,13 +36,13 @@ function add () {
|
|||
eval ${branch}TIP=$commit
|
||||
}
|
||||
|
||||
function count_objects () {
|
||||
count_objects () {
|
||||
ls .git/objects/??/* 2>>log2.txt | wc -l | tr -d " "
|
||||
}
|
||||
|
||||
function test_expect_object_count () {
|
||||
local message=$1
|
||||
local count=$2
|
||||
test_expect_object_count () {
|
||||
message=$1
|
||||
count=$2
|
||||
|
||||
output="$(count_objects)"
|
||||
test_expect_success \
|
||||
|
@ -50,18 +50,18 @@ function test_expect_object_count () {
|
|||
"test $count = $output"
|
||||
}
|
||||
|
||||
function pull_to_client () {
|
||||
local number=$1
|
||||
local heads=$2
|
||||
local count=$3
|
||||
local no_strict_count_check=$4
|
||||
pull_to_client () {
|
||||
number=$1
|
||||
heads=$2
|
||||
count=$3
|
||||
no_strict_count_check=$4
|
||||
|
||||
cd client
|
||||
test_expect_success "$number pull" \
|
||||
"git-fetch-pack -k -v .. $heads"
|
||||
case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac
|
||||
case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac
|
||||
git-symbolic-ref HEAD refs/heads/${heads:0:1}
|
||||
git-symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'`
|
||||
|
||||
test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1'
|
||||
|
||||
|
|
|
@ -69,7 +69,9 @@ on_committer_date()
|
|||
{
|
||||
_date=$1
|
||||
shift 1
|
||||
GIT_COMMITTER_DATE=$_date "$@"
|
||||
export GIT_COMMITTER_DATE="$_date"
|
||||
"$@"
|
||||
unset GIT_COMMITTER_DATE
|
||||
}
|
||||
|
||||
# Execute a command and suppress any error output.
|
||||
|
|
Загрузка…
Ссылка в новой задаче