Skip to content

Commit 3e034c1

Browse files
authored
fix(wiki-update): guard against rebase/force-push in delta computation (#65)
Before running `git log <last_commit>..HEAD`, check ancestry with `git merge-base --is-ancestor`. If the stored SHA is no longer reachable (branch rebased or force-pushed), warn the user and fall back to a full scan rather than silently under/over-ingesting. Tested on st3ve: verified exit 0 for valid ancestor, exit 1 after simulated rebase and amend. Closes #64 (partial — addresses the rebase fragility raised in discussion)
1 parent 6f20faa commit 3e034c1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.skills/wiki-update/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ Derive a clean project name from the directory name.
3636
Check `.manifest.json` for this project:
3737

3838
- **First time?** Full scan. Everything is new.
39-
- **Synced before?** Look at `last_commit_synced`. Only consider what changed since then. Use `git log <last_commit>..HEAD --oneline` to see what's new.
39+
- **Synced before?** Look at `last_commit_synced`. Before computing the delta, verify the stored SHA is still reachable:
40+
```bash
41+
git merge-base --is-ancestor <last_commit_synced> HEAD
42+
```
43+
- **Exit 0 (ancestor):** Safe. Run `git log <last_commit_synced>..HEAD --oneline` to see what changed.
44+
- **Exit 1 (not an ancestor — rebase or force-push occurred):** The stored SHA is no longer in this branch's history. Warn the user: *"Stored commit `<sha>` is no longer reachable — branch may have been rebased or force-pushed. Falling back to full scan."* Then treat as first-time sync: re-scan everything and update `last_commit_synced` to the current HEAD SHA at the end of Step 6.
4045

4146
If nothing meaningful changed since last sync, tell the user and stop.
4247

0 commit comments

Comments
 (0)