-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Check working copy is clean before extract-repo (#5851)
This prevents bootstrap fast from downloading artifacts that do not match the source currently in the working copy.
- Loading branch information
1 parent
f9a843a
commit 8ff9767
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
# If this script fails (nonzero exit), then the working copy is not clean. | ||
|
||
[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace | ||
set -eu | ||
|
||
REPOSITORY=$1 | ||
|
||
# Get list of rebuild patterns, concat them with regex 'or' (|), and double escape \ for awk -v. | ||
AWK_PATTERN=$(query_manifest rebuildPatterns $REPOSITORY | tr '\n' '|' | sed 's/\\/\\\\/g') | ||
# Remove the trailing '|'. | ||
AWK_PATTERN=${AWK_PATTERN%|} | ||
|
||
cd "$(git rev-parse --show-toplevel)" | ||
|
||
# Check if there is anything dirty in the local copy, if so, bail with non-zero exit code. | ||
CHANGED_FILES=$(git status --porcelain | awk -v pattern="($AWK_PATTERN)" '$2 ~ pattern {print $2}') | ||
if [ -n "$CHANGED_FILES" ]; then | ||
echo $CHANGED_FILES | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters