Bail better when changebranch fails due to something like trumping a file.
[socialgit.git] / bin / commitbranch
bloba36ab6950d97eb8e1c0e64c52494256384e19935
1 #!/bin/sh
2 # commitbranch
4 CURBRANCH=`currentbranchname`
6 if ( echo $CURBRANCH|grep ".dirty_for_rebase" ); then
7 echo
8 else
9 git commit -a 2> /tmp/.commitbranch_commit_stderr
11 if [[ $(cat /tmp/.commitbranch_commit_stderr) = "" ]]; then
12 git push origin $CURBRANCH
13 if [[ "$?" = "0" ]]; then
14 git push --tags
15 updatebranch
16 UPDATE_EXIT=$?
17 if [[ $UPDATE_EXIT != "0" ]]; then
18 echo "Need to resolve update conflicts before commiting to the central repository."
19 exit -1
20 else
21 PUSH_OK=0
22 # Use the real current branch name not the current before the script started
23 if ( test $CURBRANCH != "master" ); then
24 mergefrommaster
25 PUSH_OK=$?
27 if ( test $PUSH_OK = 0 ); then
28 git push --tags origin $CURBRANCH
29 git fetch
32 else
33 echo "Cannot connect to remote repository."