Normally we use the SEEN flag to prevent commits from entering pending twice.  You don't do that here.  As far as I can tell, using the depth provides the same effect, but it took me a long time to think about.

Since this deviates from our more typical pattern of relying on a flag to track "have we processed this already", please provide a short proof of why we don't need a flag here to prevent duplicates and stuff it in a comment so future readers don't have to expend as many brain cells I just did over whether or not this works.  (Its easier to verify a proof than it is to derive one on the fly...)