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

add new validation: repos/archive contains no files #1528

Closed
marcoieni opened this issue Aug 21, 2024 · 2 comments · Fixed by #1530
Closed

add new validation: repos/archive contains no files #1528

marcoieni opened this issue Aug 21, 2024 · 2 comments · Fixed by #1530

Comments

@marcoieni
Copy link
Member

Discussed in #1527 (comment)

I think there are two ways of doing this:

  • add the repo path to the struct Repo contained in the struct Data. In this way we can easily validate that the path is not under repos/archive in the check added in validate archived repos #1527
  • edit the load function and check that all entries of the archive directory aren't files.

I prefer option 1 because it's cleaner and doesn't complicate the "load" method. What do you think?

Unfortunately we can't edit the closure that we pass to load_dir because it only runs on repos under the subdirectories of archive, e.g. repos/archive/rust-lang.

@Kobzol
Copy link
Contributor

Kobzol commented Aug 22, 2024

I was hoping that we could just modify the existing validations, but I see that they work on Data, which doesn't know about the filesystem anymore. I don't like option 1), because it would introduce an external information (filesystem path) into the Data world, which otherwise doesn't deal with the filesystem.

But I also don't think that we need to modify the load closure. Instead, we could just return an error here.

@marcoieni
Copy link
Member Author

Great suggestion! done #1530

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

Successfully merging a pull request may close this issue.

2 participants