envsetup: aospremote: Take .gitupstream into account
Adapt function for .gitupstream so we always get the correct remote without needing to calculate the path manually. Test: Run `aospremote` in `kernel/configs` repository. Change-Id: Idcac37ded4a5b2d62d26dc01dd7d68039def6220
This commit is contained in:
@@ -279,17 +279,23 @@ function aospremote()
|
||||
return 1
|
||||
fi
|
||||
git remote rm aosp 2> /dev/null
|
||||
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
|
||||
# Google moved the repo location in Oreo
|
||||
if [ $PROJECT = "build/make" ]
|
||||
then
|
||||
PROJECT="build"
|
||||
|
||||
if [ -f ".gitupstream" ]; then
|
||||
local REMOTE=$(cat .gitupstream | cut -d ' ' -f 1)
|
||||
git remote add aosp ${REMOTE}
|
||||
else
|
||||
local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
|
||||
# Google moved the repo location in Oreo
|
||||
if [ $PROJECT = "build/make" ]
|
||||
then
|
||||
PROJECT="build"
|
||||
fi
|
||||
if (echo $PROJECT | grep -qv "^device")
|
||||
then
|
||||
local PFX="platform/"
|
||||
fi
|
||||
git remote add aosp https://android.googlesource.com/$PFX$PROJECT
|
||||
fi
|
||||
if (echo $PROJECT | grep -qv "^device")
|
||||
then
|
||||
local PFX="platform/"
|
||||
fi
|
||||
git remote add aosp https://android.googlesource.com/$PFX$PROJECT
|
||||
echo "Remote 'aosp' created"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user