[#4691] Prevent needless walks up the commit tree when computing LCDs

Signed-off-by: Cory Johns <johnsca@geek.net>