X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=update;h=fd10a24b725bd744ab58db2f5282a70e05641b2e;hb=4a0a2bbf6e27d62d4a640ab41baa9675068a68bb;hp=c253c7f83c01fe571eda8998f0fee7ad5aaf84c8;hpb=3ce29ef97fa73c37eb33c42fd611dc9ea6ef35b8;p=git-scripts.git diff --git a/update b/update index c253c7f..fd10a24 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 (both origin and current)" + echo "Config 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" && + exec ./update + fi elif [ -z "$current" ]; then - echo "UNKNOWN ERROR (neither origin nor current)" >&2 + echo "Wrong directory 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 +fi && cd "$current" && exec git pull origin