aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-10-15 18:41:21 -0400
committerJunio C Hamano <gitster@pobox.com>2014-10-16 10:10:41 -0700
commit660c889e46d185dc98ba78963528826728b0a55d (patch)
treef70f42402438859d21623c290330cca9bc54a979 /cache.h
parent4a1e693a30c816fa5293c5f9e83e1e98ee87584e (diff)
downloadgit-660c889e46d185dc98ba78963528826728b0a55d.tar.gz
git-660c889e46d185dc98ba78963528826728b0a55d.tar.xz
sha1_file: add for_each iterators for loose and packed objects
We typically iterate over the reachable objects in a repository by starting at the tips and walking the graph. There's no easy way to iterate over all of the objects, including unreachable ones. Let's provide a way of doing so. 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.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index bdfbbcf79..51ee856ac 100644
--- a/cache.h
+++ b/cache.h
@@ -1272,6 +1272,17 @@ int for_each_loose_file_in_objdir(const char *path,
each_loose_subdir_fn subdir_cb,
void *data);
+/*
+ * Iterate over loose and packed objects in both the local
+ * repository and any alternates repositories.
+ */
+typedef int each_packed_object_fn(const unsigned char *sha1,
+ struct packed_git *pack,
+ uint32_t pos,
+ void *data);
+extern int for_each_loose_object(each_loose_object_fn, void *);
+extern int for_each_packed_object(each_packed_object_fn, void *);
+
struct object_info {
/* Request */
enum object_type *typep;