aosp-merger: Check if branch exists before abandoning

This gets rid of repo abandon errors.

Change-Id: I97698b393e58365a56b02c3173b5482e8344d587
This commit is contained in:
Michael Bestas 2023-11-06 23:08:16 +02:00
parent 259965cf96
commit c687bd73d9
No known key found for this signature in database
GPG Key ID: F2D6C348F85577F5
2 changed files with 6 additions and 2 deletions

View File

@ -66,7 +66,9 @@ STAGINGBRANCH="staging/${BRANCHSUFFIX}"
cd "${TOP}/${PROJECTPATH}"
# Ditch any existing staging branches
repo abandon "${STAGINGBRANCH}" .
if [[ "$(git show-ref --verify --quiet refs/heads/${STAGINGBRANCH})" ]]; then
repo abandon "${STAGINGBRANCH}" .
fi
repo start "${STAGINGBRANCH}" .
if [ -f ".gitupstream-lineage" ]; then
if grep -q "${lineageos_device_branch}" .gitupstream-lineage; then

View File

@ -66,7 +66,9 @@ STAGINGBRANCH="staging/${BRANCHSUFFIX}"
cd "${TOP}/${PROJECTPATH}"
# Ditch any existing staging branches
repo abandon "${STAGINGBRANCH}" .
if [[ "$(git show-ref --verify --quiet refs/heads/${STAGINGBRANCH})" ]]; then
repo abandon "${STAGINGBRANCH}" .
fi
repo start "${STAGINGBRANCH}" .
if [ -f ".gitupstream" ]; then
git fetch -q --force --tags "$(cat .gitupstream)" "${NEWTAG}"