Sfoglia il codice sorgente

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 11 mesi fa
parent
commit
927512f1ab
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  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
         # Check if we can fast-forward (local is ancestor of remote)
         if [ "$LOCAL" = "$BASE" ]; then
-            # Fast-forward merge is possible
+            # Fast-forward merge is possible - local is behind
             echo "Updating skills to latest version..."
             if git merge --ff-only @{u} 2>&1; then
                 echo "✓ Skills updated successfully"
@@ -35,10 +35,11 @@ if [ -d "$SKILLS_DIR/.git" ]; then
             else
                 echo "Failed to update skills"
             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"
         fi
+        # If REMOTE = BASE, local is ahead - no action needed
     fi
 
     exit 0