summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-12-10 15:29:44 -0800
committerRussell Belfer <rb@github.com>2012-12-10 15:38:41 -0800
commit91e7d26303b17c7ebc45ba565247e968aaa20848 (patch)
treecb205e56dfcbf9dd4df6ed150f152106aa6da342 /src/path.h
parent9950d27ab62cc31a3ebf1944fd33dd65432be790 (diff)
downloadlibgit2-91e7d26303b17c7ebc45ba565247e968aaa20848.tar.gz
Fix iterator reset and add reset ranges
The `git_iterator_reset` command has not been working in all cases particularly when there is a start and end range. This fixes it and adds tests for it, and also extends it with the ability to update the start/end range strings when an iterator is reset.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/path.h b/src/path.h
index b6292277f..db260d8e3 100644
--- a/src/path.h
+++ b/src/path.h
@@ -321,18 +321,33 @@ typedef struct {
} 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