Skip to content

Commit 283bc2c

Browse files
authored
devops: ensure that embedder directory does not exist (#4340)
Otherwise `cp -r from to` will copy content of `from` to a subdirectory in `to`
1 parent 65009dc commit 283bc2c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

browser_patches/prepare_checkout.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,24 @@ git apply --index --whitespace=nowarn $PATCHES_PATH/*
124124

125125
if [[ ! -z "${WEBKIT_EXTRA_FOLDER_PATH}" ]]; then
126126
echo "-- adding WebKit embedders"
127-
cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" ./Tools/Playwright
128-
git add Tools/Playwright
127+
EMBEDDER_DIR="$PWD/Tools/Playwright"
128+
# git status does not show empty directories, check it separately.
129+
if [[ -d $EMBEDDER_DIR ]]; then
130+
echo "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."
131+
exit 1
132+
fi
133+
cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR
134+
git add $EMBEDDER_DIR
129135
elif [[ ! -z "${FIREFOX_EXTRA_FOLDER_PATH}" ]]; then
130136
echo "-- adding juggler"
131-
cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" ./juggler
132-
git add juggler
137+
EMBEDDER_DIR="$PWD/juggler"
138+
# git status does not show empty directories, check it separately.
139+
if [[ -d $EMBEDDER_DIR ]]; then
140+
echo "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."
141+
exit 1
142+
fi
143+
cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR
144+
git add $EMBEDDER_DIR
133145
fi
134146

135147
git commit -a --author="playwright-devops <[email protected]>" -m "chore: bootstrap build #$BUILD_NUMBER"

0 commit comments

Comments
 (0)