mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-07-07 03:58:41 +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 remote add upstream "$GIT_UPSTREAM"
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)"
|
||||||
if [ -n "$BRANCH" ]
|
if [ -n "$BRANCH" ]
|
||||||
then
|
then
|
||||||
git checkout "$BRANCH"
|
ORIGIN_BRANCH="origin/$BRANCH"
|
||||||
else
|
fi
|
||||||
#TODO: Find correct upstream default branch
|
|
||||||
git checkout master
|
if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ]
|
||||||
|
then
|
||||||
|
git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH"
|
||||||
fi
|
fi
|
||||||
git pull
|
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user