Found by the GExperts project in a review of its bug #587, in the recursive EnumDirsOnly of [features:#42] ([r2536]).
The links are walked after the ordinary tree. For each one, EnumDirsRecursively marks the target as visited before it asks the OnEnterDir callback (TryGetDirId(...) and TryVisit(Id) and not IsSkipped(...)). So a link that the callback leaves out by its own name still uses up its target, and a second link to the same directory is dropped.
Example with a callback that skips every name starting with .: junctions .lib and lib to a directory X outside the tree. .lib comes first, marks X as visited and is skipped; lib then finds X visited, so X is listed under neither name.
For an ordinary directory, marking it before the callback is intended: a directory the callback leaves out must not be reached through a link either. For a link, the target should only be marked once the callback has let the link through.
Fixed in revision [r2540].
Related
Commit: [r2540]