What is a loose object?

Asked

Viewed 89 times

4

From time to time my versioning tool tells me there’s something loose in my branch.

Hang loose

Fortunately the tool always tightens my loose ones, but it gets the curiosity. Why does Git loosen me objects? There’s something I can do to make my branch not so flabby?

  • 2

    I asked a question not about Loose, but about dangling. I think they could be related questions. Here it is: https://answall.com/q/285851/64969

1 answer

4


tl;dr

A "loose" object is stored is, without being "tied" to another to define itself. It is "loose" within the repository. A primary information file.


I couldn’t find the information direct on the subject. However, the official documentation of Git (navigating from here) there is a mention of loose objects when he talks about the Internals packaging (my griffin):

You have two Nearly identical 22K Objects on your disk (each Compressed to approximately 7K). Wouldn’t it be nice if Git could store one of them in full but then the Second Object only as the delta between it and the first?

It turns out that it can. The initial format in which Git Saves Objects on disk is called a "Loose" Object format. However, occasionally Git packs up several of These Objects into a single Binary file called a "packfile" in order to save space and be more Efficient. Git does this if you have Too Many Loose Objects Around, if you run the git gc command Manually, or if you push to a remote server.

In free translation (keeping my griffin):

You have two nearly identical 22K objects on your disk (each compressed to approximately 7K). It wouldn’t be cool if Git could store only one completely but the second object like a delta between him and the first?

Turns out he can. A initial form where Git saves the object to disk **is called the "loose" object" format". However, occasionally Git will package several of these objects into a single binary file called "packfile" to save disk space and be more efficient. Git does this if you have too many loose objects around, if you run the command git gc at hand or if you push to a remote server.

So through this excerpt from the documentation, we can infer which objects loose are those that are not stored so compressed. One way to see it is as a counterpoint to tied up, an object loose. This is even, in a way, supported by definition of Loose on Wiktionary:

Adjective

Loose (Comparative looser, Superlative loosest)

  1. Not Fixed in place tightly or firmly.

    • This Wheelbarrow has a Loose wheel.

Where it indicates as translation to not tightly Fixed:

Portuguese: loose (pt) m, loose (pt) m

Therefore, a "loose"/"loose" object does not need to be "tied" strongly to another object to define itself, while another object may be tied to a loose object or to another tied object to define itself.


Apparently, there are not many relationships between objects dangling and Loose.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.