cat-file: add --batch-check=<format>
commit93d2a607ba05fba31442941d0425019120993846
authorJeff King <peff@peff.net>
Wed, 10 Jul 2013 11:45:47 +0000 (10 07:45 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Jul 2013 16:18:12 +0000 (12 09:18 -0700)
treef2fe7d26dc9e6a517a0a526eb0c6879ede4feab1
parentb71bd48017981f7257d8c0a5096825321b4fb49b
cat-file: add --batch-check=<format>

The `cat-file --batch-check` command can be used to quickly
get information about a large number of objects. However, it
provides a fixed set of information.

This patch adds an optional <format> option to --batch-check
to allow a caller to specify which items they are interested
in, and in which order to output them. This is not very
exciting for now, since we provide the same limited set that
you could already get. However, it opens the door to adding
new format items in the future without breaking backwards
compatibility (or forcing callers to pay the cost to
calculate uninteresting items).

Since the --batch option shares code with --batch-check, it
receives the same feature, though it is less likely to be of
interest there.

The format atom names are chosen to match their counterparts
in for-each-ref. Though we do not (yet) share any code with
for-each-ref's formatter, this keeps the interface as
consistent as possible, and may help later on if the
implementations are unified.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-cat-file.txt
builtin/cat-file.c
t/t1006-cat-file.sh