summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorluca020400 <luca.stefani.ge1@gmail.com>2016-05-05 21:53:40 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-05-06 15:18:22 -0700
commit0407535c99cfd534461568438eecfefd977b27f3 (patch)
tree05fbe269db986d0bc145915465a298ac9c0e6b8c /envsetup.sh
parent0c03d1e623e77bab4825da899e52b4ffc849a3af (diff)
downloadbuild-0407535c99cfd534461568438eecfefd977b27f3.zip
build-0407535c99cfd534461568438eecfefd977b27f3.tar.gz
build-0407535c99cfd534461568438eecfefd977b27f3.tar.bz2
envsetup: Fix aosp & caf remote
Fixes: sed: -e expression #1, char 9: unknown option to `s' * Return if .git directory is missing and move it on the top * Update cmremote strings ( match caf/aosp remote ) Change-Id: Ifb606a20f308e7317e9ce519d682a3fdb8bfe9bf
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 00dfbf1..23012ce 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1685,13 +1685,13 @@ function godir () {
function cmremote()
{
- git remote rm cmremote 2> /dev/null
- GERRIT_REMOTE=$(git config --get remote.github.projectname)
- if [ -z "$GERRIT_REMOTE" ]
+ if ! git rev-parse --git-dir &> /dev/null
then
- echo Unable to set up the git remote, are you under a git repo?
- return 0
+ echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
+ return 1
fi
+ git remote rm cmremote 2> /dev/null
+ GERRIT_REMOTE=$(git config --get remote.github.projectname)
CMUSER=$(git config --get review.review.cyanogenmod.org.username)
if [ -z "$CMUSER" ]
then
@@ -1699,17 +1699,18 @@ function cmremote()
else
git remote add cmremote ssh://$CMUSER@review.cyanogenmod.org:29418/$GERRIT_REMOTE
fi
- echo You can now push to "cmremote".
+ echo "Remote 'cmremote' created"
}
function aospremote()
{
- git remote rm aosp 2> /dev/null
- if [ ! -d .git ]
+ if ! git rev-parse --git-dir &> /dev/null
then
- echo .git directory not found. Please run this from the root directory of the Android repository you wish to set up.
+ echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
+ return 1
fi
- PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
+ git remote rm aosp 2> /dev/null
+ PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"
@@ -1720,12 +1721,13 @@ function aospremote()
function cafremote()
{
- git remote rm caf 2> /dev/null
- if [ ! -d .git ]
+ if ! git rev-parse --git-dir &> /dev/null
then
- echo .git directory not found. Please run this from the root directory of the Android repository you wish to set up.
+ echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
+ return 1
fi
- PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
+ git remote rm caf 2> /dev/null
+ PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"