Skip to content
  • Linus Torvalds's avatar
    Add 'fill_directory()' helper function for directory traversal · 1d8842d9
    Linus Torvalds authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Most of the users of "read_directory()" actually want a much simpler
    interface than the whole complex (but rather powerful) one.
    
    In fact 'git add' had already largely abstracted out the core interface
    issues into a private "fill_directory()" function that was largely
    applicable almost as-is to a number of callers.  Yes, 'git add' wants to
    do some extra work of its own, specific to the add semantics, but we can
    easily split that out, and use the core as a generic function.
    
    This function does exactly that, and now that much simplified
    'fill_directory()' function can be shared with a number of callers,
    while also ensuring that the rather more complex calling conventions of
    read_directory() are used by fewer call-sites.
    
    This also makes the 'common_prefix()' helper function private to dir.c,
    since all callers are now in that file.
    
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    1d8842d9