What is objects/17 git directory?

Hello,

Can anyone explain that purpose of objects/17 directory inside .git directory?

Thanks!

1 answer

1 accepted

Each 'git commit'

  • creates a unique commit Id (160-bit SHA-1 hash - calculated from the contents of the commit)
  • stores its data within the folder .git/objects within subfolders

==> The subfolders are created from the first two characters of your current commit-ID. The files within the subfolders are named from the rest of your commit-ID

This splitting is probably done to avoid thousands of files within a single folder.

---------------------

Example:

Your commitID is 17556a21ebc68ce39bb53f26af9a590eb76d8c46

-> corresponding data is stored within .git/objects/17/556a21ebc68ce39bb53f26af9a590eb76d8c46

 

 

 

Bitbucket server code (GC scheduler) used exactly objects/17 dir. This is some of special directory i guess, but i can't find any docs about this directory.

And, yes, i know that is two first symbols from commit hash. My question is little bit another smile

Bitbucket Server checks how many loose objects there are in the 17 directory to decide whether a gc needs to be run. The assumption is that loose objects should be reasonably evenly distributed across the different object directories, so the count in 17 is a reasonable indicator. There's nothing special about 17 though..

smile

If directory does not exists will GC never executed?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,773 views 1 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you