Skip to content

Commit 0407535

Browse files
luca020400Gerrit Code Review
authored andcommitted
envsetup: Fix aosp & caf remote
Fixes: sed: -e expression omnirom#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
1 parent 0c03d1e commit 0407535

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

envsetup.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,31 +1685,32 @@ function godir () {
16851685

16861686
function cmremote()
16871687
{
1688-
git remote rm cmremote 2> /dev/null
1689-
GERRIT_REMOTE=$(git config --get remote.github.projectname)
1690-
if [ -z "$GERRIT_REMOTE" ]
1688+
if ! git rev-parse --git-dir &> /dev/null
16911689
then
1692-
echo Unable to set up the git remote, are you under a git repo?
1693-
return 0
1690+
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
1691+
return 1
16941692
fi
1693+
git remote rm cmremote 2> /dev/null
1694+
GERRIT_REMOTE=$(git config --get remote.github.projectname)
16951695
CMUSER=$(git config --get review.review.cyanogenmod.org.username)
16961696
if [ -z "$CMUSER" ]
16971697
then
16981698
git remote add cmremote ssh://review.cyanogenmod.org:29418/$GERRIT_REMOTE
16991699
else
17001700
git remote add cmremote ssh://$CMUSER@review.cyanogenmod.org:29418/$GERRIT_REMOTE
17011701
fi
1702-
echo You can now push to "cmremote".
1702+
echo "Remote 'cmremote' created"
17031703
}
17041704

17051705
function aospremote()
17061706
{
1707-
git remote rm aosp 2> /dev/null
1708-
if [ ! -d .git ]
1707+
if ! git rev-parse --git-dir &> /dev/null
17091708
then
1710-
echo .git directory not found. Please run this from the root directory of the Android repository you wish to set up.
1709+
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
1710+
return 1
17111711
fi
1712-
PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
1712+
git remote rm aosp 2> /dev/null
1713+
PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
17131714
if (echo $PROJECT | grep -qv "^device")
17141715
then
17151716
PFX="platform/"
@@ -1720,12 +1721,13 @@ function aospremote()
17201721

17211722
function cafremote()
17221723
{
1723-
git remote rm caf 2> /dev/null
1724-
if [ ! -d .git ]
1724+
if ! git rev-parse --git-dir &> /dev/null
17251725
then
1726-
echo .git directory not found. Please run this from the root directory of the Android repository you wish to set up.
1726+
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
1727+
return 1
17271728
fi
1728-
PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
1729+
git remote rm caf 2> /dev/null
1730+
PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
17291731
if (echo $PROJECT | grep -qv "^device")
17301732
then
17311733
PFX="platform/"

0 commit comments

Comments
 (0)