Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/helper/test-pack-mtimes.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / helper / test-pack-mtimes.c` 59 lines ยท 1195 bytes Raw Blame History 1 #define USE_THE_REPOSITORY_VARIABLE 2 3 #include "test-tool.h" 4 #include "hex.h" 5 #include "strbuf.h" 6 #include "odb.h" 7 #include "packfile.h" 8 #include "pack-mtimes.h" 9 #include "setup.h" 10 11 static void dump_mtimes(struct packed_git *p) 12 { 13 uint32_t i; 14 if (load_pack_mtimes(p) < 0) 15 die("could not load pack .mtimes"); 16 17 for (i = 0; i < p->num_objects; i++) { 18 struct object_id oid; 19 if (nth_packed_object_id(&oid, p, i) < 0) 20 die("could not load object id at position %"PRIu32, i); 21 22 printf("%s %"PRIu32"\n", 23 oid_to_hex(&oid), nth_packed_mtime(p, i)); 24 } 25 } 26 27 static const char *const pack_mtimes_usage = "\n" 28 " test-tool pack-mtimes "; 29 30 int cmd__pack_mtimes(int argc, const char **argv) 31 { 32 struct strbuf buf = STRBUF_INIT; 33 struct packed_git *p; 34 35 setup_git_directory(the_repository); 36 37 if (argc != 2) 38 usage(pack_mtimes_usage); 39 40 repo_for_each_pack(the_repository, p) { 41 strbuf_addstr(&buf, basename(p->pack_name)); 42 strbuf_strip_suffix(&buf, ".pack"); 43 strbuf_addstr(&buf, ".mtimes"); 44 45 if (!strcmp(buf.buf, argv[1])) 46 break; 47 48 strbuf_reset(&buf); 49 } 50 51 strbuf_release(&buf); 52 53 if (!p) 54 die("could not find pack '%s'", argv[1]); 55 56 dump_mtimes(p); 57 58 return 0; 59 }