en faisant des checkout et reset au lieu des merge

This commit is contained in:
eleonore12345 2024-07-05 16:46:00 +02:00
parent eab2b8cfa1
commit 37957a3dcd

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. driglibash-base . driglibash-base #test
. creation_repo.sh &> /dev/null . creation_repo.sh &> /dev/null
FILES_TO_KEEP='sample0' FILES_TO_KEEP='sample0'
@ -20,13 +20,17 @@ OPTIONS
DESCRIPTION DESCRIPTION
This script is in writing. It allows you to measure memory and bandwidth usage. The first four test different cloning methods. Te following apply changes to the local remote before testing fetching and merging commands. This script is in writing. It allows you to measure memory and bandwidth usage. The first four test different cloning methods. Te following apply changes to the local remote before testing fetching and merging commands.
TEST0: classic cloning TEST0: classic cloning
TEST1: --single-branch TEST1: --single-branch cloning
TEST2: --depth=1 --no-single-branch TEST2: --depth=1 --no-single-branch cloning
TEST3: --depth=1 TEST3: --depth=1 cloning
TEST4: sparse-checking 1M sample0 only TEST4: sparse-checking 1M sample0 only cloning
_________________________________________ _________________
TEST5: classic fetching and merging after addition of 1M file TEST5: classic fetching and merging after addition of a 1M file
TEST6: " TEST6: classic fetching and merging, after removal of a 1M file
TEST7: classic fetching and merging, after addition then removal of a 1M file
TEST8: --depth=1 fetching and merging, after addition of a 1M file
TEST9: --depth=1 fetching and merging, after removal of a 1M file
TEST10: --depth=1 fetching and merging, after addition then removal of 1M a file"
} }
#USEFUL FUNCTIONS FOR THE TESTS #USEFUL FUNCTIONS FOR THE TESTS
@ -54,7 +58,7 @@ test0(){
echo "memory usage in a classic cloning : $mem" echo "memory usage in a classic cloning : $mem"
echo "bandwidth usage : $bw" echo "bandwidth usage : $bw"
run rm cloning_text run rm cloning_text
run rm -rf $REPO_NAME #run rm -rf $REPO_NAME
} }
test1(){ test1(){
@ -112,6 +116,9 @@ test4(){
run rm -rf $REPO_NAME run rm -rf $REPO_NAME
} }
#TESTS ON THE UPDATING OF THE REPOSITORY #TESTS ON THE UPDATING OF THE REPOSITORY
test5(){ test5(){
section TEST5 section TEST5
@ -131,24 +138,25 @@ test5(){
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> fetching_text run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
get_bandwidth fetching_text #get_bandwidth fetching_text
echo "memory usage: +$mem" echo "memory usage: +$mem"
echo "bandwidth usage: $bw" #echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~1 git reset --hard -q HEAD~1
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
test6(){ test6(){
section TEST6 section TEST6
run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file' run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file'
#initialization #initialization
pwd
run git clone $1 #&> /dev/null run git clone $1 #&> /dev/null
cd $REPO_NAME cd $REPO_NAME
get_storage_used . get_storage_used .
@ -161,17 +169,19 @@ test6(){
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> fetching_text run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
get_bandwidth fetching_text #get_bandwidth fetching_text
echo "memory usage: $mem" echo "memory usage: $mem"
echo "bandwidth usage: $bw" #echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~1 git reset --hard -q HEAD~1
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
test7(){ test7(){
@ -193,16 +203,18 @@ test7(){
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> fetching_text run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
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"
echo "bandwidth usage : unknown" #echo "bandwidth usage : unknown"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~2 git reset --hard -q HEAD~2
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
test8(){ test8(){
@ -221,17 +233,19 @@ test8(){
run git commit --quiet -m"fourth 1M sample created" run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME cd ../../$REPO_NAME
run git fetch --progress --depth=1 origin &> /dev/null run git fetch --progress --depth=1 origin &> /dev/null
run git merge --progress --allow-unrelated-histories &> fetching_text run git checkout origin/main
run git reset --hard
#run git merge --progress --allow-unrelated-histories &> fetching_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
get_bandwidth fetching_text #get_bandwidth fetching_text
echo "memory usage: +$mem" echo "memory usage: +$mem"
echo "bandwidth usage: $bw" #echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~1 #does not work cause commits change numbers git reset --hard -q HEAD~1 #does not work cause commits change numbers
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
test9(){ test9(){
@ -249,17 +263,19 @@ test9(){
run git commit --quiet -m"1M sample0 deleted" run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git fetch --progress --depth=1 origin &> /dev/null run git fetch --progress --depth=1 --prune origin &> text1
run git merge --progress --allow-unrelated-histories &> /dev/null run git checkout origin/main
run git reset --hard
#run git merge --progress --allow-unrelated-histories &> text2
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"
echo "bandwidth usage: unknown" #echo "bandwidth usage: unknown"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~1 git reset --hard -q HEAD~1
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
test10(){ test10(){
@ -282,16 +298,18 @@ test10(){
cd ../../$REPO_NAME cd ../../$REPO_NAME
#fetching #fetching
run git fetch --progress --depth=1 origin &> /dev/null run git fetch --progress --depth=1 origin &> /dev/null
run git merge --progress --allow-unrelated-histories &> /dev/null git checkout origin/main
git reset --hard
#run git merge --progress --allow-unrelated-histories &> /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"
echo "bandwidth usage : unknown" #echo "bandwidth usage : unknown"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q HEAD~2 git reset --hard -q HEAD~2
cd ../.. cd ../..
rm -rf performance_testing #rm -rf performance_testing
} }
while getopts ":hn:a" option; do while getopts ":hn:a" option; do