]> git.cworth.org Git - nogit/blobdiff - nogit
Use consistent indentation for case statement
[nogit] / nogit
diff --git a/nogit b/nogit
index b9a248e3f638ad9e2a203a1b8f77dd47601b4454..3b4c40c51a0bcdc85e2ce3e27f15ab5205f5a6e9 100755 (executable)
--- a/nogit
+++ b/nogit
@@ -103,7 +103,17 @@ nogit_clone()
 
 nogit_sync()
 {
-    echo "Internal error: 'nogit sync' not yet implemented"
+    # First commit any locally modified nogit files
+    GIT_DIR=$NOGIT_DIR git commit -a -m "nogit-sync commit" >/dev/null 2>&1 || true
+
+    # Then, fetch and merge any upstream changes
+    GIT_DIR=$NOGIT_DIR git fetch >/dev/null 2>&1
+    GIT_DIR=$NOGIT_DIR git merge -m "nogit-sync merge" >/dev/null 2>&1
+
+    # Finally, push any new commits up to the upstream repository
+    GIT_DIR=$NOGIT_DIR git push >/dev/null 2>&1
+
+    echo "Completed nogit sync"
 }
 
 if [ $# -lt 1 ]; then
@@ -122,14 +132,14 @@ case "$cmd" in
             false;
         fi
         nogit_clone "$2"
-    ;;
+       ;;
     sync)
         nogit_sync
-    ;;
+       ;;
     help)
         usage
         true
-    ;;
+       ;;
     *)
         echo "Error: Unknown command: $cmd" >&2
         echo ""