Fix: Detect files modified directly on GitHub#49
Open
TheOutdoorProgrammer wants to merge 1 commit intosilvanocerza:mainfrom
Open
Fix: Detect files modified directly on GitHub#49TheOutdoorProgrammer wants to merge 1 commit intosilvanocerza:mainfrom
TheOutdoorProgrammer wants to merge 1 commit intosilvanocerza:mainfrom
Conversation
Fixes silvanocerza#45 - Plugin now detects when files are edited via GitHub web UI. The manifest only updates when syncing through this plugin. We now compare actual tree SHAs with manifest SHAs to catch external modifications. Changes: - Compare remote file SHAs from git tree with manifest SHAs - Update manifest when external changes detected - Handle new files added externally
c357571 to
07dca55
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #45
When files are edited directly on GitHub (via web UI or other means outside the plugin), the plugin fails to detect these changes during sync. The user sees "Nothing to sync" even though files have been modified remotely.
Root Cause
The plugin uses a manifest file (
github-sync-metadata.json) to track file SHAs. The manifest only updates when syncing through this plugin. When someone edits a file directly on GitHub:Solution
After fetching the remote manifest, we now compare:
getRepoContent())If they differ, we update the manifest entry to reflect the actual state. This allows
determineSyncActions()to detect the change and trigger a download.Changes Made
Testing
✅ Tested and verified working:
Before fix: "Nothing to sync"
After fix: File detected and downloaded
Test Environment
Impact
sync-manager.tsAdditional Notes
This fix handles two scenarios:
The manifest comment documents why this comparison is necessary - without it, future maintainers wouldn't understand the limitation of the manifest-based approach.