git add - adds files to git repository objects tree - though it shouldn't #3396
-
When files are supposed to be added to the repository's git index, the current git.add.adds.objects.to.git.database.mp4To my knowledge, this is not an intended behaviour and unnecessarily bloats the For technical details see here ...Setup
Details
PowerShell 7.1.4
The
After hitting |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Git's index is a light-weight data structure that contains nothing more than:
In other words, the Git index does not even contain the contents. It only has the SHA, or "object name", of the contents. And the only way to get to those contents is, you guessed it, by looking up that key in the object database. In yet other words, what you report as a "shouldn't" is a "but it's by design, actually" instead. |
Beta Was this translation helpful? Give feedback.
-
As far as I understand, it hasn't changed. Obviously(?) the 2-char sub-directory name can vary as it is the first two characters of the [SHA1] object hash, so as more objects are added the more sub-dirs you may have. However Git can also store the objects in the pack file(s) so you may those instead. If a file is larger than a certain size then Git will automatically send the object straight into the pack [many reasons]. It's most likely that you just hadn't immediately noticed the particular details of the internal format, which can be a [backward compatible] moving target.. |
Beta Was this translation helpful? Give feedback.
As far as I understand, it hasn't changed.
Obviously(?) the 2-char sub-directory name can vary as it is the first two characters of the [SHA1] object hash, so as more objects are added the more sub-dirs you may have.
However Git can also store the objects in the pack file(s) so you may those instead. If a file is larger than a certain size then Git will automatically send the object straight into the pack [many reasons].
It's most likely that you just hadn't immediately noticed the particular details of the internal format, which can be a [backward compatible] moving target..