Re: Properties of trees referencing commit objects (mode 160000)?
flat view
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:50
Josh Triplett [off-list ref] writes:
On Sun, Mar 20, 2016 at 12:18:04AM -0400, Jeff King wrote:quoted
On Sat, Mar 19, 2016 at 03:13:48PM -0700, Josh Triplett wrote:quoted
I'm building some tools to track commit objects, and I'm thinking of using submodule-style references to commit objects in tree objects (mode 160000) to do so. I'm trying to figure out some of the properties of that. Can a commit object referenced that way live in the same repository, rather than some external repository?Yes, it can be in the same repository, but...Will git clone/checkout/etc handle it properly in that case, in the absence of a .gitmodules file? Or would it only work with custom tools?
That depends on the definition of "proper". The default "proper" way for the core Git for submodules/gitlinks is to create an empty directory. If you want to populate a working tree for that, you'd need "git submodule" support, but because you are writing "some tools" on your own, there probably is a reason why you do not want to use "git submodule", so I am guessing that your definition of "proper" does not match either core Git or "git submodule" considers "proper"? In which case you would need to implement your own semantics (you may not even want to have an empty directory there, for example).
quoted
No, we do not follow "gitlinks" like this for reachability. Neither for pruning, nor for object transfer via push/fetch. So you'd need to have a separate reference to it (or history containing it).Argh. If I have a pile of disconnected commits, is there anything git *would* follow to see them, other than a pile of refs?
No.