Merge pull request #8102 from TheJoeSchr/develop
setup.sh: checks if git directory is dirty before bothering user with…
This commit is contained in:
commit
7991124794
17
setup.sh
17
setup.sh
@ -190,15 +190,25 @@ function update() {
|
||||
updateenv
|
||||
}
|
||||
|
||||
function check_git_changes() {
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo "No changes in git directory"
|
||||
return 1
|
||||
else
|
||||
echo "Changes in git directory"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Reset Develop or Stable branch
|
||||
function reset() {
|
||||
echo_block "Resetting branch and virtual env"
|
||||
|
||||
if [ "1" == $(git branch -vv |grep -cE "\* develop|\* stable") ]
|
||||
then
|
||||
|
||||
read -p "Reset git branch? (This will remove all changes you made!) [y/N]? "
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if check_git_changes; then
|
||||
read -p "Keep your local changes? (Otherwise will remove all changes you made!) [Y/n]? "
|
||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
|
||||
git fetch -a
|
||||
|
||||
@ -212,6 +222,7 @@ function reset() {
|
||||
git reset --hard origin/stable
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Reset ignored because you are not on 'stable' or 'develop'."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user