diff --git a/bin/lib/base.lib b/bin/lib/base.lib index edeac31..aa0f104 100644 --- a/bin/lib/base.lib +++ b/bin/lib/base.lib @@ -143,13 +143,8 @@ function git_init() { local REPO_PATH=$1 local BRANCH=$2 - cd $REPO_PATH - if [ $? -eq 0 ]; then - git init -b $BRANCH - return $? - else - return 255 - fi + git init "$REPO_PATH" -b $BRANCH + return $? } @@ -169,13 +164,14 @@ function git_add_full() { } # Git add tracked files to repository -function git_commit_first() { +function git_commit() { local REPO_PATH=$1 + local GIT_MESSAGES=$2 cd $REPO_PATH if [ $? -eq 0 ]; then - git commit -m "$git_first_commited" + git commit -m "$GIT_MESSAGES" return $? else return 255 diff --git a/bin/project.sh b/bin/project.sh index 62a5fe6..ac2fa07 100755 --- a/bin/project.sh +++ b/bin/project.sh @@ -113,7 +113,7 @@ fi # Check if odoo version is supported odoo_verscheck $ODOO_VERS -if [ $? -eq 0 ]; then +if [ $? -ne 0 ]; then echo "[-] $odmsg_014_1 $ODOO_VERS $odmsg_014_2" exit 2 fi @@ -140,28 +140,29 @@ copy_odooapps $BIN_HOME "$PROJECT_NAME" "${ODOO_VERS}" $ODOO_PKG_DEVS copy_odooapps $BIN_HOME "$PROJECT_NAME" "${ODOO_VERS}" $ODOO_PKG_INAR # Initialize git repository -if [ ! -d "$BIN_HOME/$PROJECT_NAME/$ODOO_APP/.git" ] +if [ ! -d "$BIN_HOME/$PROJECT_NAME/.git" ] then - result=$(git_init "$BIN_HOME/$PROJECT_NAME/$ODOO_APP" $ODOO_DEF_BRCH) + result=$(git_init "$BIN_HOME/$PROJECT_NAME" "v$ODOO_VERS") if [ $? -eq 0 ]; then echo "[x] $result" - echo "[x] $git_setbranch: $ODOO_DEF_BRCH" - cp -f $BIN_HOME/$ODOO_CFG/$ODOO_CFG_GITI $BIN_HOME/$PROJECT_NAME/$ODOO_APP/ + echo "[x] $git_setbranch: v$ODOO_VERS" + cp -f $BIN_HOME/$ODOO_CFG/$ODOO_CFG_GITI $BIN_HOME/$PROJECT_NAME/ echo "[x] $git_gitignored $ODOO_CFG_GITI" else echo echo "[-] $git_notinitialized" fi - result=$(git_add_full "$BIN_HOME/$PROJECT_NAME/$ODOO_APP") + result=$(git_add_full "$BIN_HOME/$PROJECT_NAME") if [ $? -eq 0 ]; then echo "[x] $git_add_files" else echo "$result" fi - result=$(git_commit_first "$BIN_HOME/$PROJECT_NAME/$ODOO_APP") + result=$(git_commit "$BIN_HOME/$PROJECT_NAME" "$git_first_commited") if [ $? -eq 0 ]; then echo "[x] $git_end_commited" + cd $BIN_HOME/$PROJECT_NAME && git checkout -q -b $ODOO_DEF_BRCH && echo "[x] $git_setbranch: $ODOO_DEF_BRCH" else echo "$result" fi