]> git.phdru.name Git - git-scripts.git/blobdiff - update
Remove current/master branch from web mirror
[git-scripts.git] / update
diff --git a/update b/update
index c253c7f83c01fe571eda8998f0fee7ad5aaf84c8..7eb5ffcba2b4087591949db022256efec58c863b 100755 (executable)
--- a/update
+++ b/update
@@ -5,11 +5,12 @@ origin="`git config --get --path remote.origin.url`"
 
 if [ -n "$origin" ]; then
    if [ -n "$current" ]; then
-      echo "UNKNOWN ERROR (both origin and current)"
+      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 (neither origin nor current)" >&2
    exit 1
@@ -18,6 +19,9 @@ 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 &&
+   cd "$web" && git branch -dr current/master
+fi &&
 
 cd "$current" && exec git pull origin