- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
Description
Description
Currently, after a user performs a git commit, GhostDev automatically triggers the onFilesStaged() function again.
This behavior is unintended, as the commit action should mark the end of the staging phase.
Additionally, the first git add performed after that commit does not trigger onFilesStaged(), but the next subsequent git add does.
This inconsistent triggering indicates that the file watcher or event listener may not be resetting properly after the commit event.
Proposed Solution
Investigate and update the repository watcher logic to correctly handle .git/index changes.
Focus on the setupRepositoryWatcher() function in extension.ts, which likely monitors file system changes inside the .git directory.
The issue may arise because the watcher reacts to .git/index updates caused by commits, or fails to reinitialize its state afterward.
Hint to resolve:
- Track the 
.git/indexfile specifically. - Ensure that 
onFilesStaged()only fires on actual staging events (git add) and not on commit writes. - Consider debouncing or filtering events triggered by Git commit operations.
 
Expected Outcome
onFilesStaged()triggers only when files are explicitly staged viagit add.- Commits no longer cause an unnecessary retrigger.
 - The watcher remains stable across multiple commit and staging cycles.