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 /* Should name foo.idx, but foo.pack may be named;
16 * convert it to foo.idx
18 if (has_extension(arg
, len
, ".pack")) {
19 strcpy(arg
+ len
- 5, ".idx");
22 /* Should name foo.idx now */
23 if ((g
= add_packed_git(arg
, len
, 1)))
25 /* No? did you name just foo? */
26 strcpy(arg
+ len
, ".idx");
28 if ((g
= add_packed_git(arg
, len
, 1)))
30 return error("packfile %s not found.", arg
);
32 return verify_pack(g
, verbose
);
35 static const char verify_pack_usage
[] = "git-verify-pack [-v] <pack>...";
37 int main(int ac
, char **av
)
41 int no_more_options
= 0;
45 if (!no_more_options
&& av
[1][0] == '-') {
46 if (!strcmp("-v", av
[1]))
48 else if (!strcmp("--", av
[1]))
51 usage(verify_pack_usage
);
54 if (verify_one_pack(av
[1], verbose
))
62 usage(verify_pack_usage
);