Skip to contentSkip to conversation

git objects directory

DISCUSSION Lexington Luthor 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

Can someone please explain why git puts its objects in 256 sub-directories of objects instead of directly in the objects directory itself? I am trying to learn git (actually cogito), but I still don't understand why this structure is used.

What is the point of having the first byte of the hash as the directory name?

-- LL

#1 lore raw
Quoted 4 lines · Lexington Luthor

Can someone please explain why git puts its objects in 256 sub-directories of objects instead of directly in the objects directory itself? I am trying to learn git (actually cogito), but I still don't understand why this structure is used.

Because otherwise there would be a lot of objects (files) in the objects subdirectory, which would cause a lot of problems with many filesystems.

Anyway, you best leave that directory be, but I understand your desire to understand :-).

nikolai

Signature · 3 lines
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
#2 lore raw
In reply to Lexington Luthor

Hi,

Quoted 3 lines · Lexington Luthor

Can someone please explain why git puts its objects in 256 sub-directories of objects instead of directly in the objects directory itself?

Some filesystems have problems with huge directories. And originally the plan was to have all objects as files (now the older ones live in packs).

Hth,
Dscho