1 #define USE_THE_REPOSITORY_VARIABLE
6 #include "object-store-ll.h"
8 #include "pack-mtimes.h"
11 static void dump_mtimes(struct packed_git
*p
)
14 if (load_pack_mtimes(p
) < 0)
15 die("could not load pack .mtimes");
17 for (i
= 0; i
< p
->num_objects
; i
++) {
19 if (nth_packed_object_id(&oid
, p
, i
) < 0)
20 die("could not load object id at position %"PRIu32
, i
);
22 printf("%s %"PRIu32
"\n",
23 oid_to_hex(&oid
), nth_packed_mtime(p
, i
));
27 static const char *pack_mtimes_usage
= "\n"
28 " test-tool pack-mtimes <pack-name.mtimes>";
30 int cmd__pack_mtimes(int argc
, const char **argv
)
32 struct strbuf buf
= STRBUF_INIT
;
35 setup_git_directory();
38 usage(pack_mtimes_usage
);
40 for (p
= get_all_packs(the_repository
); p
; p
= p
->next
) {
41 strbuf_addstr(&buf
, basename(p
->pack_name
));
42 strbuf_strip_suffix(&buf
, ".pack");
43 strbuf_addstr(&buf
, ".mtimes");
45 if (!strcmp(buf
.buf
, argv
[1]))
54 die("could not find pack '%s'", argv
[1]);