[Dir_contents] refactor walk function
[Dir_contents] refactor walk function

* Now the local parameter is always collected. Perviously, it was
collected only in the [(include_subdirs qualified)] mode. However, it's
simpler to just always calculate it and have th ecallers discard it in
unqualified mode.

* The function is now extracted into a separate [collect_group]
function.

Signed-off-by: Rudi Grinberg <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@rgrinberg.com>

janestreet/jbuilder,dra27/jbuilder,janestreet/jbuilder,dra27/jbuilder,dra27/jbuilder,janestreet/jbuilder,janestreet/jbuilder,janestreet/jbuilder,dra27/jbuilder,dra27/jbuilder,dra27/jbuilder,janestreet/jbuilder