Git internals

Git index entry padding

Calculate a version-2 index entry size from its UTF-8 path.

Your inputs

Start with an example

Your inputs stay in your browser.

Your result

Example result

How it works

Add 40 stat bytes, object hash and 2 flag bytes. Add the UTF-8 pathname, then 1–8 null bytes so the entry length is a multiple of eight.

A one-byte path with a 20-byte hash uses 62+1+1 = 64 bytes.

Limits

Version 2 without extended flags. Does not include the index file header, extensions or file checksum; version 4 path compression is excluded.