Permalink
Browse files

Disabled push on empty commit - for glance & swift

Signed-off-by: Andrey Brindeyev <abrindeyev@griddynamics.com>
  • Loading branch information...
Andrey Brindeyev
Andrey Brindeyev committed Jun 2, 2011
1 parent 63cc129 commit e6f8be095a4767280518383384497674a3a06724
Showing with 44 additions and 40 deletions.
  1. +22 −20 rebuild_glance.sh
  2. +22 −20 rebuild_swift.sh
View
@@ -61,28 +61,30 @@ if [ "$?" != "0" ]; then
else
git add "$GLANCESPECORIG"
git commit -m "Update to bzr$BUILD"
- git push
- if [ "$?" != "0" ]; then
- # Somebody pushed a commit to origin since we last time pulled.
- # Need to check - if that commit was to our file or to some other file?
- GitHubUrl="http://github.com/api/v2/json/commits/list/$GithubUserProject/$GITCURBRANCH"
- LastRepoCommit="$(curl -s $GitHubUrl | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
- LastSpecCommit="$(curl -s $GitHubUrl/$NOVASPECORIG | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
- if [[ "$LastRepoCommit" != "$LastSpecCommit" ]]; then
- # Last Git repo commit was not to our specfile
- # Probably we can safely do git pull to merge following by git push
- git pull
- if [ "$?" != "0" ]; then
- echo "Sorry, automatic merge failed"
- echo "Human intervention required, giving up here"
+ if [ "$?" != "1" ]; then
+ git push
+ if [ "$?" != "0" ]; then
+ # Somebody pushed a commit to origin since we last time pulled.
+ # Need to check - if that commit was to our file or to some other file?
+ GitHubUrl="http://github.com/api/v2/json/commits/list/$GithubUserProject/$GITCURBRANCH"
+ LastRepoCommit="$(curl -s $GitHubUrl | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
+ LastSpecCommit="$(curl -s $GitHubUrl/$NOVASPECORIG | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
+ if [[ "$LastRepoCommit" != "$LastSpecCommit" ]]; then
+ # Last Git repo commit was not to our specfile
+ # Probably we can safely do git pull to merge following by git push
+ git pull
+ if [ "$?" != "0" ]; then
+ echo "Sorry, automatic merge failed"
+ echo "Human intervention required, giving up here"
+ exit -1
+ fi
+ git push
+ else
+ # Last commit was to our specfile
+ git pull
+ echo "There should be a conflict above, please fix by hands and commit"
exit -1
fi
- git push
- else
- # Last commit was to our specfile
- git pull
- echo "There should be a conflict above, please fix by hands and commit"
- exit -1
fi
fi
fi
View
@@ -61,28 +61,30 @@ if [ "$?" != "0" ]; then
else
git add "$SpecOrig"
git commit -m "Update to bzr$BUILD"
- git push
- if [ "$?" != "0" ]; then
- # Somebody pushed a commit to origin since we last time pulled.
- # Need to check - if that commit was to our file or to some other file?
- GitHubUrl="http://github.com/api/v2/json/commits/list/$GithubUserProject/$GitCurBranch"
- LastRepoCommit="$(curl -s $GitHubUrl | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
- LastSpecCommit="$(curl -s $GitHubUrl/$SpecOrig | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
- if [[ "$LastRepoCommit" != "$LastSpecCommit" ]]; then
- # Last Git repo commit was not to our specfile
- # Probably we can safely do git pull to merge following by git push
- git pull
- if [ "$?" != "0" ]; then
- echo "Sorry, automatic merge failed"
- echo "Human intervention required, giving up here"
+ if [ "$?" != "1" ]; then
+ git push
+ if [ "$?" != "0" ]; then
+ # Somebody pushed a commit to origin since we last time pulled.
+ # Need to check - if that commit was to our file or to some other file?
+ GitHubUrl="http://github.com/api/v2/json/commits/list/$GithubUserProject/$GitCurBranch"
+ LastRepoCommit="$(curl -s $GitHubUrl | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
+ LastSpecCommit="$(curl -s $GitHubUrl/$SpecOrig | perl -MJSON::XS -e "\$a='';while(<>){\$a.=\$_} \$d=decode_json(\$a);print \$d->{'commits'}[0]->{'id'}")"
+ if [[ "$LastRepoCommit" != "$LastSpecCommit" ]]; then
+ # Last Git repo commit was not to our specfile
+ # Probably we can safely do git pull to merge following by git push
+ git pull
+ if [ "$?" != "0" ]; then
+ echo "Sorry, automatic merge failed"
+ echo "Human intervention required, giving up here"
+ exit -1
+ fi
+ git push
+ else
+ # Last commit was to our specfile
+ git pull
+ echo "There should be a conflict above, please fix by hands and commit"
exit -1
fi
- git push
- else
- # Last commit was to our specfile
- git pull
- echo "There should be a conflict above, please fix by hands and commit"
- exit -1
fi
fi
fi

0 comments on commit e6f8be0

Please sign in to comment.