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

⚠️ Switch RepoClient file access to io.ReadCloser #3912

Merged
merged 7 commits into from
Mar 5, 2024

Commits on Mar 4, 2024

  1. change file access method to io.ReadCloser

    callers don't always need the full file.
    large files are slow and can cause crashes.
    
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    a4e83af View commit details
    Browse the repository at this point in the history
  2. switch tests to hardcoded readers

    Previously they returned bytes or strings, which have corresponding NewReader types.
    Since they don't need to be closed, io.NopCloser works well to give them a fake Close.
    
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    535baf5 View commit details
    Browse the repository at this point in the history
  3. switch tests which called os.ReadFile to os.Open

    os.File fufills io.ReadCloser, so this is an easy change
    
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    b2ce775 View commit details
    Browse the repository at this point in the history
  4. break tarball tests into two steps: reader and read

    The rest of the test was kept the same to minimize the change.
    
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    21913ac View commit details
    Browse the repository at this point in the history
  5. ossfuzz doesn't implement GetFileReader

    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    29e57de View commit details
    Browse the repository at this point in the history
  6. appease linter during refactor

    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    32d9723 View commit details
    Browse the repository at this point in the history
  7. switch git client to new method

    add check which ensures git client fulfills the interface
    
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    spencerschrock committed Mar 4, 2024
    Configuration menu
    Copy the full SHA
    d5ab434 View commit details
    Browse the repository at this point in the history