diff --git a/creation_repo.sh b/creation_repo.sh index 300c2b7..dac21c9 100755 --- a/creation_repo.sh +++ b/creation_repo.sh @@ -38,7 +38,6 @@ while getopts ":h:s" option; do esac done - if [ ! -d $REPO_PATH ]; then mkdir $REPO_PATH fi @@ -73,27 +72,41 @@ if [ ! -d $REPO_NAME ]; then git commit -m"sample4 deleted" cd .. if [ "$WITH_SUBMODULE" = "true" ]; then - if [ ! -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 .. - fi - cd $REPO_NAME + 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" - else - if [ -d $SUB_NAME ]; then - cd $SUB_NAME - git rm submodule_for_performance_testing - cd .. - rm -rf $SUB_NAME - fi fi 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 -cd .. \ No newline at end of file + + + + + +cd .. +