Raw
1 /*
2 * test-name-hash.c: Read a list of paths over stdin and report on their
3 * name-hash and full name-hash.
4 */
5
6 #include "test-tool.h"
7 #include "git-compat-util.h"
8 #include "pack-objects.h"
9 #include "strbuf.h"
10
11 int cmd__name_hash(int argc UNUSED, const char **argv UNUSED)
12 {
13 struct strbuf line = STRBUF_INIT;
14
15 while (!strbuf_getline(&line, stdin)) {
16 printf("%10u ", pack_name_hash(line.buf));
17 printf("%10u ", pack_name_hash_v2((unsigned const char *)line.buf));
18 printf("%s\n", line.buf);
19 }
20
21 strbuf_release(&line);
22 return 0;
23 }