Skip to content

Conversation

@vpratz
Copy link
Contributor

@vpratz vpratz commented Mar 2, 2025

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.

@vpratz
Copy link
Contributor Author

vpratz commented Mar 2, 2025

Do you think this requires further documentation? Or is the info in the log sufficient?

Copy link
Owner

@real-yfprojects real-yfprojects left a 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)

This comment was marked as outdated.

Copy link

Copilot AI left a 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_local abstract 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.

@real-yfprojects real-yfprojects merged commit 11b81e0 into real-yfprojects:main Sep 6, 2025
7 checks passed
@real-yfprojects real-yfprojects added the major incompatible API change (semver) label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major incompatible API change (semver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect gitignore when copying files in DefaultDriver.build_local

2 participants