add git_assure_remote to the lib
[scripts.git] / .mrconfig
index 5cd4106..abd8977 100644 (file)
--- a/.mrconfig
+++ b/.mrconfig
@@ -1,3 +1,21 @@
+[DEFAULT]
+
+lib = 
+    git_assure_remote() {
+        remote="$1"
+        url="$2"
+        git remote | grep -q "^$remote$" || {
+            echo I: Adding remote $remote
+            git remote add "$remote" "$url"
+            git fetch "$remote"
+        }
+        git remote -v | grep "^$remote" | grep -q "$url" || {
+            echo I: Changing remote URL for $remote
+            git remote set-url $remote $url
+            git fetch "$remote"
+        }
+    }
+
 # general repos
 
 [gitolite-admin]