Add <limits.h> to the include files handled by "cache.h", and remove extraneous #include directives from various .c files. The rule is that "cache.h" gets all the basic stuff, so that we'll have as few system dependencies as possible.
Do the usage and error reporting in "usage.c", and the sha1 file accesses in "sha1_file.c". Small, nice, easily separated parts. Good.