Tejun Heo <tj@xxxxxxxxxx> writes: > Hmmm... I see. I still have a bit of trouble seeing why doing it that > way is better tho. Wouldn't new-object-hook be simpler? They'll > achieve about the same thing but one would need to keep the states in > two places. The new-object-hook thing will not have keep the states. Whenever Git realizes that it created a new object, it must call that hook, and at that point in time, without keeping any state, it knows which objects are what it has just created. So "in two places" is not a problem at all. There is only one place (i.e. the place the sweeper would record what it just did to communicate with its future invocation). A new-object-hook that will always be called any time a new object enters the picture would be a nightmare to maintain up-to-date. One missed codepath and your coverage will have holes. Having a back-up mechanism to sweep for new objects will give you a better chance of staying correct as the system evolves, I'd think.