MCPcopy Create free account
hub / github.com/git/git / object_info

Function object_info

t/helper/test-partial-clone.c:16–33  ·  view source on GitHub ↗

* Prints the size of the object corresponding to the given hash in a specific * gitdir. This is similar to "git -C gitdir cat-file -s", except that this * exercises the code that accesses the object of an arbitrary repository that * is not the_repository. ("git -C gitdir" makes it so that the_repository is * the one in gitdir.) */

Source from the content-addressed store, hash-verified

14 * the one in gitdir.)
15 */
16static void object_info(const char *gitdir, const char *oid_hex)
17{
18 struct repository r;
19 struct object_id oid;
20 size_t size;
21 struct object_info oi = {.sizep = &size};
22 const char *p;
23
24 if (repo_init(&r, gitdir, NULL))
25 die("could not init repo");
26 if (parse_oid_hex_algop(oid_hex, &oid, &p, r.hash_algo))
27 die("could not parse oid");
28 if (odb_read_object_info_extended(r.objects, &oid, &oi, 0))
29 die("could not obtain object info");
30 printf("%d\n", (int) size);
31
32 repo_clear(&r);
33}
34
35int cmd__partial_clone(int argc, const char **argv)
36{

Callers 1

cmd__partial_cloneFunction · 0.70

Calls 4

repo_initFunction · 0.85
repo_clearFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected