lineage/aosp/cafremote: Make variables local

* Certain order of running these commands on different repos can
  end up producing broken remotes, because the variables are
  exported globally (looking at you PFX)

Change-Id: I0b679f04264d964ed9a0f0d1adfdbaeac9403ec8
This commit is contained in:
Michael Bestas 2017-08-24 00:00:48 +03:00
parent af3532bef5
commit ad3a57032a

View file

@ -266,13 +266,13 @@ function lineageremote()
return 1
fi
git remote rm lineage 2> /dev/null
GERRIT_REMOTE=$(git config --get remote.github.projectname)
local GERRIT_REMOTE=$(git config --get remote.github.projectname)
if [ -z "$GERRIT_REMOTE" ]
then
GERRIT_REMOTE=$(git config --get remote.aosp.projectname | sed s#platform/#android/#g | sed s#/#_#g)
PFX="LineageOS/"
local GERRIT_REMOTE=$(git config --get remote.aosp.projectname | sed s#platform/#android/#g | sed s#/#_#g)
local PFX="LineageOS/"
fi
LINEAGE_USER=$(git config --get review.review.lineageos.org.username)
local LINEAGE_USER=$(git config --get review.review.lineageos.org.username)
if [ -z "$LINEAGE_USER" ]
then
git remote add lineage ssh://review.lineageos.org:29418/$PFX$GERRIT_REMOTE
@ -290,10 +290,10 @@ function aospremote()
return 1
fi
git remote rm aosp 2> /dev/null
PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"
local PFX="platform/"
fi
git remote add aosp https://android.googlesource.com/$PFX$PROJECT
echo "Remote 'aosp' created"
@ -307,10 +307,10 @@ function cafremote()
return 1
fi
git remote rm caf 2> /dev/null
PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"
local PFX="platform/"
fi
git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT
echo "Remote 'caf' created"