Skip to content

Conversation

phpfui
Copy link
Contributor

@phpfui phpfui commented Mar 20, 2020

This is the PHP implementation only version of Repository::getSize.

There are a couple of interesting things I discovered while doing this PR.

  • Apparently the tests run twice, The second time the repository is bigger.
  • The DU command measures in increments of 1000, not 1024, which is also a valid measurement for K in computers. You say tomato, I say ...

So in the first run of the test, the size of the repo comes in just over 69,000 bytes, as measured by PHP and filesize. On the second run of the test, it comes in at over 70,000 bytes. So I changed the test to >= 69.

The second thing I did was put in a max size test, since that may detect a bug where you don't correctly divide by 1000. Don't ask how I know this.

So there is now an upper limit test of 80K, which should be OK for a while.

But in the end, I think the unit tests numbers are the correct numbers for the tests run.

@GrahamCampbell
Copy link
Member

Excellent. Thanks for this @phpfui.

@GrahamCampbell GrahamCampbell merged commit 2d18d67 into gitonomy:master Mar 21, 2020
@phpfui
Copy link
Contributor Author

phpfui commented Mar 21, 2020 via email

@GrahamCampbell
Copy link
Member

🍻

@phpfui phpfui deleted the PHPOnlyGetSize branch March 22, 2020 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants