]> git.mxchange.org Git - jprojects-scripts.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 5 Oct 2019 00:27:40 +0000 (02:27 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 5 Oct 2019 00:27:40 +0000 (02:27 +0200)
- added "backup2" in fix-project-remotes.sh
- rewrote cherry-jprojects.sh a bit, because the variable assignment can be done
  below first 2 if-blocks

Signed-off-by: Roland Häder <roland@mxchange.org>
cherry-jprojects.sh
fix-project-remotes.sh

index c04438e7de0c2b80a15cb98d61333e9423869fd0..1ecb7945ed71f8769a80eb73076579ea5b5a3cff 100755 (executable)
@@ -3,8 +3,6 @@
 . ./.jprojects.sh || exit 255
 
 for project in ${LIST}; do
-       COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits"
-
        if [ "${project}" = "jprojects-scripts" ]
        then
                echo "$0: Skipping jprojects-scripts ..."
@@ -13,7 +11,11 @@ for project in ${LIST}; do
        then
                echo "$0: Project '${project}' does not exist."
                continue
-       elif [ ! -f "${COMMITS_FILE}" ]
+       fi
+
+       COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits"
+
+       if [ ! -f "${COMMITS_FILE}" ]
        then
                # No .gitcommits file, skip this silently
                continue
index a9a928872552142125d40c053e3658c2b68f1870..773330d04ad3a86135e6a3d5fb0300568cf0c463 100755 (executable)
@@ -6,6 +6,7 @@ UNWANTED_NAME="stick"
 WANTED_NAME1="upstream"
 WANTED_NAME2="daedalus"
 WANTED_NAME3="transport"
+WANTED_NAME4="backup2"
 
 GIT_USER="quix0r"
 GIT_SERVER="git.mxchange.org"
@@ -16,6 +17,7 @@ GIT_ORIGIN="origin"
 MEDIA_BASE="/media"
 MEDIA_NAME1="Backup"
 MEDIA_NAME2="Transport"
+MEDIA_NAME3="Backup"
 MEDIA_PATH="Java Project"
 
 for project in ${LIST}; do
@@ -38,12 +40,14 @@ for project in ${LIST}; do
        GIT_URL4="file:///E:/Java%20Project/${project}.git"
        GIT_URL5="E:/Java Project/${project}.git"
        GIT_URL6="${MEDIA_BASE}/${USER}/${MEDIA_NAME1}/${MEDIA_PATH}/${project}.git"
+       GIT_URL7="${MEDIA_BASE}/${USER}/${MEDIA_NAME3}/${MEDIA_PATH}/${project}.git"
        echo "$0: GIT_URL1='${GIT_URL1}'"
        echo "$0: GIT_URL2='${GIT_URL2}'"
        echo "$0: GIT_URL3='${GIT_URL3}'"
        echo "$0: GIT_URL4='${GIT_URL4}'"
        echo "$0: GIT_URL5='${GIT_URL5}'"
        echo "$0: GIT_URL6='${GIT_URL6}'"
+       echo "$0: GIT_URL7='${GIT_URL7}'"
 
        if [ "$1" = "l" ]
        then
@@ -64,6 +68,7 @@ for project in ${LIST}; do
                        git remote add "${WANTED_NAME1}" "${GIT_URL1}"
                        git remote add "${WANTED_NAME2}" "${GIT_URL2}"
                        git remote add "${WANTED_NAME3}" "${GIT_URL3}"
+                       git remote add "${WANTED_NAME4}" "${GIT_URL4}"
                else
                        echo "$0: Don't know how to create repositories, maybe unsupported."
                        exit 1
@@ -170,7 +175,8 @@ for project in ${LIST}; do
                UPSTREAM_REMOTE1=$(git remote | grep "${WANTED_NAME1}")
                UPSTREAM_REMOTE2=$(git remote | grep "${WANTED_NAME2}")
                UPSTREAM_REMOTE3=$(git remote | grep "${WANTED_NAME3}")
-               echo "$0: UPSTREAM_REMOTE1='${UPSTREAM_REMOTE1}',UPSTREAM_REMOTE2='${UPSTREAM_REMOTE2}',UPSTREAM_REMOTE3='${UPSTREAM_REMOTE3}'"
+               UPSTREAM_REMOTE4=$(git remote | grep "${WANTED_NAME4}")
+               echo "$0: UPSTREAM_REMOTE1='${UPSTREAM_REMOTE1}',UPSTREAM_REMOTE2='${UPSTREAM_REMOTE2}',UPSTREAM_REMOTE3='${UPSTREAM_REMOTE3},UPSTREAM_REMOTE4='${UPSTREAM_REMOTE4}'"
 
                if [ -n "${UPSTREAM_REMOTE1}" ]
                then
@@ -202,6 +208,17 @@ for project in ${LIST}; do
                        echo "$0: No wanted '${WANTED_NAME3}' in '${project}'. Adding ..."
                        git remote add "${WANTED_NAME3}" "${GIT_URL3}" --track "${GIT_BRANCH}" || exit 255
                fi
+
+               if [ -n "${UPSTREAM_REMOTE4}" ]
+               then
+                       echo "$0: Remote '${WANTED_NAME4}' found in '${project}'."
+               elif [ ! -d "${GIT_URL4}" ]
+               then
+                       echo "$0: Remote '${WANTED_NAME4}' cannot be created, path '${GIT_URL4}' missing."
+               else
+                       echo "$0: No wanted '${WANTED_NAME4}' in '${project}'. Adding ..."
+                       git remote add "${WANTED_NAME4}" "${GIT_URL4}" --track "${GIT_BRANCH}" || exit 255
+               fi
        fi
 
        echo "$0: Setting upstream to '${GIT_ORIGIN}/${GIT_BRANCH}' ..."