summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
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/"