Skip to content

Commit

Permalink
checkgit.sh: Added a check for local modifications (#3347)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Oct 29, 2021
1 parent 7ca43c8 commit 10c1c3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resources/checkgit.sh
Expand Up @@ -8,6 +8,14 @@ trap "exit 1" ERR
# and including any changes on main.
#

# Check that local copy has no modifications
GIT_MODIFIED_FILES=$(git ls-files -dm 2> /dev/null);
GIT_STAGED_FILES=$(git diff --cached --name-only 2> /dev/null);
if [ "$GIT_MODIFIED_FILES" != "" -o "$GIT_STAGED_FILES" != "" ]; then
read -p "Git has local modifications. Continue? (y|N) " yn;
if [ "$yn" != "y" ]; then exit 1; fi;
fi;

# First fetch to ensure git is up to date. Fail-fast if this fails.
git fetch;
if [[ $? -ne 0 ]]; then exit 1; fi;
Expand Down

0 comments on commit 10c1c3d

Please sign in to comment.