mirror of
https://github.com/actions/checkout.git
synced 2025-03-28 11:00:05 +01:00
feat: refactor on sparse-checkout test
This commit is contained in:
parent
a910f4bca0
commit
eea6d0effb
2 changed files with 38 additions and 42 deletions
|
@ -1,5 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Verify .git folder
|
||||
if [ ! -d "./sparse-checkout/.git" ]; then
|
||||
echo "Expected ./sparse-checkout/.git folder to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify sparse-checkout basic
|
||||
cd sparse-checkout
|
||||
|
||||
SPARSE=$(git sparse-checkout list)
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
|
|
|
@ -1,5 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Verify .git folder
|
||||
if [ ! -d "./sparse-checkout/.git" ]; then
|
||||
echo "Expected ./sparse-checkout/.git folder to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify sparse-checkout
|
||||
cd sparse-checkout
|
||||
|
||||
checkSparse () {
|
||||
if [ ! -d "./$1" ]; then
|
||||
echo "Expected directory '$1' to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $(git ls-tree -r --name-only HEAD $1)
|
||||
do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "Expected file '$file' to exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Check that all folders and its childrens has been fetched correctly
|
||||
checkSparse __test__
|
||||
checkSparse .github
|
||||
checkSparse dist
|
||||
|
||||
# Check that only sparse-checkout folders has been fetched
|
||||
for pattern in $(git ls-tree --name-only HEAD)
|
||||
do
|
||||
|
@ -9,46 +38,4 @@ do
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Check that .github and its childrens has been fetched correctly
|
||||
if [ ! -d "./__test__" ]; then
|
||||
echo "Expected directory '__test__' to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $(git ls-tree -r --name-only HEAD __test__)
|
||||
do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "Expected file '$file' to exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check that .github and its childrens has been fetched correctly
|
||||
if [ ! -d "./.github" ]; then
|
||||
echo "Expected directory '.github' to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $(git ls-tree -r --name-only HEAD .github)
|
||||
do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "Expected file '$file' to exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check that dist and its childrens has been fetched correctly
|
||||
if [ ! -d "./dist" ]; then
|
||||
echo "Expected directory 'dist' to exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $(git ls-tree -r --name-only HEAD dist)
|
||||
do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "Expected file '$file' to exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
Loading…
Add table
Reference in a new issue