mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-20 11:54:17 +08:00
Improve fetch git branch logic
This commit is contained in:
parent
a27a641574
commit
e1a5a2cc22
13
cook.sh
13
cook.sh
@ -119,14 +119,17 @@ function op {
|
||||
git remote add upstream "$GIT_UPSTREAM"
|
||||
git fetch upstream
|
||||
fi
|
||||
|
||||
ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)"
|
||||
if [ -n "$BRANCH" ]
|
||||
then
|
||||
git checkout "$BRANCH"
|
||||
else
|
||||
#TODO: Find correct upstream default branch
|
||||
git checkout master
|
||||
ORIGIN_BRANCH="origin/$BRANCH"
|
||||
fi
|
||||
|
||||
if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ]
|
||||
then
|
||||
git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH"
|
||||
fi
|
||||
git pull
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
popd > /dev/null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user