git_update/creation_repo.sh

67 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
2024-06-28 16:29:11 +00:00
Help()
{
echo "
NAME
creation_repo.sh
SYNOPSIS
creation_repo.sh [SSH LINK to en empty remote git repository]
DESCRIPTION
This script is in writing.
It creates a git repository in the current directory, linked to a remote passed as argument. Everything is up-to-date between the remote and the local versions. The data stored is generated randomly in binary.
OPTIONS
-h prints the help. "
}
2024-07-03 12:51:49 +00:00
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
while getopts ":h" option; do
2024-06-28 16:29:11 +00:00
case $option in
h) # display Help
Help
exit;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
2024-07-03 12:51:49 +00:00
return 0
fi
2024-07-03 12:51:49 +00:00
REPO_NAME=performance_testing
REPO_PATH=./remote
if [ ! -d $REPO_PATH ]; then
mkdir $REPO_PATH
fi
cd $REPO_PATH
if [ ! -d $REPO_NAME ]; then
mkdir $REPO_NAME
cd $REPO_NAME
git init
git branch -m main
dd if=/dev/urandom of=sample0 bs=1M count=1
git add .
git commit -m"first 1M sample created"
git tag start
dd if=/dev/urandom of=sample1 bs=1M count=1
git add sample1
git commit -m"second 1M sample created"
git branch secondary
git checkout secondary
dd if=/dev/urandom of=sample2 bs=500K count=1
git add sample2
git commit -m"first 500K sample created in branch secondary"
git checkout main
dd if=/dev/urandom of=sample3 bs=1M count=1
git add sample3
git commit -m"third 1M sample created"
dd if=/dev/urandom of=sample4 bs=5M count=1
git add sample4
git commit -m"first 5M sample created"
rm sample4
git add sample4
git commit -m"sample4 deleted"
fi
cd ..