summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-08-11 09:25:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-11 17:43:24 (GMT)
commitca79c985727653656443da8d92c9f5c2b4da93ed (patch)
tree2d96eeda177a2e92f3cffa244463ab9782b7e84f /sha1_file.c
parent27b5c1a0653026645bd6908ee5abfdceb1c95082 (diff)
downloadgit-ca79c985727653656443da8d92c9f5c2b4da93ed.zip
git-ca79c985727653656443da8d92c9f5c2b4da93ed.tar.gz
git-ca79c985727653656443da8d92c9f5c2b4da93ed.tar.bz2
sha1_file: make packed_object_info public
Some code may have a pack/offset pair for an object, but would like to look up more information. Using sha1_object_info() is too heavy-weight; it starts from the sha1 and has to find the pack again (so not only does it waste time, it might not even find the same instance). In some cases, this problem is solved by helpers like get_size_from_delta(), which is used by pack-objects to take a shortcut for objects whose packed representation has already been found. But there's no similar function for getting the object type, for instance. Rather than introduce one, let's just make the whole packed_object_info() available. It is smart enough to spend effort only on the items the caller wants. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 090cedb..66edb5e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1970,8 +1970,8 @@ unwind:
goto out;
}
-static int packed_object_info(struct packed_git *p, off_t obj_offset,
- struct object_info *oi)
+int packed_object_info(struct packed_git *p, off_t obj_offset,
+ struct object_info *oi)
{
struct pack_window *w_curs = NULL;
unsigned long size;