* 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.) */
| 14 | * the one in gitdir.) |
| 15 | */ |
| 16 | static 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 | |
| 35 | int cmd__partial_clone(int argc, const char **argv) |
| 36 | { |
no test coverage detected