Compare commits

..

No commits in common. "6556852657216ef298664726352d25b4ed4def32" and "7b9c5b97e8ea955f93b0169935acc40f369603a5" have entirely different histories.

2 changed files with 37 additions and 60 deletions

View File

@ -25,6 +25,7 @@ REPO_PATH=./remote
WITH_SUBMODULE="false" #"true" WITH_SUBMODULE="false" #"true"
SUB_NAME="submodule_for_performance_testing" SUB_NAME="submodule_for_performance_testing"
while getopts ":h:s" option; do while getopts ":h:s" option; do
case $option in case $option in
h) h)
Help Help
@ -37,10 +38,12 @@ while getopts ":h:s" option; do
esac esac
done done
if [ ! -d $REPO_PATH ]; then if [ ! -d $REPO_PATH ]; then
mkdir $REPO_PATH mkdir $REPO_PATH
fi fi
cd $REPO_PATH cd $REPO_PATH
echo $(ls -la)
if [ ! -d $REPO_NAME ]; then if [ ! -d $REPO_NAME ]; then
mkdir $REPO_NAME mkdir $REPO_NAME
cd $REPO_NAME cd $REPO_NAME
@ -70,41 +73,27 @@ if [ ! -d $REPO_NAME ]; then
git commit -m"sample4 deleted" git commit -m"sample4 deleted"
cd .. cd ..
if [ "$WITH_SUBMODULE" = "true" ]; then if [ "$WITH_SUBMODULE" = "true" ]; then
mkdir $SUB_NAME if [ ! -d $SUB_NAME ]; then
cd $SUB_NAME mkdir $SUB_NAME
git init cd $SUB_NAME
git branch -m main git init
create_random_file 'sub_sample0' '1M' git branch -m main
git add . create_random_file 'sub_sample0' '1M'
git commit -m"first 1M sample created" git add .
cd ../$REPO_NAME git commit -m"first 1M sample created"
cd ..
fi
cd $REPO_NAME
git submodule add ../submodule_for_performance_testing git submodule add ../submodule_for_performance_testing
git commit -am "adding $SUB_NAME module" git commit -am "adding $SUB_NAME module"
else
if [ -d $SUB_NAME ]; then
cd $SUB_NAME
git rm submodule_for_performance_testing
cd ..
rm -rf $SUB_NAME
fi
fi fi
cd .. cd ..
else # $REPO_NAME exists
if [[ "$WITH_SUBMODULE" = "true" && ! -d $SUB_NAME ]]; then
mkdir $SUB_NAME
cd $SUB_NAME
git init
git branch -m main
create_random_file 'sub_sample0' '1M'
git add .
git commit -m"first 1M sample created"
cd ../$REPO_NAME
git submodule add ../submodule_for_performance_testing
git commit -am "adding $SUB_NAME module"
elif [[ "$WITH_SUBMODULE" != "true" && -d $SUB_NAME ]]; then
cd $SUB_NAME
git rm submodule_for_performance_testing
cd ..
rm -rf $SUB_NAME
fi
fi fi
cd .. cd ..

View File

@ -1,19 +1,9 @@
#!/bin/bash #!/bin/bash
. driglibash-base . creation_repo.sh &> /dev/null
REPO_NAME=performance_testing
REPO_PATH=./remote
WITH_SUBMODULE="true"
SUB_NAME="submodule_for_performance_testing"
FILES_TO_KEEP='sample0' FILES_TO_KEEP='sample0'
REMOTE="./remote/performance_testing" REMOTE="./remote/performance_testing"
if [ "$WITH_SUBMODULE"="true" ]; then
bash creation_repo.sh -s &> /dev/null
else
bash creation_repo.sh &> /dev/null
fi
Help() Help()
{ {
echo " echo "
@ -42,10 +32,6 @@ DESCRIPTION
} }
#USEFUL FUNCTIONS FOR THE TESTS #USEFUL FUNCTIONS FOR THE TESTS
create_random_file(){
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
}
get_storage_used(){ get_storage_used(){
mem=$(du $1 | tail -n1 | tr -cd [:digit:]) mem=$(du $1 | tail -n1 | tr -cd [:digit:])
} }
@ -307,28 +293,30 @@ test10(){
test11(){ test11(){
section TEST11 section TEST11
run echo 'TEST 11 : case of --depth=1 fetching and merging, after addition of a 1M file in submodule' run echo 'TEST 11 : case of --depth=1 fetching and merging, after addition of a 1M file in submodule'
run git clone --recurse-submodules $1 &> /dev/null pwd
run git clone --recurse-submodules $1
cd $REPO_NAME cd $REPO_NAME
get_storage_used . get_storage_used .
mem_before=$mem mem_before=$mem
echo "mem before vaut $mem_before" pwd
ls -la
#modification of the remote submodule #modification of the remote submodule
cd .. cd ../$REMOTE/$SUB_NAME
cd $REPO_PATH/$SUB_NAME pwd
create_random_file 'sub_sample1' '1M' create_random_file 'sub_sample1' '1M'
git add sub_sample1 git add sub_sample1
git commit --quiet -m"second 1M sample created" git commit --quiet -m"first 1M sample created"
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git submodule update --init --recursive --force --recommend-shallow --remote &> /dev/null run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress --tags --depth=1 origin #&> /dev/null run git fetch --progress --tags --depth=1 -recursive-submodules origin &> /dev/null
git checkout -f origin/main #&> /dev/null git checkout -f -recursive-submodules origin/main &> /dev/null
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
echo "memory usage: $mem" echo "memory usage: $mem"
cd ../$REPO_PATH/$SUB_NAME cd ../$REMOTE
git reset --hard -q HEAD~1 git reset --hard -q HEAD~2
cd ../.. cd ../..
#rm -rf performance_testing #rm -rf performance_testing
} }