-
Notifications
You must be signed in to change notification settings - Fork 4
fix(vcs): use sparse-checkout add for subsequent syncs to preserve existing directories #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(vcs): use sparse-checkout add for subsequent syncs to preserve existing directories #98
Conversation
…isting directories `sparse-checkout set` replaces all patterns, causing previously synced module directories to be removed from the working tree. When loading multiple modules into the same formula store, the second sync would erase the first module's files, breaking formula resolution. Check .git existence to distinguish first-time vs subsequent syncs: first call uses init + set, subsequent calls use add to accumulate patterns. Added TestGitHubClientSyncDirSparseMultiplePaths to cover the multi-directory scenario.
Summary of ChangesHello @MeteorsLiu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
+ Coverage 70.24% 72.10% +1.85%
==========================================
Files 26 26
Lines 1099 1104 +5
==========================================
+ Hits 772 796 +24
+ Misses 259 246 -13
+ Partials 68 62 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Good fix — using Two inline suggestions: (1) the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request fixes an issue with sparse-checkout by switching from git sparse-checkout set to git sparse-checkout add for subsequent syncs, preventing overwrites. The security audit could not be completed due to an inability to access the provided files, so no specific vulnerabilities were identified. Additionally, a comment has been provided to improve the robustness of the check for an existing git repository.
Add mock client implementation to enable unit testing without network calls. Implement comprehensive tests for fileInfo, repo initialization, and repoFS ReadFile error scenarios. - Create mockClient type implementing the client interface for testing - Add mock implementations for Tags, Latest, Stat, ReadFile, and SyncDir - Test fileInfo struct methods (Name, Size, Mode, ModTime, IsDir, Sys) - Validate NewRepo error handling for invalid paths - Test ReadFile error propagation from remote and filesystem This enables faster, more reliable unit tests by eliminating external dependencies.
Replace direct error comparison with os.IsNotExist() to properly detect when the .git directory doesn't exist in syncDirSparse. This fixes the logic to correctly identify whether to initialize a new git repo (init branch) or add to an existing one (add branch). Add test coverage for both branches: one when .git doesn't exist (init) and one when it does (add), both verifying error handling with cancelled context.
sparse-checkout setreplaces all patterns, causing previously synced module directories to be removed from the working tree. When loading multiple modules into the same formula store, the second sync would erase the first module's files, breaking formula resolution.Check .git existence to distinguish first-time vs subsequent syncs: first call uses init + set, subsequent calls use add to accumulate patterns. Added TestGitHubClientSyncDirSparseMultiplePaths to cover the multi-directory scenario.