Continued a bit:
[jprojects-scripts.git] / commit-jprojects.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 for project in ${LIST}; do
6         if [ "${project}" = "jprojects-scripts" ]
7         then
8                 echo "$0: Skipping jprojects-scripts ..."
9                 continue
10         elif [ ! -d "${JPROJECTS_HOME}/${project}" ]
11         then
12                 echo "$0: Project '${project}' does not exist."
13                 continue
14         fi
15
16         cd "${JPROJECTS_HOME}/${project}" || exit 255
17         CHECK_CHANGES=`git commit -a --dry-run | grep "Changes to be committed:"`
18
19         if [ -n "${CHECK_CHANGES}" ]
20         then
21                 echo "$0: Committing '${project}' ..."
22                 if [ -n "$1" ]
23                 then
24                         git commit -a --signoff -S -m "$1" || exit 255
25                 else
26                         git commit -a --signoff -S || exit 255
27                 fi
28         else
29                 echo "$0: Nothing to commit for project '${project}'."
30         fi
31 done
32
33 echo "$0: All done."
34 exit 0