Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: point newly cloned ecommerce repos to use 2u/main branch #8

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ _checkout ()
# If a directory exists and it is nonempty, assume the repo has been cloned.
if [ -d "$name" ] && [ -n "$(ls -A "$name" 2>/dev/null)" ]; then
cd "$name"
_checkout_and_update_branch
_checkout_and_update_branch "${repo}"
cd ..
fi
done
Expand Down Expand Up @@ -134,11 +134,13 @@ _clone ()
fi
printf "The [%s] repo is already checked out. Checking for updates.\n" "$name"
cd "${DEVSTACK_WORKSPACE}/${name}"
_checkout_and_update_branch
_checkout_and_update_branch "${repo}"
cd ..
else
if [ -n "${OPENEDX_GIT_BRANCH:-}" ]; then
CLONE_BRANCH="-b ${OPENEDX_GIT_BRANCH}"
elif [[ "${repo}" == *"openedx/ecommerce"* ]]; then
CLONE_BRANCH="-b 2u/main"
else
CLONE_BRANCH=""
fi
Expand All @@ -154,10 +156,13 @@ _clone ()

_checkout_and_update_branch ()
{
local current_repo=$1
GIT_SYMBOLIC_REF="$(git symbolic-ref HEAD 2>/dev/null)"
BRANCH_NAME=${GIT_SYMBOLIC_REF##refs/heads/}
if [ -n "${OPENEDX_GIT_BRANCH}" ]; then
CHECKOUT_BRANCH=${OPENEDX_GIT_BRANCH}
elif [[ "${current_repo}" == *"openedx/ecommerce"* ]]; then
CHECKOUT_BRANCH="2u/main"
else
CHECKOUT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
fi
Expand Down