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

Show total disk space freed on cleanup. #12970

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

emiliadecaudin
Copy link

@emiliadecaudin emiliadecaudin commented Mar 7, 2022

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Shows total disk space freed on cleanup. Currently, Cleanup.disk_cleanup_size is only incremented during dry runs, and total disk space freed is only shown if Cleanup.disk_cleanup_size is not zero. This PR moves the @disk_cleanup_size update out of the dry_run check, and removes the bizarre provision to negate the update, since disk_usage is invariable equal to path.disk_usage, and thus @disk_cleanup_size += disk_usage - path.disk_usage never does anything.

I could not find any explanation / could not imagine a reason why this was done in the first place; please enlighten me if there actually was a reason for this. In any case, the redundant/useless code should be removed.

I was motivated to make this change after running brew cleanup, seeing a bunch of files removed, and wondering how much space that actually freed.

@RandomDSdevel
Copy link
Contributor

     This may actually have been broken for a while, I think? I don't know which commit made that the case, though, unfortunately. I meant to get around to looking into that and fixing it at some point but never did, so thanks for this, @emiliadecaudin!

@Bo98
Copy link
Member

Bo98 commented Mar 7, 2022

I think the intention was the second path.disk_usage returned the new size, but it doesn't actually work that way.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @emiliadecaudin!

@MikeMcQuaid MikeMcQuaid merged commit 6c7dd00 into Homebrew:master Mar 8, 2022
@emiliadecaudin emiliadecaudin deleted the cleanup_total branch March 8, 2022 15:12
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants