Skip to content

Commit 167d9b4

Browse files
committed
fix source repo cloning for re-use
1 parent 8c5fa82 commit 167d9b4

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

monorepo-migration/migrate.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ MIGRATION_HEAD_BRANCH="${MIGRATION_HEAD_BRANCH:-main}"
7272
echo "Basing migration branch on: ${MIGRATION_HEAD_BRANCH}"
7373

7474
# 1. Clone the source repository
75-
if [ ! -d "$SOURCE_DIR" ]; then
76-
echo "Cloning source repo: $SOURCE_REPO_URL into $SOURCE_DIR"
77-
git clone "$SOURCE_REPO_URL" "$SOURCE_DIR"
78-
fi
79-
8075
if [ "$SKIP_SOURCE_UPDATE" == "true" ]; then
8176
echo "Skipping source update"
8277
else
78+
rm -rf "${SOURCE_DIR}"
79+
echo "Cloning source repo: $SOURCE_REPO_URL into $SOURCE_DIR"
80+
git clone "$SOURCE_REPO_URL" "$SOURCE_DIR"
81+
8382
pushd "$SOURCE_DIR"
8483
git fetch origin
8584
git checkout -f "main"
@@ -89,7 +88,7 @@ else
8988
# 1.1 Modify history of the split repo to move files to the destination target directory
9089
echo "Moving files to destination path: ${SOURCE_REPO_NAME}"
9190
git filter-repo \
92-
--to-subdirectory-filter "${SOURCE_REPO_NAME}" --force
91+
--to-subdirectory-filter "${SOURCE_REPO_NAME}" --force
9392
popd
9493
fi
9594

0 commit comments

Comments
 (0)