vendor/libgit2/src/path.h in rugged-0.17.0.b7 vs vendor/libgit2/src/path.h in rugged-0.18.0.b1

- old
+ new

@@ -1,7 +1,7 @@ /* - * Copyright (C) 2009-2012 the libgit2 contributors + * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #ifndef INCLUDE_path_h__ @@ -259,15 +259,16 @@ git_buf *pathbuf, int (*fn)(void *, git_buf *), void *state); /** - * Sort function to order two paths. + * Sort function to order two paths */ extern int git_path_cmp( const char *name1, size_t len1, int isdir1, - const char *name2, size_t len2, int isdir2); + const char *name2, size_t len2, int isdir2, + int (*compare)(const char *, const char *, size_t)); /** * Invoke callback up path directory by directory until the ceiling is * reached (inclusive of a final call at the root_path). * @@ -319,20 +320,35 @@ size_t path_len; char path[GIT_FLEX_ARRAY]; } git_path_with_stat; extern int git_path_with_stat_cmp(const void *a, const void *b); +extern int git_path_with_stat_cmp_icase(const void *a, const void *b); /** * Load all directory entries along with stat info into a vector. * - * This is just like git_path_dirload except that each entry in the - * vector is a git_path_with_stat structure that contains both the - * path and the stat info, plus directories will have a / suffixed - * to their path name. + * This adds four things on top of plain `git_path_dirload`: + * + * 1. Each entry in the vector is a `git_path_with_stat` struct that + * contains both the path and the stat info + * 2. The entries will be sorted alphabetically + * 3. Entries that are directories will be suffixed with a '/' + * 4. Optionally, you can be a start and end prefix and only elements + * after the start and before the end (inclusively) will be stat'ed. + * + * @param path The directory to read from + * @param prefix_len The trailing part of path to prefix to entry paths + * @param ignore_case How to sort and compare paths with start/end limits + * @param start_stat As optimization, only stat values after this prefix + * @param end_stat As optimization, only stat values before this prefix + * @param contents Vector to fill with git_path_with_stat structures */ extern int git_path_dirload_with_stat( const char *path, size_t prefix_len, + bool ignore_case, + const char *start_stat, + const char *end_stat, git_vector *contents); #endif