-#!/bin/bash\r
-\r
-. ./.jprojects.sh || exit 255\r
-\r
-for project in ${LIST}; do\r
- if [ ! -d "${JPROJECTS_HOME}/${project}" ]\r
- then\r
- continue\r
- fi\r
-\r
- cd "${JPROJECTS_HOME}/${project}" || exit 255\r
- CHECK_CHANGES=`git commit -a --dry-run | grep "Changes to be committed:"`\r
-\r
- if [ -n "${CHECK_CHANGES}" ]\r
- then\r
- echo "$0: Committing '${project}' ..."\r
- if [ -n "$1" ]\r
- then\r
- git commit -a --signoff -S -m "$1" || exit 255\r
- else\r
- git commit -a --signoff -S || exit 255\r
- fi\r
- else\r
- echo "$0: Nothing to commit for project '${project}'."\r
- fi\r
-done\r
-\r
-echo "$0: All done."\r
-exit 0\r
+#!/bin/bash
+
+. ./.jprojects.sh || exit 255
+
+for project in ${LIST}; do
+ if [ "${project}" = "jprojects-scripts" ]
+ then
+ echo "$0: Skipping jprojects-scripts ..."
+ continue
+ elif [ ! -d "${JPROJECTS_HOME}/${project}" ]
+ then
+ echo "$0: Project '${project}' does not exist."
+ continue
+ fi
+
+ cd "${JPROJECTS_HOME}/${project}" || exit 255
+ CHECK_CHANGES=$(git commit -a --dry-run | grep "Changes to be committed:")
+
+ if [ -n "${CHECK_CHANGES}" ]
+ then
+ echo "$0: Committing '${project}' ..."
+ if [ "$1" = "updated jar(s)" ]
+ then
+ # Special commit ... (known-binaries)
+ git commit --signoff -S lib/*.jar -m "$1"
+ elif [ "$1" = "updated dist.sh" ]
+ then
+ # Special commit ... (known shell script)
+ git commit --signoff -S "dist.sh" -m "$1"
+ elif [ -n "$1" -a -n "$2" ]
+ then
+ # Regular commit with given message
+ git commit $2 --signoff -S -m "$1" || exit 255
+ elif [ -d "$1" -o -f "$1" ]
+ then
+ # Limited commit with no message
+ git commit $1 --signoff -S || exit 255
+ elif [ -n "$1" ]
+ then
+ # Regular commit with given message
+ git commit -a --signoff -S -m "$1" || exit 255
+ else
+ # Regular commit, will open $EDITOR for commit message
+ git commit -a --signoff -S || exit 255
+ fi
+ else
+ echo "$0: Nothing to commit for project '${project}'."
+ fi
+done
+
+echo "$0: All done."
+exit 0