4 static int verify_one_pack(const char *path, int verbose)
10 len = strlcpy(arg, path, PATH_MAX);
12 return error("name too long: %s", path);
15 * In addition to "foo.idx" we accept "foo.pack" and "foo";
16 * normalize these forms to "foo.idx" for add_packed_git().
18 if (has_extension(arg, len, ".pack")) {
19 strcpy(arg + len - 5, ".idx");
21 } else if (!has_extension(arg, len, ".idx")) {
22 if (len + 4 >= PATH_MAX)
23 return error("name too long: %s.idx", arg);
24 strcpy(arg + len, ".idx");
28 if (!(g = add_packed_git(arg, len, 1)))
29 return error("packfile %s not found.", arg);
31 return verify_pack(g, verbose);
34 static const char verify_pack_usage[] = "git-verify-pack [-v] <pack>...";
36 int main(int ac, char **av)
40 int no_more_options = 0;
44 if (!no_more_options && av[1][0] == '-') {
45 if (!strcmp("-v", av[1]))
47 else if (!strcmp("--", av[1]))
50 usage(verify_pack_usage);
53 if (verify_one_pack(av[1], verbose))
61 usage(verify_pack_usage);