Skip to content

Commit 10c1c3d

Browse files
checkgit.sh: Added a check for local modifications (#3347)
1 parent 7ca43c8 commit 10c1c3d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

resources/checkgit.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ trap "exit 1" ERR
88
# and including any changes on main.
99
#
1010

11+
# Check that local copy has no modifications
12+
GIT_MODIFIED_FILES=$(git ls-files -dm 2> /dev/null);
13+
GIT_STAGED_FILES=$(git diff --cached --name-only 2> /dev/null);
14+
if [ "$GIT_MODIFIED_FILES" != "" -o "$GIT_STAGED_FILES" != "" ]; then
15+
read -p "Git has local modifications. Continue? (y|N) " yn;
16+
if [ "$yn" != "y" ]; then exit 1; fi;
17+
fi;
18+
1119
# First fetch to ensure git is up to date. Fail-fast if this fails.
1220
git fetch;
1321
if [[ $? -ne 0 ]]; then exit 1; fi;

0 commit comments

Comments
 (0)