Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/undo failure repo #152

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions scripts/repositories/common/create-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ if [ "$directory" != "" ]
then
[ "$action" == "create" ] && mkdir -p "$directory"
cd "$directory"
MSG_ERROR "Cding into the directory given." $?
#check if the directory exists!
ret_value3="$?"
if [ "$ret_value3" != "0" ]
then
cd ..
rm -rf "$directory"
az repos delete --id "$repo_id" --org "$organization" -p "$project" --yes
echo -e "${red}The repository made will be deleted, try again!"
fi
shiftwolf marked this conversation as resolved.
Show resolved Hide resolved

MSG_ERROR "Cding into the directory given." "$ret_value3"
fi
directory_name=$(basename "$(pwd)")

Expand Down Expand Up @@ -458,12 +468,31 @@ then
fi
elif [ "$action" = "create" ]
then
MSG_ERROR "Cding into the directory given." "$?"
#cd "$directory"
#Check when starting if everything is OK?
ret_value="$?"
if [ "$ret_value" != "0" ]
then
cd ..
rm -rf "$directory"
az repos delete --id "$repo_id" --org "$organization" -p "$project" --yes
echo -e "${red}The repository made will be deleted, try again!"
fi
MSG_ERROR "Cding into the directory given." "$ret_value"
clone_git_project_create
MSG_ERROR "Cloning empty repo." $?
#Check after cloning!
ret_value2="$?"
if [ "$ret_value2" != "0" ]
then
cd ..
rm -rf "$directory"
az repos delete --id "$repo_id" --org "$organization" -p "$project" --yes
echo -e "${red}You're trying to clone an empty repository, The repository made will be deleted, try again!"
fi
MSG_ERROR "Cloning empty repo." "$ret_value2"
git checkout -b master
cp "$absoluteFolderScriptPath/README.md" .
git a dd -A
git add -A
git commit -m "Adding README"
git push -u origin --all
if [ "$strategy" != "" ]
Expand Down