6 static void process_head_list(int verbose
)
10 while (fgets(buf
, sizeof(buf
), stdin
)) {
11 unsigned char sha1
[20];
12 struct commit
*commit
;
14 if (get_sha1_hex(buf
, sha1
)) {
15 error("ignoring: %s", buf
);
18 if (!(commit
= lookup_commit_reference(sha1
))) {
19 error("not a commit: %s", sha1_to_hex(sha1
));
22 record_rev_cache(commit
->object
.sha1
, verbose
? stderr
: NULL
);
27 static const char *build_rev_cache_usage
=
28 "git-build-rev-cache <rev-cache-file> < list-of-heads";
30 int main(int ac
, char **av
)
35 while (1 < ac
&& av
[1][0] == '-') {
36 if (!strcmp(av
[1], "-v"))
39 usage(build_rev_cache_usage
);
44 usage(build_rev_cache_usage
);
48 /* read existing rev-cache */
49 read_rev_cache(path
, NULL
, 0);
51 process_head_list(verbose
);
53 /* update the rev-cache database by appending newly found one to it */
54 write_rev_cache(path
, path
);