4 #include "object-store.h"
6 #include "pack-mtimes.h"
9 static void dump_mtimes(struct packed_git
*p
)
12 if (load_pack_mtimes(p
) < 0)
13 die("could not load pack .mtimes");
15 for (i
= 0; i
< p
->num_objects
; i
++) {
17 if (nth_packed_object_id(&oid
, p
, i
) < 0)
18 die("could not load object id at position %"PRIu32
, i
);
20 printf("%s %"PRIu32
"\n",
21 oid_to_hex(&oid
), nth_packed_mtime(p
, i
));
25 static const char *pack_mtimes_usage
= "\n"
26 " test-tool pack-mtimes <pack-name.mtimes>";
28 int cmd__pack_mtimes(int argc
, const char **argv
)
30 struct strbuf buf
= STRBUF_INIT
;
33 setup_git_directory();
36 usage(pack_mtimes_usage
);
38 for (p
= get_all_packs(the_repository
); p
; p
= p
->next
) {
39 strbuf_addstr(&buf
, basename(p
->pack_name
));
40 strbuf_strip_suffix(&buf
, ".pack");
41 strbuf_addstr(&buf
, ".mtimes");
43 if (!strcmp(buf
.buf
, argv
[1]))
52 die("could not find pack '%s'", argv
[1]);