summaryrefslogtreecommitdiff
path: root/Documentation/build-docdep.perl
diff options
context:
space:
mode:
authorDaniel Ferreira <bnmvco@gmail.com>2017-04-26 10:03:38 -0700
committerJunio C Hamano <gitster@pobox.com>2017-05-29 14:40:55 +0900
commit019440b2f039154c6a6da17088da206dd7e384ed (patch)
treef38937c9b77ce8ea812c3f6141335ec922ba5a54 /Documentation/build-docdep.perl
parenta8562cc960c9f0505fd23186258f7f9d4e7490ab (diff)
downloadgit-019440b2f039154c6a6da17088da206dd7e384ed.tar.gz
dir_iterator: rewrite state machine model
Perform a rewrite of dir_iterator_advance(). dir_iterator has ceased to rely on a combination of level.initialized and level.dir_state state variables and now only tracks the state with level.dir_state, which simplifies the iterator mechanism, makes the code easier to follow and eases additions of new features to the iterator. Make dir_iterator_begin() attempt to lstat() the path it receives, and return NULL and an appropriate errno if it fails or if the passed path was not a directory. Create an option for the dir_iterator API to iterate over subdirectories only after having iterated through their contents. This feature was predicted, although not implemented by 0fe5043 ("dir_iterator: new API for iterating over a directory tree", 2016-06-18). This is useful for recursively removing a directory and calling rmdir() on a directory only after all of its contents have been wiped. Add an option for dir_iterator to also iterate over the initial directory (the one passed to dir_iterator_begin()). Add the "flags" parameter to dir_iterator_create, allowing for the aforementioned new features to be enabled. The new default behavior (i.e. flags set to 0) does not iterate over directories. Flag DIR_ITERATOR_PRE_ORDER_TRAVERSAL iterates over a directory before doing so over its contents. DIR_ITERATOR_POST_ORDER_TRAVERSAL iterates over a directory after doing so over its contents. DIR_ITERATOR_LIST_ROOT_DIR iterates over the initial directory. These flags do not conflict with each other and may be used simultaneously. Amend a call to dir_iterator_begin() in refs/files-backend.c to pass the flags parameter introduced, as well as handle the case in which it fails to open the directory. Improve t/t0066-dir-iterator.sh and t/helper/test-dir-iterator.c to test "post-order" and "iterate-over-root" modes. Michael Haggerty contributed with the design of the new dir_iterator_advance() implementation, the code for t/helper/test-dir-iterator's option parser and numerous reviews that gradually shaped this code to its current form. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Daniel Ferreira <bnmvco@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/build-docdep.perl')
0 files changed, 0 insertions, 0 deletions