It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Repo size in Stash

In our Stash production, we have a Repository System Info Plugin which shows the following information.

- Repository location on disk

- The size of the repository

- The installed SCM hooks

However, the size of the repository shown in Stash and the size of the cloned repository appears to be different even after deleting the .git folder.

Why is it so ? Am I doing anything wrong ?

My understanding is that cloned repo size should be same as what is shown in the Stash through Repository System Info Plug-in.

Please advise. Thanks

2 answers

1 accepted

0 votes
Answer accepted
Michael Heemskerk Atlassian Team Apr 09, 2014

The repo size that's reported by the Repository System Info Plug-in is the size of bare repository on the server (comparable to the .git directory of a regular git repository). Bare repositories don't contain a working tree and will therefore be smaller than a 'normal' git repository.

Your clone will be a normal git repository and should therefore be bigger than the size reported by the plugin.

Tim Crall Apr 29, 2014

That makes sense, but we are seeing the size as reported by the Stash repository settings differ wildly even from the .git folder of a cloned repo. We are trying to find a way to calculate how much space the repo is actually going to take up when cloned so our scripts can ensure the box has enough disk space before cloning.

0 votes
Balazs Szakmary Apr 29, 2014

The .git folder of a non-bare clone contains some additional stuff to the bare repo. (some objects are uncompressed, local branches can be present, etc.).

The ratio between the bare repo size and the non-bare clones can further vary quite much depending on e.g. the amount of binary (badly compressible) files, amount of history, etc.

I think your best option is to clone (at least some of) your repositories to somebody's computer to estimate this ratio and use [bare size]*[ratio+some margin] as the threshold in your scripts.

Tim Crall Apr 29, 2014

I will do as you suggest. I'm curious, though. Even the size of a repo cloned using

git clone --bare

seems to differ in size from the size reported by Stash by a factor of about 2.

Balazs Szakmary May 01, 2014

That is interesting. Which one is bigger? (I have no idea why, other that some objects might be unpacked in one and packed in the other.)

Michael Heemskerk Atlassian Team May 01, 2014

I would expect the repository in Stash to be bigger. It will have more unpacked objects. Also, some objects may still be referenced by Stash's pull request refs, which don't get fetched by default when you clone a repository (they're outside the default ref spec). Therefore, you'll retrieve less objects and would get a smaller repository when you create a _bare_ clone.

Tim Crall May 01, 2014

The bare clone is consistently bigger. I've collected data on 9 different repos, and the size of the bare cloned repo varies from 1.0 (meaning, obviously, it was about the same for that repo) to 1.9 x the size reported by Stash. My mean result was 1.3 with a stdev of 0.3. This data was gathered immediately after performing the --bare clone. Not really an issue for me since what I really needed to be able to do was to estimate how much space the non-bare clone will take up, so I'm following Balazs's suggestion and just multiplying by a scaling factor (I'm using 15, because the highest ratio I found was 12.3).

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,096 views 1 20
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you