Skip to content
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

Make buf generate --clean a per-plugin option that does a "smart" clean #3126

Open
bufdev opened this issue Jul 4, 2024 · 1 comment
Open
Labels
Feature New feature or request

Comments

@bufdev
Copy link
Member

bufdev commented Jul 4, 2024

See #3124 (comment) for an explanation.

@bufdev bufdev added the Feature New feature or request label Jul 4, 2024
@doriable
Copy link
Member

doriable commented Jul 4, 2024

For zip/tar files: sum the file beforehand, generate the new file, if there is a diff, overwrite, if the filename changed (somehow), delete the old one
For directories: sum each file beforehand, generate the new files, for each file that no longer exists, delete, for each file that changed, overwrite

There are a few things happening here and I wonder if some of this should be separated out:

  • For files that have not changed, ignore them
  • For files that no longer exist, delete them
  • For files where contents have changed, overwrite them
  • For net new files, add them

For the first one, files that have not changed being ignored, would it be reasonable to implement this as the default behaviour of buf generate, regardless of the --clean flag/config? This seems like it would be backwards compatible.

Then --clean would only need to handle deleting files that no longer exist/have been renamed, overwriting files with new/different content, and adding new any new files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants