X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=update;h=2e0aa7843953217b66a23dffddef3dfa47f664d6;hb=be308b7b8c887a71e26a8044bba3b334487452b5;hp=552c1e550e4cd9678e90f44e28b7295389670b41;hpb=8f9a9f223be48dc7f20f3a7361ab606aba121895;p=git-scripts.git diff --git a/update b/update index 552c1e5..2e0aa78 100755 --- a/update +++ b/update @@ -5,19 +5,22 @@ origin="`git config --get --path remote.origin.url`" if [ -n "$origin" ]; then if [ -n "$current" ]; then - echo "UNKNOWN ERROR" + echo "UNKNOWN ERROR (both origin and current)" >&2 + exit 1 else - echo "This script must be run in the origin directory: $origin" - fi >&2 - exit 1 + cd "$origin" || exit 1 + exec ./update + fi elif [ -z "$current" ]; then - echo "UNKNOWN ERROR" >&2 + echo "UNKNOWN ERROR (neither origin nor current)" >&2 exit 1 fi git pull --ff-only current master && web="`git config --get --path remote.web.url`" && -[ -n "$web" ] && git push web +if [ -n "$web" ]; then + git push web master +fi && cd "$current" && exec git pull origin