-
Notifications
You must be signed in to change notification settings - Fork 5
Only copy files not ignored by git for local build #31
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
Only copy files not ignored by git for local build #31
Conversation
|
Do you think this requires further documentation? Or is the info in the log sufficient? |
8440626 to
12fa86c
Compare
real-yfprojects
left a comment
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.
Thanks. I like this approach as we don't have to maintain any code implementing the gitignore specifications.
However it seems like git ls-files --others doesn't support submodules, so this is something we need to think about.
Currently the code changes do not fit into the modular architecture of this project. As we cannot expect everyone to use git, this has to be hidden behind some level of abstraction. In this case I think it would be best to add a checkout_local or similarly named method to vcs.VersionProvider that is called by the driver.
Lastly, can you remove the commits from #29 that slipped into this PR? (e.g. using git rebase -i)
12fa86c to
3b25a7d
Compare
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.
Pull Request Overview
This PR adds the ability to selectively copy only non-ignored files for local builds by leveraging git's file listing capabilities. Instead of copying the entire working directory, the implementation uses git ls-files --cached --others --exclude-standard to identify files that should be included, significantly improving build performance when large ignored files/directories are present.
- Introduces a new
checkout_localabstract method in the VCS interface - Implements git-based selective file copying with fallback to full directory copy
- Updates the build driver to use the new selective copying mechanism
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sphinx_polyversion/vcs.py | Adds abstract checkout_local method to VCS interface |
| sphinx_polyversion/git.py | Implements selective file copying using git ls-files with fallback logic |
| sphinx_polyversion/driver.py | Updates local build to use new VCS checkout_local method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Closes #30.
Using
git ls-files --cached --others --exclude-standard, we can obtain all files that are not ignored by git. This will also include files that are not checked in. We can use this list to only copy non-ignored files for local builds, which can significantly speed up the build process when large ignored files/directories are present in the working directory.This PR tries to use the git command, and falls back to a full copy in case of errors.