diff options
author | Jeff King <peff@peff.net> | 2015-02-08 20:13:22 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-02-09 14:14:53 -0800 |
commit | e6f875e052bb327d43d86b4e8335ebd4746d3e2a (patch) | |
tree | 18414f1349d6f3b8924b29880a736490f431f97f /cache.h | |
parent | 189a1222493f73977291f57d0f2030e982aff282 (diff) | |
download | git-e6f875e052bb327d43d86b4e8335ebd4746d3e2a.tar.gz |
for_each_loose_file_in_objdir: take an optional strbuf path
We feed a root "objdir" path to this iterator function,
which then copies the result into a strbuf, so that it can
repeatedly append the object sub-directories to it. Let's
make it easy for callers to just pass us a strbuf in the
first place.
We leave the original interface as a convenience for callers
who want to just pass a const string like the result of
get_object_directory().
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1256,6 +1256,10 @@ extern int unpack_object_header(struct packed_git *, struct pack_window **, off_ * * Any callback that is NULL will be ignored. Callbacks returning non-zero * will end the iteration. + * + * In the "buf" variant, "path" is a strbuf which will also be used as a + * scratch buffer, but restored to its original contents before + * the function returns. */ typedef int each_loose_object_fn(const unsigned char *sha1, const char *path, @@ -1271,6 +1275,11 @@ int for_each_loose_file_in_objdir(const char *path, each_loose_cruft_fn cruft_cb, each_loose_subdir_fn subdir_cb, void *data); +int for_each_loose_file_in_objdir_buf(struct strbuf *path, + each_loose_object_fn obj_cb, + each_loose_cruft_fn cruft_cb, + each_loose_subdir_fn subdir_cb, + void *data); /* * Iterate over loose and packed objects in both the local |