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

Fix: Getting the size from github rest api #38

Closed
wants to merge 6 commits into from
Closed

Conversation

mAmineChniti
Copy link
Collaborator

Closes #31

  • Getting repo size directly using github rest api
  • Formatting the size from KB to the proper format accordingly

@mAmineChniti mAmineChniti requested a review from AminoffZ March 18, 2024 18:07
@mAmineChniti mAmineChniti self-assigned this Mar 18, 2024
@mAmineChniti mAmineChniti added bug Something isn't working enhancement New feature or request labels Mar 18, 2024
@AminoffZ
Copy link
Owner

Theoritically this makes sense, however, the size returned by that API call is inaccurate. I'm getting 1.19MB as total size. The current implementation with this repo as test subject at least results in an accurate decompressed main branch download size. Neither implementation at the moments take into account other branches.

To replicate:

  • Download the source code
  • Extract the zip
  • See folder size

@mAmineChniti
Copy link
Collaborator Author

@AminoffZ i think the truth lies somewhere in the middle the api call gives me 2.19 MB, the file size counter gives 1.31 MB, same time downloading and decompressing gives 1.30 MB and cloning gives 3.3MB, so i find it weird that one set of files on one specific branch that hasn't changed has so many changing size values based on the download/calculation method, what should we do?

@XZTDean
Copy link
Contributor

XZTDean commented Mar 18, 2024

I think the size return from API is counting all the storage space taken on github. It is not only counting the default branch file sizes.
I have a repo that the default branch only contains a readme file, but the size from API is much larger than the readme file size. The API value is almost equal to the .git folder size.

Copy link
Owner

@AminoffZ AminoffZ left a comment

Choose a reason for hiding this comment

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

TLDR: User Value from current implementation > suggested change.

  1. Until we can reliably fetch / calculate the clone size, we should show source code folder size (current implementation).
  2. When we have clone size, we could show both (UI suggestions welcome)

@mAmineChniti mAmineChniti marked this pull request as draft March 19, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display the Git-Repository size instead of total file size (or both?)
3 participants