Explorar o código

Fix false warning when local skills repo is ahead of upstream

The initialization script was incorrectly warning about upstream updates
when the local repository was ahead of upstream. This happened because
the logic didn't distinguish between three states:
- Local behind: LOCAL=BASE, REMOTE≠BASE → should update or warn
- Local ahead: LOCAL≠BASE, REMOTE=BASE → no warning needed
- Diverged: LOCAL≠BASE, REMOTE≠BASE → should warn

Changed the else clause to only set SKILLS_BEHIND when REMOTE≠BASE,
which correctly handles all three scenarios.

Fixes the issue reported in #8 where users with local commits ahead
of upstream were seeing spurious "new skills available" warnings.
Jesse Vincent hai 1 ano
pai
achega
927512f1ab
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      lib/initialize-skills.sh

+ 4 - 3
lib/initialize-skills.sh

@@ -27,7 +27,7 @@ if [ -d "$SKILLS_DIR/.git" ]; then
     if [ -n "$LOCAL" ] && [ -n "$REMOTE" ] && [ "$LOCAL" != "$REMOTE" ]; then
     if [ -n "$LOCAL" ] && [ -n "$REMOTE" ] && [ "$LOCAL" != "$REMOTE" ]; then
         # Check if we can fast-forward (local is ancestor of remote)
         # Check if we can fast-forward (local is ancestor of remote)
         if [ "$LOCAL" = "$BASE" ]; then
         if [ "$LOCAL" = "$BASE" ]; then
-            # Fast-forward merge is possible
+            # Fast-forward merge is possible - local is behind
             echo "Updating skills to latest version..."
             echo "Updating skills to latest version..."
             if git merge --ff-only @{u} 2>&1; then
             if git merge --ff-only @{u} 2>&1; then
                 echo "✓ Skills updated successfully"
                 echo "✓ Skills updated successfully"
@@ -35,10 +35,11 @@ if [ -d "$SKILLS_DIR/.git" ]; then
             else
             else
                 echo "Failed to update skills"
                 echo "Failed to update skills"
             fi
             fi
-        else
-            # Can't fast-forward - will be reported at the end
+        elif [ "$REMOTE" != "$BASE" ]; then
+            # Remote has changes (local is behind or diverged)
             echo "SKILLS_BEHIND=true"
             echo "SKILLS_BEHIND=true"
         fi
         fi
+        # If REMOTE = BASE, local is ahead - no action needed
     fi
     fi
 
 
     exit 0
     exit 0